From 33e3638351cab7b3fc4ecb157b3ba9c3899c8909 Mon Sep 17 00:00:00 2001 From: AwkwardPeak7 <48650614+AwkwardPeak7@users.noreply.github.com> Date: Sat, 14 Sep 2024 11:01:53 +0500 Subject: [PATCH] LuaScans: change theme (#5034) --- lib-multisrc/keyoapp/build.gradle.kts | 2 +- .../tachiyomi/multisrc/keyoapp/Keyoapp.kt | 5 +- src/en/luascans/build.gradle | 4 +- .../extension/en/luascans/LuaScans.kt | 46 ++----------------- 4 files changed, 8 insertions(+), 49 deletions(-) diff --git a/lib-multisrc/keyoapp/build.gradle.kts b/lib-multisrc/keyoapp/build.gradle.kts index ede652be5..f0ad544d5 100644 --- a/lib-multisrc/keyoapp/build.gradle.kts +++ b/lib-multisrc/keyoapp/build.gradle.kts @@ -2,4 +2,4 @@ plugins { id("lib-multisrc") } -baseVersionCode = 6 +baseVersionCode = 7 diff --git a/lib-multisrc/keyoapp/src/eu/kanade/tachiyomi/multisrc/keyoapp/Keyoapp.kt b/lib-multisrc/keyoapp/src/eu/kanade/tachiyomi/multisrc/keyoapp/Keyoapp.kt index 4ce5eba1d..b7c0d3a08 100644 --- a/lib-multisrc/keyoapp/src/eu/kanade/tachiyomi/multisrc/keyoapp/Keyoapp.kt +++ b/lib-multisrc/keyoapp/src/eu/kanade/tachiyomi/multisrc/keyoapp/Keyoapp.kt @@ -1,7 +1,6 @@ package eu.kanade.tachiyomi.multisrc.keyoapp import eu.kanade.tachiyomi.network.GET -import eu.kanade.tachiyomi.network.interceptor.rateLimit import eu.kanade.tachiyomi.source.model.Filter import eu.kanade.tachiyomi.source.model.FilterList import eu.kanade.tachiyomi.source.model.MangasPage @@ -31,9 +30,7 @@ abstract class Keyoapp( ) : ParsedHttpSource() { override val supportsLatest = true - override val client = network.cloudflareClient.newBuilder() - .rateLimit(2) - .build() + override val client = network.cloudflareClient override fun headersBuilder() = super.headersBuilder() .add("Referer", "$baseUrl/") diff --git a/src/en/luascans/build.gradle b/src/en/luascans/build.gradle index d09a19a2c..a8b15d9a5 100644 --- a/src/en/luascans/build.gradle +++ b/src/en/luascans/build.gradle @@ -1,9 +1,9 @@ ext { extName = 'Lua Scans' extClass = '.LuaScans' - themePkg = 'mangathemesia' + themePkg = 'keyoapp' baseUrl = 'https://luacomic.net' - overrideVersionCode = 5 + overrideVersionCode = 29 } apply from: "$rootDir/common.gradle" diff --git a/src/en/luascans/src/eu/kanade/tachiyomi/extension/en/luascans/LuaScans.kt b/src/en/luascans/src/eu/kanade/tachiyomi/extension/en/luascans/LuaScans.kt index 4a99e68dc..755bbe32a 100644 --- a/src/en/luascans/src/eu/kanade/tachiyomi/extension/en/luascans/LuaScans.kt +++ b/src/en/luascans/src/eu/kanade/tachiyomi/extension/en/luascans/LuaScans.kt @@ -1,50 +1,12 @@ package eu.kanade.tachiyomi.extension.en.luascans -import eu.kanade.tachiyomi.multisrc.mangathemesia.MangaThemesia -import eu.kanade.tachiyomi.network.interceptor.rateLimit -import okhttp3.Cookie -import okhttp3.Interceptor -import okhttp3.OkHttpClient -import okhttp3.Response -import org.jsoup.Jsoup +import eu.kanade.tachiyomi.multisrc.keyoapp.Keyoapp -class LuaScans : MangaThemesia( +class LuaScans : Keyoapp( "Lua Scans", "https://luacomic.net", "en", ) { - override val client: OkHttpClient = super.client.newBuilder() - .addInterceptor(::wafffCookieInterceptor) - .rateLimit(2) - .build() - - private fun wafffCookieInterceptor(chain: Interceptor.Chain): Response { - val request = chain.request() - val response = chain.proceed(request) - - val document = Jsoup.parse( - response.peekBody(Long.MAX_VALUE).string(), - response.request.url.toString(), - ) - - return if (document.selectFirst("script:containsData(wafff)") != null) { - val script = document.selectFirst("script:containsData(wafff)")!!.data() - - val cookie = waffRegex.find(script)?.groups?.get("waff")?.value - ?.let { Cookie.parse(request.url, it) } - - client.cookieJar.saveFromResponse( - request.url, - listOfNotNull(cookie), - ) - - response.close() - - chain.proceed(request) - } else { - response - } - } - - private val waffRegex = Regex("""document\.cookie\s*=\s*['"](?.*)['"]""") + // migrated from MangaThemesia to Keyoapp + override val versionId = 2 }