NHentai: add rate limiting
This commit is contained in:
parent
eb5185c4e2
commit
5087fdbf61
|
@ -5,8 +5,12 @@ ext {
|
||||||
appName = 'Tachiyomi: NHentai'
|
appName = 'Tachiyomi: NHentai'
|
||||||
pkgNameSuffix = 'all.nhentai'
|
pkgNameSuffix = 'all.nhentai'
|
||||||
extClass = '.NHFactory'
|
extClass = '.NHFactory'
|
||||||
extVersionCode = 22
|
extVersionCode = 23
|
||||||
libVersion = '1.2'
|
libVersion = '1.2'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
implementation project(':lib-ratelimit')
|
||||||
|
}
|
||||||
|
|
||||||
apply from: "$rootDir/common.gradle"
|
apply from: "$rootDir/common.gradle"
|
||||||
|
|
|
@ -10,6 +10,7 @@ import eu.kanade.tachiyomi.extension.all.nhentai.NHUtils.getNumPages
|
||||||
import eu.kanade.tachiyomi.extension.all.nhentai.NHUtils.getTagDescription
|
import eu.kanade.tachiyomi.extension.all.nhentai.NHUtils.getTagDescription
|
||||||
import eu.kanade.tachiyomi.extension.all.nhentai.NHUtils.getTags
|
import eu.kanade.tachiyomi.extension.all.nhentai.NHUtils.getTags
|
||||||
import eu.kanade.tachiyomi.extension.all.nhentai.NHUtils.getTime
|
import eu.kanade.tachiyomi.extension.all.nhentai.NHUtils.getTime
|
||||||
|
import eu.kanade.tachiyomi.lib.ratelimit.RateLimitInterceptor
|
||||||
import eu.kanade.tachiyomi.network.GET
|
import eu.kanade.tachiyomi.network.GET
|
||||||
import eu.kanade.tachiyomi.network.asObservableSuccess
|
import eu.kanade.tachiyomi.network.asObservableSuccess
|
||||||
import eu.kanade.tachiyomi.source.ConfigurableSource
|
import eu.kanade.tachiyomi.source.ConfigurableSource
|
||||||
|
@ -42,7 +43,10 @@ open class NHentai(
|
||||||
|
|
||||||
override val supportsLatest = true
|
override val supportsLatest = true
|
||||||
|
|
||||||
override val client: OkHttpClient = network.cloudflareClient
|
private val rateLimitInterceptor = RateLimitInterceptor(4)
|
||||||
|
override val client: OkHttpClient = network.cloudflareClient.newBuilder()
|
||||||
|
.addNetworkInterceptor(rateLimitInterceptor)
|
||||||
|
.build()
|
||||||
|
|
||||||
private val preferences: SharedPreferences by lazy {
|
private val preferences: SharedPreferences by lazy {
|
||||||
Injekt.get<Application>().getSharedPreferences("source_$id", 0x0000)
|
Injekt.get<Application>().getSharedPreferences("source_$id", 0x0000)
|
||||||
|
|
Loading…
Reference in New Issue