[Mangadex] Exclude thumbnail downloads from rate limiting (#5542)
* Exclude thumbnails from mangadex rate limiting * Remove development code * Bump mangadex extVersionCode
This commit is contained in:
parent
04db6981aa
commit
0293fbc547
|
@ -5,7 +5,7 @@ ext {
|
||||||
extName = 'MangaDex'
|
extName = 'MangaDex'
|
||||||
pkgNameSuffix = 'all.mangadex'
|
pkgNameSuffix = 'all.mangadex'
|
||||||
extClass = '.MangaDexFactory'
|
extClass = '.MangaDexFactory'
|
||||||
extVersionCode = 102
|
extVersionCode = 103
|
||||||
libVersion = '1.2'
|
libVersion = '1.2'
|
||||||
containsNsfw = true
|
containsNsfw = true
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,7 +71,7 @@ abstract class MangaDex(
|
||||||
MangadexDescription(internalLang)
|
MangadexDescription(internalLang)
|
||||||
}
|
}
|
||||||
|
|
||||||
private val rateLimitInterceptor = RateLimitInterceptor(1)
|
private val rateLimitInterceptor = MdRateLimitInterceptor()
|
||||||
|
|
||||||
override val client: OkHttpClient = network.client.newBuilder()
|
override val client: OkHttpClient = network.client.newBuilder()
|
||||||
.addNetworkInterceptor(rateLimitInterceptor)
|
.addNetworkInterceptor(rateLimitInterceptor)
|
||||||
|
@ -1082,6 +1082,17 @@ class CoverInterceptor : Interceptor {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class MdRateLimitInterceptor : Interceptor {
|
||||||
|
private val coverRegex = Regex("""/images/.*\.jpg""")
|
||||||
|
private val baseInterceptor = RateLimitInterceptor(1)
|
||||||
|
|
||||||
|
override fun intercept(chain: Interceptor.Chain): Response =
|
||||||
|
if (chain.request().url().toString().contains(coverRegex))
|
||||||
|
chain.proceed(chain.request())
|
||||||
|
else
|
||||||
|
baseInterceptor.intercept(chain)
|
||||||
|
}
|
||||||
|
|
||||||
class MdAtHomeReportInterceptor(
|
class MdAtHomeReportInterceptor(
|
||||||
private val client: OkHttpClient,
|
private val client: OkHttpClient,
|
||||||
private val headers: Headers
|
private val headers: Headers
|
||||||
|
|
Loading…
Reference in New Issue