diff --git a/src/all/cubari/AndroidManifest.xml b/src/all/cubari/AndroidManifest.xml index eb94b7964..3cfd493e8 100644 --- a/src/all/cubari/AndroidManifest.xml +++ b/src/all/cubari/AndroidManifest.xml @@ -53,6 +53,19 @@ android:pathPattern="/a/..*" android:scheme="https" /> + + + + + + + + + + + diff --git a/src/all/cubari/build.gradle b/src/all/cubari/build.gradle index 900e4677d..335aefa9f 100644 --- a/src/all/cubari/build.gradle +++ b/src/all/cubari/build.gradle @@ -6,7 +6,7 @@ ext { extName = 'Cubari' pkgNameSuffix = "all.cubari" extClass = '.CubariFactory' - extVersionCode = 16 + extVersionCode = 17 } apply from: "$rootDir/common.gradle" diff --git a/src/all/cubari/src/eu/kanade/tachiyomi/extension/all/cubari/Cubari.kt b/src/all/cubari/src/eu/kanade/tachiyomi/extension/all/cubari/Cubari.kt index aef29ccd3..0b9d51d06 100644 --- a/src/all/cubari/src/eu/kanade/tachiyomi/extension/all/cubari/Cubari.kt +++ b/src/all/cubari/src/eu/kanade/tachiyomi/extension/all/cubari/Cubari.kt @@ -180,21 +180,20 @@ open class Cubari(override val lang: String) : HttpSource() { private fun seriesJsonPageListParse(response: Response, chapter: SChapter): List { val jsonObj = json.parseToJsonElement(response.body.string()).jsonObject val groups = jsonObj["groups"]!!.jsonObject - val groupMap = groups.entries - .map { Pair(it.value.jsonPrimitive.content, it.key) } - .toMap() + val groupMap = groups.entries.associateBy({ it.value.jsonPrimitive.content.ifEmpty { "default" } }, { it.key }) + val chapterScanlator = chapter.scanlator ?: "default" // workaround for "" as group causing NullPointerException (#13772) val chapters = jsonObj["chapters"]!!.jsonObject val pages = if (chapters[chapter.chapter_number.toString()] != null) { chapters[chapter.chapter_number.toString()]!! .jsonObject["groups"]!! - .jsonObject[groupMap[chapter.scanlator]]!! + .jsonObject[groupMap[chapterScanlator]]!! .jsonArray } else { chapters[chapter.chapter_number.toInt().toString()]!! .jsonObject["groups"]!! - .jsonObject[groupMap[chapter.scanlator]]!! + .jsonObject[groupMap[chapterScanlator]]!! .jsonArray } @@ -283,8 +282,8 @@ open class Cubari(override val lang: String) : HttpSource() { scanlator = groups[groupNum]!!.jsonPrimitive.content chapter_number = chapterNum.toFloatOrNull() ?: -1f - if (releaseDate != null) { - date_upload = releaseDate.jsonPrimitive.double.toLong() * 1000 + date_upload = if (releaseDate != null) { + releaseDate.jsonPrimitive.double.toLong() * 1000 } else { val currentTimeMillis = System.currentTimeMillis() @@ -292,7 +291,7 @@ open class Cubari(override val lang: String) : HttpSource() { seriesPrefsEditor.putLong(chapterNum, currentTimeMillis) } - date_upload = seriesPrefs.getLong(chapterNum, currentTimeMillis) + seriesPrefs.getLong(chapterNum, currentTimeMillis) } name = if (volume != null) { diff --git a/src/all/cubari/src/eu/kanade/tachiyomi/extension/all/cubari/CubariUrlActivity.kt b/src/all/cubari/src/eu/kanade/tachiyomi/extension/all/cubari/CubariUrlActivity.kt index de2a9ca6c..7a3badcd9 100644 --- a/src/all/cubari/src/eu/kanade/tachiyomi/extension/all/cubari/CubariUrlActivity.kt +++ b/src/all/cubari/src/eu/kanade/tachiyomi/extension/all/cubari/CubariUrlActivity.kt @@ -17,7 +17,8 @@ class CubariUrlActivity : Activity() { if (host != null && pathSegments != null) { val query = with(host) { when { - equals("m.imgur.com") || equals("imgur.com") -> fromImgur(pathSegments) + equals("m.imgur.com") || equals("imgur.com") -> fromSource("imgur", pathSegments) + equals("m.reddit.com") || equals("reddit.com") || equals("www.reddit.com") -> fromSource("reddit", pathSegments) else -> fromCubari(pathSegments) } } @@ -45,11 +46,11 @@ class CubariUrlActivity : Activity() { exitProcess(0) } - private fun fromImgur(pathSegments: List): String? { + private fun fromSource(source: String, pathSegments: List): String? { if (pathSegments.size >= 2) { val id = pathSegments[1] - return "${Cubari.PROXY_PREFIX}imgur/$id" + return "${Cubari.PROXY_PREFIX}$source/$id" } return null }