Eros Scans: update domain, skip redirect on CDN (#6887)
This commit is contained in:
parent
059e3267af
commit
dcb623cdb3
|
@ -2,8 +2,8 @@ ext {
|
||||||
extName = 'Eros Scans'
|
extName = 'Eros Scans'
|
||||||
extClass = '.ErosScans'
|
extClass = '.ErosScans'
|
||||||
themePkg = 'mangathemesia'
|
themePkg = 'mangathemesia'
|
||||||
baseUrl = 'https://tercoscans.xyz'
|
baseUrl = 'https://eros-toons.xyz'
|
||||||
overrideVersionCode = 1
|
overrideVersionCode = 2
|
||||||
isNsfw = false
|
isNsfw = false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,13 +2,33 @@ package eu.kanade.tachiyomi.extension.en.erosscans
|
||||||
|
|
||||||
import eu.kanade.tachiyomi.multisrc.mangathemesia.MangaThemesia
|
import eu.kanade.tachiyomi.multisrc.mangathemesia.MangaThemesia
|
||||||
import eu.kanade.tachiyomi.network.interceptor.rateLimit
|
import eu.kanade.tachiyomi.network.interceptor.rateLimit
|
||||||
|
import okhttp3.HttpUrl.Companion.toHttpUrl
|
||||||
|
import okhttp3.Interceptor
|
||||||
|
import okhttp3.Response
|
||||||
|
|
||||||
class ErosScans : MangaThemesia(
|
class ErosScans : MangaThemesia(
|
||||||
"Eros Scans",
|
"Eros Scans",
|
||||||
"https://tercoscans.xyz",
|
"https://eros-toons.xyz",
|
||||||
"en",
|
"en",
|
||||||
) {
|
) {
|
||||||
override val client = super.client.newBuilder()
|
override val client = super.client.newBuilder()
|
||||||
|
.addInterceptor(::cdnRedirectInterceptor)
|
||||||
.rateLimit(3)
|
.rateLimit(3)
|
||||||
.build()
|
.build()
|
||||||
|
|
||||||
|
private fun cdnRedirectInterceptor(chain: Interceptor.Chain): Response {
|
||||||
|
val request = chain.request()
|
||||||
|
if (request.url.host != "erosscans.xyz") {
|
||||||
|
return chain.proceed(request)
|
||||||
|
}
|
||||||
|
|
||||||
|
val newUrl = request.url.newBuilder()
|
||||||
|
.host(baseUrl.toHttpUrl().host)
|
||||||
|
.build()
|
||||||
|
val newRequest = request.newBuilder()
|
||||||
|
.url(newUrl)
|
||||||
|
.build()
|
||||||
|
|
||||||
|
return chain.proceed(newRequest)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue