Skip to content
This repository was archived by the owner on Jul 29, 2022. It is now read-only.

Commit 754f174

Browse files
authored
Merge pull request #120 from readium/2.0.0-alpha.1
2.0.0-alpha.1
2 parents 24a9ccf + 93b42ba commit 754f174

File tree

5 files changed

+35
-18
lines changed

5 files changed

+35
-18
lines changed

.github/CODEOWNERS

Lines changed: 0 additions & 1 deletion
This file was deleted.

CHANGELOG.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,9 @@ All notable changes to this project will be documented in this file.
44

55
**Warning:** Features marked as *experimental* may change or be removed in a future release without notice. Use with caution.
66

7-
[unreleased]: https://github.com/readium/r2-streamer-kotlin/compare/master...HEAD
8-
[1.2.0]: https://github.com/readium/r2-streamer-kotlin/compare/1.1.5...1.2.0
9-
107
## [Unreleased]
118

12-
## [1.2.0]
9+
## [2.0.0-alpha.1]
1310

1411
### Added
1512

@@ -40,3 +37,7 @@ server.loadCustomResource(assets.open("scripts/highlight.js"), "highlight.js", I
4037
* [`Server` was broken](https://github.com/readium/r2-testapp-kotlin/pull/306) when provided with publication filenames containing invalid characters.
4138
* [EPUB publishers' default styles are not overriden by Readium CSS anymore](https://github.com/readium/r2-navigator-kotlin/issues/132).
4239
* The `AndroidManifest.xml` is not forcing anymore `allowBackup` and `supportsRtl`, to let reading apps manage these features themselves (contributed by [@twaddington](https://github.com/readium/r2-streamer-kotlin/pull/93)).
40+
41+
42+
[unreleased]: https://github.com/readium/r2-streamer-kotlin/compare/master...HEAD
43+
[2.0.0-alpha.1]: https://github.com/readium/r2-streamer-kotlin/compare/1.1.5...2.0.0-alpha.1

r2-streamer/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ dependencies {
4242
if (findProject(':r2-shared')) {
4343
implementation project(':r2-shared')
4444
} else {
45-
implementation "com.github.readium:r2-shared-kotlin:1.1.6"
45+
implementation "com.github.readium:r2-shared-kotlin:2.0.0-alpha.1"
4646
}
4747

4848
//AM NOTE: conflicting support libraries, excluding these

r2-streamer/src/main/java/org/readium/r2/streamer/parser/epub/PublicationFactory.kt

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,12 @@
1010
package org.readium.r2.streamer.parser.epub
1111

1212
import org.readium.r2.shared.extensions.toMap
13-
import org.readium.r2.shared.publication.*
14-
import org.readium.r2.shared.publication.encryption.Encryption
1513
import org.readium.r2.shared.normalize
14+
import org.readium.r2.shared.publication.Link
15+
import org.readium.r2.shared.publication.Properties
16+
import org.readium.r2.shared.publication.Publication
17+
import org.readium.r2.shared.publication.PublicationCollection
18+
import org.readium.r2.shared.publication.encryption.Encryption
1619

1720
/**
1821
* Creates a [Publication] model from an EPUB package's document.
@@ -65,8 +68,17 @@ internal class PublicationFactory(
6568

6669
// Compute toc and otherCollections
6770
val toc = navigationData["toc"].orEmpty()
68-
val otherCollections =
69-
navigationData.minus("toc").map { PublicationCollection(links = it.value, role = it.key) }
71+
val otherCollections = navigationData
72+
.minus("toc")
73+
.mapKeys {
74+
when (it.key) {
75+
// RWPM uses camel case for the roles
76+
// https://github.com/readium/webpub-manifest/issues/53
77+
"page-list" -> "pageList"
78+
else -> it.key
79+
}
80+
}
81+
.map { PublicationCollection(links = it.value, role = it.key) }
7082

7183
// Build Publication object
7284
return Publication(

r2-streamer/src/main/java/org/readium/r2/streamer/server/Server.kt

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -97,15 +97,20 @@ abstract class AbstractServer(private var port: Int, private val context: Contex
9797
catch (e: Exception) { baseUrl.path }
9898

9999
if (containsMediaOverlay) {
100-
addRoute(basePath + MEDIA_OVERLAY_HANDLE, MediaOverlayHandler::class.java, fetcher)
100+
setRoute(basePath + MEDIA_OVERLAY_HANDLE, MediaOverlayHandler::class.java, fetcher)
101101
}
102-
addRoute(basePath + JSON_MANIFEST_HANDLE, ManifestHandler::class.java, fetcher)
103-
addRoute(basePath + MANIFEST_HANDLE, ManifestHandler::class.java, fetcher)
104-
addRoute(basePath + MANIFEST_ITEM_HANDLE, PublicationResourceHandler::class.java, fetcher)
105-
addRoute(ASSETS_HANDLE, AssetHandler::class.java, assets)
106-
addRoute(JS_HANDLE, ResourceHandler::class.java, resources)
107-
addRoute(CSS_HANDLE, ResourceHandler::class.java, resources)
108-
addRoute(FONT_HANDLE, FileHandler::class.java, fonts)
102+
setRoute(basePath + JSON_MANIFEST_HANDLE, ManifestHandler::class.java, fetcher)
103+
setRoute(basePath + MANIFEST_HANDLE, ManifestHandler::class.java, fetcher)
104+
setRoute(basePath + MANIFEST_ITEM_HANDLE, PublicationResourceHandler::class.java, fetcher)
105+
setRoute(ASSETS_HANDLE, AssetHandler::class.java, assets)
106+
setRoute(JS_HANDLE, ResourceHandler::class.java, resources)
107+
setRoute(CSS_HANDLE, ResourceHandler::class.java, resources)
108+
setRoute(FONT_HANDLE, FileHandler::class.java, fonts)
109+
}
110+
111+
private fun setRoute(url: String, handler: Class<*>, vararg initParameter: Any) {
112+
try { removeRoute(url) } catch (e: Exception) {}
113+
addRoute(url, handler, *initParameter)
109114
}
110115

111116
// FIXME: To review once the media-overlays will be supported in the Publication model

0 commit comments

Comments
 (0)