LuaScans: change theme (#5034)

This commit is contained in:
AwkwardPeak7 2024-09-14 11:01:53 +05:00 committed by Draff
parent d1c75db514
commit 33e3638351
No known key found for this signature in database
GPG Key ID: E8A89F3211677653
4 changed files with 8 additions and 49 deletions

View File

@ -2,4 +2,4 @@ plugins {
id("lib-multisrc") id("lib-multisrc")
} }
baseVersionCode = 6 baseVersionCode = 7

View File

@ -1,7 +1,6 @@
package eu.kanade.tachiyomi.multisrc.keyoapp package eu.kanade.tachiyomi.multisrc.keyoapp
import eu.kanade.tachiyomi.network.GET 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.Filter
import eu.kanade.tachiyomi.source.model.FilterList import eu.kanade.tachiyomi.source.model.FilterList
import eu.kanade.tachiyomi.source.model.MangasPage import eu.kanade.tachiyomi.source.model.MangasPage
@ -31,9 +30,7 @@ abstract class Keyoapp(
) : ParsedHttpSource() { ) : ParsedHttpSource() {
override val supportsLatest = true override val supportsLatest = true
override val client = network.cloudflareClient.newBuilder() override val client = network.cloudflareClient
.rateLimit(2)
.build()
override fun headersBuilder() = super.headersBuilder() override fun headersBuilder() = super.headersBuilder()
.add("Referer", "$baseUrl/") .add("Referer", "$baseUrl/")

View File

@ -1,9 +1,9 @@
ext { ext {
extName = 'Lua Scans' extName = 'Lua Scans'
extClass = '.LuaScans' extClass = '.LuaScans'
themePkg = 'mangathemesia' themePkg = 'keyoapp'
baseUrl = 'https://luacomic.net' baseUrl = 'https://luacomic.net'
overrideVersionCode = 5 overrideVersionCode = 29
} }
apply from: "$rootDir/common.gradle" apply from: "$rootDir/common.gradle"

View File

@ -1,50 +1,12 @@
package eu.kanade.tachiyomi.extension.en.luascans package eu.kanade.tachiyomi.extension.en.luascans
import eu.kanade.tachiyomi.multisrc.mangathemesia.MangaThemesia import eu.kanade.tachiyomi.multisrc.keyoapp.Keyoapp
import eu.kanade.tachiyomi.network.interceptor.rateLimit
import okhttp3.Cookie
import okhttp3.Interceptor
import okhttp3.OkHttpClient
import okhttp3.Response
import org.jsoup.Jsoup
class LuaScans : MangaThemesia( class LuaScans : Keyoapp(
"Lua Scans", "Lua Scans",
"https://luacomic.net", "https://luacomic.net",
"en", "en",
) { ) {
override val client: OkHttpClient = super.client.newBuilder() // migrated from MangaThemesia to Keyoapp
.addInterceptor(::wafffCookieInterceptor) override val versionId = 2
.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*['"](?<waff>.*)['"]""")
} }