MagusManga: Update image URL (#4949)

* Bump versionCode

* MagusManga: Update cdnUrl

* MagusManga: Remove fallbackCdnInterceptor
This commit is contained in:
Smol Ame 2024-09-07 20:25:55 -07:00 committed by GitHub
parent 509a375d7e
commit 3062e6ff34
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 23 deletions

View File

@ -3,7 +3,7 @@ ext {
extClass = '.MagusManga'
themePkg = 'keyoapp'
baseUrl = 'https://magustoon.com'
overrideVersionCode = 34
overrideVersionCode = 35
}
apply from: "$rootDir/common.gradle"

View File

@ -15,13 +15,12 @@ class MagusManga : Keyoapp(
"https://magustoon.com",
"en",
) {
private val cdnUrl = "https://cdn.magustoon.com"
private val cdnUrl = "https://cdn.igniscans.com"
override val versionId = 2
override val client = network.cloudflareClient.newBuilder()
.addInterceptor(::captchaInterceptor)
.addInterceptor(::fallbackCdnInterceptor)
.rateLimitHost(baseUrl.toHttpUrl(), 1)
.rateLimitHost(cdnUrl.toHttpUrl(), 1)
.build()
@ -53,26 +52,7 @@ class MagusManga : Keyoapp(
return document.select("#pages > img").mapIndexed { idx, img ->
val uid = img.attr("uid")
Page(idx, imageUrl = "$cdnUrl/x/$uid")
}
}
private fun fallbackCdnInterceptor(chain: Interceptor.Chain): Response {
val request = chain.request()
val url = request.url.toString()
val response = chain.proceed(request)
return if (url.startsWith(cdnUrl) && !response.isSuccessful) {
response.close()
val newRequest = request.newBuilder()
.url(
url.replace("/x/", "/v/"),
)
.build()
chain.proceed(newRequest)
} else {
response
Page(idx, imageUrl = "$cdnUrl/uploads/$uid")
}
}
}