Enable MangaPlus chapters in mangadex delegation

This commit is contained in:
Jobobby04 2021-05-09 22:20:39 -04:00
parent 1f9b69fc07
commit 333f55a44b
3 changed files with 5 additions and 8 deletions

View File

@ -4,9 +4,6 @@ import eu.kanade.tachiyomi.network.parseAs
import eu.kanade.tachiyomi.source.model.Page import eu.kanade.tachiyomi.source.model.Page
import exh.md.handlers.serializers.ChapterResponse import exh.md.handlers.serializers.ChapterResponse
import exh.md.utils.MdUtil import exh.md.utils.MdUtil
import kotlinx.serialization.json.JsonObject
import kotlinx.serialization.json.jsonObject
import kotlinx.serialization.json.jsonPrimitive
import okhttp3.Response import okhttp3.Response
class ApiChapterParser { class ApiChapterParser {
@ -33,8 +30,8 @@ class ApiChapterParser {
} }
fun externalParse(response: Response): String { fun externalParse(response: Response): String {
val json = response.parseAs<JsonObject>() val chapterResponse = response.parseAs<ChapterResponse>()
val external = json["data"]!!.jsonObject["pages"]!!.jsonPrimitive.content val external = chapterResponse.data.attributes.data.first()
return external.substringAfterLast("/") return external.substringAfterLast("/")
} }
} }

View File

@ -245,7 +245,7 @@ class ApiMangaParser(val client: OkHttpClient, private val lang: String) {
.map { .map {
mapChapter(it, groupMap) mapChapter(it, groupMap)
}.filter { }.filter {
it.dateUpload <= now && "MangaPlus" != it.scanlator it.dateUpload <= now
}.toList() }.toList()
} }

View File

@ -82,11 +82,11 @@ class MangaPlusHandler(currentClient: OkHttpClient) {
val content = image val content = image
.map { it.toInt() } .map { it.toInt() }
.toMutableList() .toIntArray()
val blockSizeInBytes = keyStream.size val blockSizeInBytes = keyStream.size
for ((i, value) in content.iterator().withIndex()) { content.forEachIndexed { i, value ->
content[i] = value xor keyStream[i % blockSizeInBytes] content[i] = value xor keyStream[i % blockSizeInBytes]
} }