From cfc2fcbf4bad2f9562e5f227d8c9eca865aced9e Mon Sep 17 00:00:00 2001 From: Secozzi <49240133+Secozzi@users.noreply.github.com> Date: Fri, 3 May 2024 12:24:28 +0000 Subject: [PATCH] Luratoon: add referer (#2799) * add referer * move fix to base theme * add location to non zipped images --- lib-multisrc/peachscan/build.gradle.kts | 2 +- .../kanade/tachiyomi/multisrc/peachscan/PeachScan.kt | 11 +++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/lib-multisrc/peachscan/build.gradle.kts b/lib-multisrc/peachscan/build.gradle.kts index 0006c9a50..c10d061f2 100644 --- a/lib-multisrc/peachscan/build.gradle.kts +++ b/lib-multisrc/peachscan/build.gradle.kts @@ -2,7 +2,7 @@ plugins { id("lib-multisrc") } -baseVersionCode = 4 +baseVersionCode = 5 dependencies { compileOnly("com.github.tachiyomiorg:image-decoder:e08e9be535") diff --git a/lib-multisrc/peachscan/src/eu/kanade/tachiyomi/multisrc/peachscan/PeachScan.kt b/lib-multisrc/peachscan/src/eu/kanade/tachiyomi/multisrc/peachscan/PeachScan.kt index 4a1a71225..62cea1ed0 100644 --- a/lib-multisrc/peachscan/src/eu/kanade/tachiyomi/multisrc/peachscan/PeachScan.kt +++ b/lib-multisrc/peachscan/src/eu/kanade/tachiyomi/multisrc/peachscan/PeachScan.kt @@ -156,18 +156,25 @@ abstract class PeachScan( override fun pageListParse(document: Document): List { val scriptElement = document.selectFirst("script:containsData(const urls =[)") ?: return document.select("#imageContainer img").mapIndexed { i, it -> - Page(i, imageUrl = it.attr("abs:src")) + Page(i, document.location(), it.attr("abs:src")) } val urls = scriptElement.html().substringAfter("const urls =[").substringBefore("];") return urls.split(",").mapIndexed { i, it -> - Page(i, imageUrl = baseUrl + it.trim().removeSurrounding("'") + "#page") + Page(i, document.location(), baseUrl + it.trim().removeSurrounding("'") + "#page") } } override fun imageUrlParse(document: Document) = throw UnsupportedOperationException() + override fun imageRequest(page: Page): Request { + val imgHeaders = headersBuilder() + .add("Referer", page.url) + .build() + return GET(page.imageUrl!!, imgHeaders) + } + private val dataUriRegex = Regex("""base64,([0-9a-zA-Z/+=\s]+)""") private fun zipImageInterceptor(chain: Interceptor.Chain): Response {