mirror of
https://github.com/keiyoushi/extensions-source.git
synced 2024-11-22 02:12:42 +01:00
MagusManga: Update image URL (#4949)
* Bump versionCode * MagusManga: Update cdnUrl * MagusManga: Remove fallbackCdnInterceptor
This commit is contained in:
parent
509a375d7e
commit
3062e6ff34
@ -3,7 +3,7 @@ ext {
|
||||
extClass = '.MagusManga'
|
||||
themePkg = 'keyoapp'
|
||||
baseUrl = 'https://magustoon.com'
|
||||
overrideVersionCode = 34
|
||||
overrideVersionCode = 35
|
||||
}
|
||||
|
||||
apply from: "$rootDir/common.gradle"
|
||||
|
@ -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")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user