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")
}
baseVersionCode = 6
baseVersionCode = 7

View File

@ -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/")

View File

@ -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"

View File

@ -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*['"](?<waff>.*)['"]""")
// migrated from MangaThemesia to Keyoapp
override val versionId = 2
}