diff --git a/multisrc/overrides/madara/reaperscans/src/ReaperScansFactory.kt b/multisrc/overrides/madara/reaperscans/src/ReaperScansFactory.kt index 81bb5b826..5ee55cdd5 100644 --- a/multisrc/overrides/madara/reaperscans/src/ReaperScansFactory.kt +++ b/multisrc/overrides/madara/reaperscans/src/ReaperScansFactory.kt @@ -12,9 +12,14 @@ import eu.kanade.tachiyomi.source.online.ParsedHttpSource import eu.kanade.tachiyomi.util.asJsoup import kotlinx.serialization.json.Json import kotlinx.serialization.json.JsonObject +import kotlinx.serialization.json.add +import kotlinx.serialization.json.addJsonObject import kotlinx.serialization.json.buildJsonObject import kotlinx.serialization.json.jsonObject import kotlinx.serialization.json.jsonPrimitive +import kotlinx.serialization.json.put +import kotlinx.serialization.json.putJsonArray +import kotlinx.serialization.json.putJsonObject import okhttp3.HttpUrl.Companion.toHttpUrl import okhttp3.MediaType.Companion.toMediaTypeOrNull import okhttp3.Request @@ -146,19 +151,31 @@ class ReaperScansEn : ParsedHttpSource() { } if (csrfToken != null && initialProps is JsonObject) { - var csrf = csrfToken var serverMemo = initialProps["serverMemo"]!!.jsonObject - var fingerprint = initialProps["fingerprint"]!! + val fingerprint = initialProps["fingerprint"]!! var nextPage = 2 while (document.select(popularMangaNextPageSelector()).isNotEmpty()) { val payload = buildJsonObject { put("fingerprint", fingerprint) put("serverMemo", serverMemo) - put("updates", json.parseToJsonElement("[{\"type\":\"callMethod\",\"payload\":{\"id\":\"9jhcg\",\"method\":\"gotoPage\",\"params\":[$nextPage,\"page\"]}}]")) +// put("updates", json.parseToJsonElement("[{\"type\":\"callMethod\",\"payload\":{\"id\":\"9jhcg\",\"method\":\"gotoPage\",\"params\":[$nextPage,\"page\"]}}]")) + putJsonArray("updates") { + addJsonObject { + put("type", "callMethod") + putJsonObject("payload") { + put("id", "9jhcg") + put("method", "gotoPage") + putJsonArray("params") { + add(nextPage) + add("page") + } + } + } + } }.toString().toRequestBody("application/json; charset=utf-8".toMediaTypeOrNull()) - val request = Request.Builder().url("$baseUrl/livewire/message/frontend.comic-chapters-list").method("POST", payload).addHeader("x-csrf-token", csrf).addHeader("x-livewire", "true").build() + val request = Request.Builder().url("$baseUrl/livewire/message/frontend.comic-chapters-list").method("POST", payload).addHeader("x-csrf-token", csrfToken).addHeader("x-livewire", "true").build() val response1 = client.newCall(request).execute() val responseText = response1.body!!.string() @@ -218,13 +235,23 @@ class ReaperScansEn : ParsedHttpSource() { } if (csrfToken != null && initialProps is JsonObject) { - var serverMemo = initialProps["serverMemo"]!!.jsonObject - var fingerprint = initialProps["fingerprint"]!! + val serverMemo = initialProps["serverMemo"]!!.jsonObject + val fingerprint = initialProps["fingerprint"]!! val payload = buildJsonObject { put("fingerprint", fingerprint) put("serverMemo", serverMemo) - put("updates", json.parseToJsonElement("[{\"type\":\"syncInput\",\"payload\":{\"id\":\"03r6\",\"name\":\"query\",\"value\":\"$query\"}}]")) +// put("updates", json.parseToJsonElement("[{\"type\":\"syncInput\",\"payload\":{\"id\":\"03r6\",\"name\":\"query\",\"value\":\"$query\"}}]")) + putJsonArray("updates") { + addJsonObject { + put("type", "syncInput") + putJsonObject("payload") { + put("id", "03r6") + put("name", "query") + put("value", query) + } + } + } }.toString().toRequestBody("application/json; charset=utf-8".toMediaTypeOrNull()) return Request.Builder().url("$baseUrl/livewire/message/frontend.global-search").method("POST", payload).addHeader("x-csrf-token", csrfToken).addHeader("x-livewire", "true").build() diff --git a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/madara/MadaraGenerator.kt b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/madara/MadaraGenerator.kt index be7c5edcd..b8e01c964 100644 --- a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/madara/MadaraGenerator.kt +++ b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/madara/MadaraGenerator.kt @@ -17,7 +17,7 @@ class MadaraGenerator : ThemeSourceGenerator { MultiLang("MangaForFree.net", "https://mangaforfree.net", listOf("en", "ko", "all"), isNsfw = true, className = "MangaForFreeFactory", pkgName = "mangaforfree", overrideVersionCode = 1), MultiLang("Manhwa18.cc", "https://manhwa18.cc", listOf("en", "ko", "all"), isNsfw = true, className = "Manhwa18CcFactory", pkgName = "manhwa18cc", overrideVersionCode = 2), MultiLang("Olympus Scanlation", "https://olympusscanlation.com", listOf("es", "pt-BR")), - MultiLang("Reaper Scans", "https://reaperscans.com", listOf("en", "fr", "id", "tr"), className = "ReaperScansFactory", pkgName = "reaperscans", overrideVersionCode = 8), + MultiLang("Reaper Scans", "https://reaperscans.com", listOf("en", "fr", "id", "tr"), className = "ReaperScansFactory", pkgName = "reaperscans", overrideVersionCode = 9), MultiLang("Seven King Scanlation", "https://sksubs.net", listOf("es", "en"), isNsfw = true), SingleLang("1st Kiss Manga.love", "https://1stkissmanga.love", "en", className = "FirstKissMangaLove", overrideVersionCode = 1), SingleLang("1st Kiss Manhua", "https://1stkissmanhua.com", "en", className = "FirstKissManhua", overrideVersionCode = 3),