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 Draff
parent 0af3536837
commit a8d36f9eca
No known key found for this signature in database
GPG Key ID: E8A89F3211677653
2 changed files with 3 additions and 23 deletions

View File

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

View File

@ -15,13 +15,12 @@ class MagusManga : Keyoapp(
"https://magustoon.com", "https://magustoon.com",
"en", "en",
) { ) {
private val cdnUrl = "https://cdn.magustoon.com" private val cdnUrl = "https://cdn.igniscans.com"
override val versionId = 2 override val versionId = 2
override val client = network.cloudflareClient.newBuilder() override val client = network.cloudflareClient.newBuilder()
.addInterceptor(::captchaInterceptor) .addInterceptor(::captchaInterceptor)
.addInterceptor(::fallbackCdnInterceptor)
.rateLimitHost(baseUrl.toHttpUrl(), 1) .rateLimitHost(baseUrl.toHttpUrl(), 1)
.rateLimitHost(cdnUrl.toHttpUrl(), 1) .rateLimitHost(cdnUrl.toHttpUrl(), 1)
.build() .build()
@ -53,26 +52,7 @@ class MagusManga : Keyoapp(
return document.select("#pages > img").mapIndexed { idx, img -> return document.select("#pages > img").mapIndexed { idx, img ->
val uid = img.attr("uid") val uid = img.attr("uid")
Page(idx, imageUrl = "$cdnUrl/x/$uid") Page(idx, imageUrl = "$cdnUrl/uploads/$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
} }
} }
} }