diff --git a/src/all/comickfun/build.gradle b/src/all/comickfun/build.gradle index 2cab48f3a..db35eee99 100644 --- a/src/all/comickfun/build.gradle +++ b/src/all/comickfun/build.gradle @@ -6,12 +6,8 @@ ext { extName = 'Comick.fun' pkgNameSuffix = 'all.comickfun' extClass = '.ComickFunFactory' - extVersionCode = 9 + extVersionCode = 10 isNsfw = true } -dependencies { - implementation project(':lib-ratelimit') -} - apply from: "$rootDir/common.gradle" diff --git a/src/all/comickfun/src/eu/kanade/tachiyomi/extension/all/comickfun/ComickFun.kt b/src/all/comickfun/src/eu/kanade/tachiyomi/extension/all/comickfun/ComickFun.kt index 3f6aabe60..4fb4b6d43 100644 --- a/src/all/comickfun/src/eu/kanade/tachiyomi/extension/all/comickfun/ComickFun.kt +++ b/src/all/comickfun/src/eu/kanade/tachiyomi/extension/all/comickfun/ComickFun.kt @@ -1,8 +1,8 @@ package eu.kanade.tachiyomi.extension.all.comickfun -import eu.kanade.tachiyomi.lib.ratelimit.SpecificHostRateLimitInterceptor import eu.kanade.tachiyomi.network.GET import eu.kanade.tachiyomi.network.asObservableSuccess +import eu.kanade.tachiyomi.network.interceptor.rateLimitHost import eu.kanade.tachiyomi.source.model.Filter import eu.kanade.tachiyomi.source.model.FilterList import eu.kanade.tachiyomi.source.model.MangasPage @@ -79,7 +79,7 @@ abstract class ComickFun(override val lang: String, private val comickFunLang: S } ) // Add interceptor to ratelimit api calls - builder.addNetworkInterceptor(SpecificHostRateLimitInterceptor(apiBase.toHttpUrl(), 2)) + builder.rateLimitHost(apiBase.toHttpUrl(), 2) this.client = builder.build() } diff --git a/src/all/mangaplus/build.gradle b/src/all/mangaplus/build.gradle index 900eeff5d..2552539cf 100644 --- a/src/all/mangaplus/build.gradle +++ b/src/all/mangaplus/build.gradle @@ -6,11 +6,7 @@ ext { extName = 'MANGA Plus by SHUEISHA' pkgNameSuffix = 'all.mangaplus' extClass = '.MangaPlusFactory' - extVersionCode = 31 -} - -dependencies { - implementation project(':lib-ratelimit') + extVersionCode = 32 } apply from: "$rootDir/common.gradle" diff --git a/src/all/mangaplus/src/eu/kanade/tachiyomi/extension/all/mangaplus/MangaPlus.kt b/src/all/mangaplus/src/eu/kanade/tachiyomi/extension/all/mangaplus/MangaPlus.kt index 837448031..22a5d5691 100644 --- a/src/all/mangaplus/src/eu/kanade/tachiyomi/extension/all/mangaplus/MangaPlus.kt +++ b/src/all/mangaplus/src/eu/kanade/tachiyomi/extension/all/mangaplus/MangaPlus.kt @@ -5,9 +5,9 @@ import android.content.SharedPreferences import androidx.preference.ListPreference import androidx.preference.PreferenceScreen import androidx.preference.SwitchPreferenceCompat -import eu.kanade.tachiyomi.lib.ratelimit.SpecificHostRateLimitInterceptor import eu.kanade.tachiyomi.network.GET import eu.kanade.tachiyomi.network.asObservableSuccess +import eu.kanade.tachiyomi.network.interceptor.rateLimitHost import eu.kanade.tachiyomi.source.ConfigurableSource import eu.kanade.tachiyomi.source.model.FilterList import eu.kanade.tachiyomi.source.model.MangasPage @@ -53,8 +53,8 @@ abstract class MangaPlus( override val client: OkHttpClient = network.client.newBuilder() .addInterceptor(::imageIntercept) .addInterceptor(::thumbnailIntercept) - .addInterceptor(SpecificHostRateLimitInterceptor(API_URL.toHttpUrl(), 1)) - .addInterceptor(SpecificHostRateLimitInterceptor(baseUrl.toHttpUrl(), 2)) + .rateLimitHost(API_URL.toHttpUrl(), 1) + .rateLimitHost(baseUrl.toHttpUrl(), 2) .build() private val json: Json by injectLazy() diff --git a/src/all/mangatoon/build.gradle b/src/all/mangatoon/build.gradle index 72ddc8ff6..c855ece11 100644 --- a/src/all/mangatoon/build.gradle +++ b/src/all/mangatoon/build.gradle @@ -5,11 +5,7 @@ ext { extName = 'MangaToon (Limited)' pkgNameSuffix = 'all.mangatoon' extClass = '.MangaToonFactory' - extVersionCode = 3 -} - -dependencies { - implementation project(':lib-ratelimit') + extVersionCode = 4 } apply from: "$rootDir/common.gradle" diff --git a/src/all/mangatoon/src/eu/kanade/tachiyomi/extension/all/mangatoon/MangaToon.kt b/src/all/mangatoon/src/eu/kanade/tachiyomi/extension/all/mangatoon/MangaToon.kt index 873c0f852..0c915c602 100644 --- a/src/all/mangatoon/src/eu/kanade/tachiyomi/extension/all/mangatoon/MangaToon.kt +++ b/src/all/mangatoon/src/eu/kanade/tachiyomi/extension/all/mangatoon/MangaToon.kt @@ -1,7 +1,7 @@ package eu.kanade.tachiyomi.extension.all.mangatoon -import eu.kanade.tachiyomi.lib.ratelimit.RateLimitInterceptor import eu.kanade.tachiyomi.network.GET +import eu.kanade.tachiyomi.network.interceptor.rateLimit import eu.kanade.tachiyomi.source.model.FilterList import eu.kanade.tachiyomi.source.model.Page import eu.kanade.tachiyomi.source.model.SChapter @@ -34,7 +34,7 @@ open class MangaToon( override val supportsLatest = true override val client: OkHttpClient = network.client.newBuilder() - .addInterceptor(RateLimitInterceptor(1, 1, TimeUnit.SECONDS)) + .rateLimit(1, 1, TimeUnit.SECONDS) .build() private val locale by lazy { Locale.forLanguageTag(lang) } diff --git a/src/all/nhentai/build.gradle b/src/all/nhentai/build.gradle index c354397ff..2ac9bcc94 100644 --- a/src/all/nhentai/build.gradle +++ b/src/all/nhentai/build.gradle @@ -5,12 +5,8 @@ ext { extName = 'NHentai' pkgNameSuffix = 'all.nhentai' extClass = '.NHFactory' - extVersionCode = 32 + extVersionCode = 33 isNsfw = true } -dependencies { - implementation project(':lib-ratelimit') -} - apply from: "$rootDir/common.gradle" diff --git a/src/all/nhentai/src/eu/kanade/tachiyomi/extension/all/nhentai/NHentai.kt b/src/all/nhentai/src/eu/kanade/tachiyomi/extension/all/nhentai/NHentai.kt index c0dff84e3..520dfe192 100644 --- a/src/all/nhentai/src/eu/kanade/tachiyomi/extension/all/nhentai/NHentai.kt +++ b/src/all/nhentai/src/eu/kanade/tachiyomi/extension/all/nhentai/NHentai.kt @@ -8,9 +8,9 @@ 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.getTags 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.asObservableSuccess +import eu.kanade.tachiyomi.network.interceptor.rateLimit import eu.kanade.tachiyomi.source.ConfigurableSource import eu.kanade.tachiyomi.source.model.Filter import eu.kanade.tachiyomi.source.model.FilterList @@ -43,9 +43,8 @@ open class NHentai( override val supportsLatest = true - private val rateLimitInterceptor = RateLimitInterceptor(4) override val client: OkHttpClient = network.cloudflareClient.newBuilder() - .addNetworkInterceptor(rateLimitInterceptor) + .rateLimit(4) .build() private val preferences: SharedPreferences by lazy { diff --git a/src/all/noisemanga/build.gradle b/src/all/noisemanga/build.gradle index add8374cf..a804f12c2 100644 --- a/src/all/noisemanga/build.gradle +++ b/src/all/noisemanga/build.gradle @@ -5,11 +5,7 @@ ext { extName = 'NOISE Manga' pkgNameSuffix = 'all.noisemanga' extClass = '.NoiseMangaFactory' - extVersionCode = 4 -} - -dependencies { - implementation project(':lib-ratelimit') + extVersionCode = 5 } apply from: "$rootDir/common.gradle" diff --git a/src/all/noisemanga/src/eu/kanade/tachiyomi/extension/all/noisemanga/NoiseManga.kt b/src/all/noisemanga/src/eu/kanade/tachiyomi/extension/all/noisemanga/NoiseManga.kt index 9a3e318a6..992f43e62 100644 --- a/src/all/noisemanga/src/eu/kanade/tachiyomi/extension/all/noisemanga/NoiseManga.kt +++ b/src/all/noisemanga/src/eu/kanade/tachiyomi/extension/all/noisemanga/NoiseManga.kt @@ -1,7 +1,7 @@ package eu.kanade.tachiyomi.extension.all.noisemanga -import eu.kanade.tachiyomi.lib.ratelimit.RateLimitInterceptor import eu.kanade.tachiyomi.network.GET +import eu.kanade.tachiyomi.network.interceptor.rateLimit import eu.kanade.tachiyomi.source.model.FilterList import eu.kanade.tachiyomi.source.model.MangasPage import eu.kanade.tachiyomi.source.model.Page @@ -26,7 +26,7 @@ abstract class NoiseManga(override val lang: String) : ParsedHttpSource() { override val supportsLatest = false override val client: OkHttpClient = network.client.newBuilder() - .addInterceptor(RateLimitInterceptor(1, 2, TimeUnit.SECONDS)) + .rateLimit(1, 2, TimeUnit.SECONDS) .build() override fun headersBuilder(): Headers.Builder = Headers.Builder() diff --git a/src/ar/gmanga/build.gradle b/src/ar/gmanga/build.gradle index 858fa6dc9..0654d201f 100644 --- a/src/ar/gmanga/build.gradle +++ b/src/ar/gmanga/build.gradle @@ -6,11 +6,7 @@ ext { extName = 'GMANGA' pkgNameSuffix = 'ar.gmanga' extClass = '.Gmanga' - extVersionCode = 10 -} - -dependencies { - implementation project(':lib-ratelimit') + extVersionCode = 11 } apply from: "$rootDir/common.gradle" diff --git a/src/ar/gmanga/src/eu/kanade/tachiyomi/extension/ar/gmanga/Gmanga.kt b/src/ar/gmanga/src/eu/kanade/tachiyomi/extension/ar/gmanga/Gmanga.kt index 0a1be66d9..1eea15f37 100644 --- a/src/ar/gmanga/src/eu/kanade/tachiyomi/extension/ar/gmanga/Gmanga.kt +++ b/src/ar/gmanga/src/eu/kanade/tachiyomi/extension/ar/gmanga/Gmanga.kt @@ -6,9 +6,9 @@ import eu.kanade.tachiyomi.extension.ar.gmanga.GmangaPreferences.Companion.PREF_ import eu.kanade.tachiyomi.extension.ar.gmanga.GmangaPreferences.Companion.PREF_CHAPTER_LISTING_SHOW_POPULAR import eu.kanade.tachiyomi.extension.ar.gmanga.dto.TableDto import eu.kanade.tachiyomi.extension.ar.gmanga.dto.asChapterList -import eu.kanade.tachiyomi.lib.ratelimit.RateLimitInterceptor import eu.kanade.tachiyomi.network.GET import eu.kanade.tachiyomi.network.POST +import eu.kanade.tachiyomi.network.interceptor.rateLimit import eu.kanade.tachiyomi.source.ConfigurableSource import eu.kanade.tachiyomi.source.model.FilterList import eu.kanade.tachiyomi.source.model.MangasPage @@ -49,10 +49,8 @@ class Gmanga : ConfigurableSource, HttpSource() { private val preferences = GmangaPreferences(id) - private val rateLimitInterceptor = RateLimitInterceptor(4) - override val client: OkHttpClient = network.client.newBuilder() - .addNetworkInterceptor(rateLimitInterceptor) + .rateLimit(4) .build() override fun headersBuilder() = Headers.Builder().apply { diff --git a/src/ar/mangaae/build.gradle b/src/ar/mangaae/build.gradle index 2c8bd5994..cc501ac85 100644 --- a/src/ar/mangaae/build.gradle +++ b/src/ar/mangaae/build.gradle @@ -5,11 +5,7 @@ ext { extName = 'Manga.ae' pkgNameSuffix = 'ar.mangaae' extClass = '.MangaAe' - extVersionCode = 8 -} - -dependencies { - implementation project(':lib-ratelimit') + extVersionCode = 9 } apply from: "$rootDir/common.gradle" diff --git a/src/ar/mangaae/src/eu/kanade/tachiyomi/extension/ar/mangaae/MangaAe.kt b/src/ar/mangaae/src/eu/kanade/tachiyomi/extension/ar/mangaae/MangaAe.kt index 554b91add..b9ada07af 100644 --- a/src/ar/mangaae/src/eu/kanade/tachiyomi/extension/ar/mangaae/MangaAe.kt +++ b/src/ar/mangaae/src/eu/kanade/tachiyomi/extension/ar/mangaae/MangaAe.kt @@ -1,7 +1,7 @@ package eu.kanade.tachiyomi.extension.ar.mangaae -import eu.kanade.tachiyomi.lib.ratelimit.RateLimitInterceptor import eu.kanade.tachiyomi.network.GET +import eu.kanade.tachiyomi.network.interceptor.rateLimit import eu.kanade.tachiyomi.source.model.Filter import eu.kanade.tachiyomi.source.model.FilterList import eu.kanade.tachiyomi.source.model.Page @@ -25,10 +25,8 @@ class MangaAe : ParsedHttpSource() { override val supportsLatest = true - private val rateLimitInterceptor = RateLimitInterceptor(2) - override val client: OkHttpClient = network.cloudflareClient.newBuilder() - .addNetworkInterceptor(rateLimitInterceptor) + .rateLimit(2) .build() override fun headersBuilder(): Headers.Builder = Headers.Builder() diff --git a/src/en/aurora/build.gradle b/src/en/aurora/build.gradle index 659d009af..5bca036b4 100644 --- a/src/en/aurora/build.gradle +++ b/src/en/aurora/build.gradle @@ -1,4 +1,4 @@ - apply plugin: 'com.android.application' +apply plugin: 'com.android.application' apply plugin: 'kotlin-android' ext { diff --git a/src/en/comicextra/build.gradle b/src/en/comicextra/build.gradle index c6b1e3798..ccedbad1a 100644 --- a/src/en/comicextra/build.gradle +++ b/src/en/comicextra/build.gradle @@ -1,4 +1,4 @@ - apply plugin: 'com.android.application' +apply plugin: 'com.android.application' apply plugin: 'kotlin-android' ext { diff --git a/src/en/dilbert/build.gradle b/src/en/dilbert/build.gradle index 3eb7a20a1..c1a1c6e1c 100644 --- a/src/en/dilbert/build.gradle +++ b/src/en/dilbert/build.gradle @@ -5,11 +5,7 @@ ext { extName = 'Dilbert' pkgNameSuffix = 'en.dilbert' extClass = '.Dilbert' - extVersionCode = 5 -} - -dependencies { - implementation project(':lib-ratelimit') + extVersionCode = 6 } apply from: "$rootDir/common.gradle" diff --git a/src/en/dilbert/src/eu/kanade/tachiyomi/extension/en/dilbert/Dilbert.kt b/src/en/dilbert/src/eu/kanade/tachiyomi/extension/en/dilbert/Dilbert.kt index 4d392a406..e8e1f5160 100644 --- a/src/en/dilbert/src/eu/kanade/tachiyomi/extension/en/dilbert/Dilbert.kt +++ b/src/en/dilbert/src/eu/kanade/tachiyomi/extension/en/dilbert/Dilbert.kt @@ -1,7 +1,7 @@ package eu.kanade.tachiyomi.extension.en.dilbert -import eu.kanade.tachiyomi.lib.ratelimit.RateLimitInterceptor import eu.kanade.tachiyomi.network.GET +import eu.kanade.tachiyomi.network.interceptor.rateLimit import eu.kanade.tachiyomi.source.model.FilterList import eu.kanade.tachiyomi.source.model.MangasPage import eu.kanade.tachiyomi.source.model.Page @@ -26,7 +26,8 @@ class Dilbert : ParsedHttpSource() { override val supportsLatest = false override val client = network.client.newBuilder() - .addNetworkInterceptor(RateLimitInterceptor(3)).build() + .rateLimit(3) + .build() override fun fetchPopularManga(page: Int) = (currentYear downTo 1989).map { SManga.create().apply { diff --git a/src/en/graphitecomics/build.gradle b/src/en/graphitecomics/build.gradle index c5fdfd009..218cb8c6a 100644 --- a/src/en/graphitecomics/build.gradle +++ b/src/en/graphitecomics/build.gradle @@ -6,11 +6,7 @@ ext { extName = 'Graphite Comics' pkgNameSuffix = 'en.graphitecomics' extClass = '.GraphiteComics' - extVersionCode = 1 -} - -dependencies { - implementation project(':lib-ratelimit') + extVersionCode = 2 } apply from: "$rootDir/common.gradle" diff --git a/src/en/graphitecomics/src/eu/kanade/tachiyomi/extension/en/graphitecomics/GraphiteComics.kt b/src/en/graphitecomics/src/eu/kanade/tachiyomi/extension/en/graphitecomics/GraphiteComics.kt index e9aa06d0c..2d949a083 100644 --- a/src/en/graphitecomics/src/eu/kanade/tachiyomi/extension/en/graphitecomics/GraphiteComics.kt +++ b/src/en/graphitecomics/src/eu/kanade/tachiyomi/extension/en/graphitecomics/GraphiteComics.kt @@ -1,9 +1,9 @@ package eu.kanade.tachiyomi.extension.en.graphitecomics -import eu.kanade.tachiyomi.lib.ratelimit.RateLimitInterceptor import eu.kanade.tachiyomi.network.GET import eu.kanade.tachiyomi.network.POST import eu.kanade.tachiyomi.network.asObservableSuccess +import eu.kanade.tachiyomi.network.interceptor.rateLimit import eu.kanade.tachiyomi.source.model.FilterList import eu.kanade.tachiyomi.source.model.MangasPage import eu.kanade.tachiyomi.source.model.Page @@ -41,7 +41,7 @@ class GraphiteComics : HttpSource() { override val supportsLatest = false override val client: OkHttpClient = network.cloudflareClient.newBuilder() - .addInterceptor(RateLimitInterceptor(2, 1, TimeUnit.SECONDS)) + .rateLimit(2, 1, TimeUnit.SECONDS) .build() private val json: Json by injectLazy() diff --git a/src/en/inkr/build.gradle b/src/en/inkr/build.gradle index 1787b4f27..2319c4ac1 100644 --- a/src/en/inkr/build.gradle +++ b/src/en/inkr/build.gradle @@ -6,13 +6,8 @@ ext { extName = 'INKR' pkgNameSuffix = 'en.inkr' extClass = '.Inkr' - extVersionCode = 3 + extVersionCode = 4 isNsfw = true } -dependencies { - implementation project(':lib-ratelimit') -} - apply from: "$rootDir/common.gradle" - diff --git a/src/en/inkr/src/eu/kanade/tachiyomi/extension/en/inkr/Inkr.kt b/src/en/inkr/src/eu/kanade/tachiyomi/extension/en/inkr/Inkr.kt index fcb4d5993..da581630f 100644 --- a/src/en/inkr/src/eu/kanade/tachiyomi/extension/en/inkr/Inkr.kt +++ b/src/en/inkr/src/eu/kanade/tachiyomi/extension/en/inkr/Inkr.kt @@ -1,9 +1,9 @@ package eu.kanade.tachiyomi.extension.en.inkr -import eu.kanade.tachiyomi.lib.ratelimit.RateLimitInterceptor import eu.kanade.tachiyomi.network.GET import eu.kanade.tachiyomi.network.POST import eu.kanade.tachiyomi.network.asObservableSuccess +import eu.kanade.tachiyomi.network.interceptor.rateLimit import eu.kanade.tachiyomi.source.model.FilterList import eu.kanade.tachiyomi.source.model.MangasPage import eu.kanade.tachiyomi.source.model.Page @@ -48,7 +48,7 @@ class Inkr : HttpSource() { override val client: OkHttpClient = network.cloudflareClient.newBuilder() .addInterceptor(::buildIdIntercept) - .addInterceptor(RateLimitInterceptor(2, 1, TimeUnit.SECONDS)) + .rateLimit(2, 1, TimeUnit.SECONDS) .build() private val json: Json by injectLazy() diff --git a/src/en/koushoku/build.gradle b/src/en/koushoku/build.gradle index a90eb9178..cbd70b4b3 100644 --- a/src/en/koushoku/build.gradle +++ b/src/en/koushoku/build.gradle @@ -5,12 +5,8 @@ ext { extName = 'Koushoku' pkgNameSuffix = 'en.koushoku' extClass = '.Koushoku' - extVersionCode = 2 + extVersionCode = 3 isNsfw = true } -dependencies { - implementation project(':lib-ratelimit') -} - apply from: "$rootDir/common.gradle" diff --git a/src/en/koushoku/src/eu/kanade/tachiyomi/extension/en/koushoku/Koushoku.kt b/src/en/koushoku/src/eu/kanade/tachiyomi/extension/en/koushoku/Koushoku.kt index 4e53f4cdd..44306dc86 100644 --- a/src/en/koushoku/src/eu/kanade/tachiyomi/extension/en/koushoku/Koushoku.kt +++ b/src/en/koushoku/src/eu/kanade/tachiyomi/extension/en/koushoku/Koushoku.kt @@ -1,8 +1,8 @@ package eu.kanade.tachiyomi.extension.en.koushoku -import eu.kanade.tachiyomi.lib.ratelimit.RateLimitInterceptor import eu.kanade.tachiyomi.network.GET import eu.kanade.tachiyomi.network.asObservableSuccess +import eu.kanade.tachiyomi.network.interceptor.rateLimit import eu.kanade.tachiyomi.source.model.Filter import eu.kanade.tachiyomi.source.model.FilterList import eu.kanade.tachiyomi.source.model.MangasPage @@ -34,9 +34,8 @@ class Koushoku : ParsedHttpSource() { override val lang = "en" override val supportsLatest = false - private val rateLimitInterceptor = RateLimitInterceptor(5) override val client: OkHttpClient = network.cloudflareClient.newBuilder() - .addNetworkInterceptor(rateLimitInterceptor) + .rateLimit(5) .build() override fun latestUpdatesRequest(page: Int) = GET("$baseUrl/?page=$page", headers) diff --git a/src/en/mangadig/build.gradle b/src/en/mangadig/build.gradle index 4e5bddc6a..6491caba8 100644 --- a/src/en/mangadig/build.gradle +++ b/src/en/mangadig/build.gradle @@ -5,12 +5,8 @@ ext { extName = 'MangaDig' pkgNameSuffix = 'en.mangadig' extClass = '.MangaDig' - extVersionCode = 2 + extVersionCode = 3 isNsfw = true } -dependencies { - implementation project(path: ':lib-ratelimit') -} - apply from: "$rootDir/common.gradle" diff --git a/src/en/mangadig/src/eu/kanade/tachiyomi/extension/en/mangadig/MangaDig.kt b/src/en/mangadig/src/eu/kanade/tachiyomi/extension/en/mangadig/MangaDig.kt index 160874ae8..f07be3863 100644 --- a/src/en/mangadig/src/eu/kanade/tachiyomi/extension/en/mangadig/MangaDig.kt +++ b/src/en/mangadig/src/eu/kanade/tachiyomi/extension/en/mangadig/MangaDig.kt @@ -5,8 +5,8 @@ import android.app.Application import android.content.SharedPreferences import android.net.Uri import android.util.Base64 -import eu.kanade.tachiyomi.lib.ratelimit.SpecificHostRateLimitInterceptor import eu.kanade.tachiyomi.network.GET +import eu.kanade.tachiyomi.network.interceptor.rateLimitHost import eu.kanade.tachiyomi.source.ConfigurableSource import eu.kanade.tachiyomi.source.model.Filter import eu.kanade.tachiyomi.source.model.FilterList @@ -38,13 +38,12 @@ class MangaDig : ConfigurableSource, ParsedHttpSource() { } // Client configs - private val mainSiteRateLimitInterceptor = SpecificHostRateLimitInterceptor( - baseUrl.toHttpUrlOrNull()!!, - preferences.getString(MAINSITE_RATEPERMITS_PREF, MAINSITE_RATEPERMITS_PREF_DEFAULT)!!.toInt(), - preferences.getString(MAINSITE_RATEPERIOD_PREF, MAINSITE_RATEPERIOD_PREF_DEFAULT)!!.toLong(), - ) override val client: OkHttpClient = network.cloudflareClient.newBuilder() - .addNetworkInterceptor(mainSiteRateLimitInterceptor) + .rateLimitHost( + baseUrl.toHttpUrlOrNull()!!, + preferences.getString(MAINSITE_RATEPERMITS_PREF, MAINSITE_RATEPERMITS_PREF_DEFAULT)!!.toInt(), + preferences.getString(MAINSITE_RATEPERIOD_PREF, MAINSITE_RATEPERIOD_PREF_DEFAULT)!!.toLong(), + ) .build() override fun headersBuilder(): Headers.Builder = Headers.Builder() .add("Referer", baseUrl) diff --git a/src/en/rainofsnow/build.gradle b/src/en/rainofsnow/build.gradle index a59bb6bc3..fcc4bea97 100644 --- a/src/en/rainofsnow/build.gradle +++ b/src/en/rainofsnow/build.gradle @@ -5,11 +5,7 @@ ext { extName = 'Rain Of Snow' pkgNameSuffix = 'en.rainofsnow' extClass = '.RainOfSnow' - extVersionCode = 7 -} - -dependencies { - implementation project(path: ':lib-ratelimit') + extVersionCode = 8 } apply from: "$rootDir/common.gradle" diff --git a/src/en/rainofsnow/src/eu/kanade/tachiyomi/extension/en/rainofsnow/RainOfSnow.kt b/src/en/rainofsnow/src/eu/kanade/tachiyomi/extension/en/rainofsnow/RainOfSnow.kt index 2ba65c985..bd536085f 100644 --- a/src/en/rainofsnow/src/eu/kanade/tachiyomi/extension/en/rainofsnow/RainOfSnow.kt +++ b/src/en/rainofsnow/src/eu/kanade/tachiyomi/extension/en/rainofsnow/RainOfSnow.kt @@ -1,7 +1,7 @@ package eu.kanade.tachiyomi.extension.en.rainofsnow -import eu.kanade.tachiyomi.lib.ratelimit.RateLimitInterceptor import eu.kanade.tachiyomi.network.GET +import eu.kanade.tachiyomi.network.interceptor.rateLimit import eu.kanade.tachiyomi.source.model.Filter import eu.kanade.tachiyomi.source.model.FilterList import eu.kanade.tachiyomi.source.model.Page @@ -29,12 +29,10 @@ open class RainOfSnow() : ParsedHttpSource() { override val supportsLatest = false - private val rateLimitInterceptor = RateLimitInterceptor(2) - override val client: OkHttpClient = network.cloudflareClient.newBuilder() .connectTimeout(10, TimeUnit.SECONDS) .readTimeout(30, TimeUnit.SECONDS) - .addNetworkInterceptor(rateLimitInterceptor) + .rateLimit(2) .build() override fun popularMangaRequest(page: Int): Request { diff --git a/src/en/reallifecomics/build.gradle b/src/en/reallifecomics/build.gradle index 795a1e0ae..a26ad5f77 100644 --- a/src/en/reallifecomics/build.gradle +++ b/src/en/reallifecomics/build.gradle @@ -1,4 +1,4 @@ - apply plugin: 'com.android.application' +apply plugin: 'com.android.application' apply plugin: 'kotlin-android' ext { @@ -8,8 +8,4 @@ ext { extVersionCode = 2 } -dependencies { - // implementation project(':lib-ratelimit') -} - apply from: "$rootDir/common.gradle" diff --git a/src/en/vizshonenjump/build.gradle b/src/en/vizshonenjump/build.gradle index bfa1c4ccf..ffebd1833 100644 --- a/src/en/vizshonenjump/build.gradle +++ b/src/en/vizshonenjump/build.gradle @@ -6,12 +6,11 @@ ext { extName = 'VIZ Shonen Jump' pkgNameSuffix = 'en.vizshonenjump' extClass = '.VizShonenJump' - extVersionCode = 11 + extVersionCode = 12 } dependencies { implementation 'com.drewnoakes:metadata-extractor:2.14.0' - implementation project(':lib-ratelimit') } apply from: "$rootDir/common.gradle" diff --git a/src/en/vizshonenjump/src/eu/kanade/tachiyomi/extension/en/vizshonenjump/VizShonenJump.kt b/src/en/vizshonenjump/src/eu/kanade/tachiyomi/extension/en/vizshonenjump/VizShonenJump.kt index 8f2953945..5abbe44d1 100644 --- a/src/en/vizshonenjump/src/eu/kanade/tachiyomi/extension/en/vizshonenjump/VizShonenJump.kt +++ b/src/en/vizshonenjump/src/eu/kanade/tachiyomi/extension/en/vizshonenjump/VizShonenJump.kt @@ -1,7 +1,7 @@ package eu.kanade.tachiyomi.extension.en.vizshonenjump -import eu.kanade.tachiyomi.lib.ratelimit.RateLimitInterceptor import eu.kanade.tachiyomi.network.GET +import eu.kanade.tachiyomi.network.interceptor.rateLimit import eu.kanade.tachiyomi.source.model.FilterList import eu.kanade.tachiyomi.source.model.MangasPage import eu.kanade.tachiyomi.source.model.Page @@ -46,7 +46,7 @@ class VizShonenJump : ParsedHttpSource() { .addInterceptor(::authCheckIntercept) .addInterceptor(::authChapterCheckIntercept) .addInterceptor(VizImageInterceptor()) - .addInterceptor(RateLimitInterceptor(1, 1, TimeUnit.SECONDS)) + .rateLimit(1, 1, TimeUnit.SECONDS) .build() override fun headersBuilder(): Headers.Builder = Headers.Builder() diff --git a/src/en/voyceme/build.gradle b/src/en/voyceme/build.gradle index 3435285c2..b75a7a480 100644 --- a/src/en/voyceme/build.gradle +++ b/src/en/voyceme/build.gradle @@ -6,11 +6,7 @@ ext { extName = 'Voyce.Me' pkgNameSuffix = 'en.voyceme' extClass = '.VoyceMe' - extVersionCode = 1 -} - -dependencies { - implementation project(':lib-ratelimit') + extVersionCode = 2 } apply from: "$rootDir/common.gradle" diff --git a/src/en/voyceme/src/eu/kanade/tachiyomi/extension/en/voyceme/VoyceMe.kt b/src/en/voyceme/src/eu/kanade/tachiyomi/extension/en/voyceme/VoyceMe.kt index ffa8422fc..f02dda394 100644 --- a/src/en/voyceme/src/eu/kanade/tachiyomi/extension/en/voyceme/VoyceMe.kt +++ b/src/en/voyceme/src/eu/kanade/tachiyomi/extension/en/voyceme/VoyceMe.kt @@ -1,9 +1,9 @@ package eu.kanade.tachiyomi.extension.en.voyceme -import eu.kanade.tachiyomi.lib.ratelimit.RateLimitInterceptor import eu.kanade.tachiyomi.network.GET import eu.kanade.tachiyomi.network.POST import eu.kanade.tachiyomi.network.asObservableSuccess +import eu.kanade.tachiyomi.network.interceptor.rateLimit import eu.kanade.tachiyomi.source.model.FilterList import eu.kanade.tachiyomi.source.model.MangasPage import eu.kanade.tachiyomi.source.model.Page @@ -45,7 +45,7 @@ class VoyceMe : HttpSource() { override val supportsLatest = true override val client: OkHttpClient = network.cloudflareClient.newBuilder() - .addInterceptor(RateLimitInterceptor(2, 1, TimeUnit.SECONDS)) + .rateLimit(2, 1, TimeUnit.SECONDS) .build() private val json: Json by injectLazy() diff --git a/src/en/warforrayuba/build.gradle b/src/en/warforrayuba/build.gradle index e3df25371..58cdfe67c 100644 --- a/src/en/warforrayuba/build.gradle +++ b/src/en/warforrayuba/build.gradle @@ -6,11 +6,7 @@ ext { extName = 'War For Rayuba' pkgNameSuffix = 'en.warforrayuba' extClass = '.WarForRayuba' - extVersionCode = 1 -} - -dependencies { - implementation project(':lib-ratelimit') + extVersionCode = 2 } apply from: "$rootDir/common.gradle" diff --git a/src/en/warforrayuba/src/eu/kanade/tachiyomi/extension/en/warforrayuba/WarForRayuba.kt b/src/en/warforrayuba/src/eu/kanade/tachiyomi/extension/en/warforrayuba/WarForRayuba.kt index 236070013..d32e11e36 100644 --- a/src/en/warforrayuba/src/eu/kanade/tachiyomi/extension/en/warforrayuba/WarForRayuba.kt +++ b/src/en/warforrayuba/src/eu/kanade/tachiyomi/extension/en/warforrayuba/WarForRayuba.kt @@ -4,9 +4,9 @@ import android.os.Build import eu.kanade.tachiyomi.AppInfo import eu.kanade.tachiyomi.extension.en.warforrayuba.dto.PageDto import eu.kanade.tachiyomi.extension.en.warforrayuba.dto.RoundDto -import eu.kanade.tachiyomi.lib.ratelimit.RateLimitInterceptor import eu.kanade.tachiyomi.network.GET import eu.kanade.tachiyomi.network.asObservableSuccess +import eu.kanade.tachiyomi.network.interceptor.rateLimit import eu.kanade.tachiyomi.source.model.FilterList import eu.kanade.tachiyomi.source.model.MangasPage import eu.kanade.tachiyomi.source.model.Page @@ -32,7 +32,8 @@ class WarForRayuba : HttpSource() { override val supportsLatest = false override val client = network.cloudflareClient.newBuilder() - .addNetworkInterceptor(RateLimitInterceptor(4)).build() + .rateLimit(4) + .build() private val json = Json { isLenient = true diff --git a/src/en/zinchanmanga/build.gradle b/src/en/zinchanmanga/build.gradle index df1d7bbdd..735d6cf82 100644 --- a/src/en/zinchanmanga/build.gradle +++ b/src/en/zinchanmanga/build.gradle @@ -6,12 +6,8 @@ ext { extName = 'ZinChanManga' pkgNameSuffix = 'en.zinchanmanga' extClass = '.ZinChanManga' - extVersionCode = 4 + extVersionCode = 5 isNsfw = true } -dependencies { - implementation project(':lib-ratelimit') -} - apply from: "$rootDir/common.gradle" diff --git a/src/en/zinchanmanga/src/eu/kanade/tachiyomi/extension/en/zinchanmanga/ZinChanManga.kt b/src/en/zinchanmanga/src/eu/kanade/tachiyomi/extension/en/zinchanmanga/ZinChanManga.kt index b4a5f8957..b4860daec 100644 --- a/src/en/zinchanmanga/src/eu/kanade/tachiyomi/extension/en/zinchanmanga/ZinChanManga.kt +++ b/src/en/zinchanmanga/src/eu/kanade/tachiyomi/extension/en/zinchanmanga/ZinChanManga.kt @@ -1,8 +1,8 @@ package eu.kanade.tachiyomi.extension.en.zinchanmanga -import eu.kanade.tachiyomi.lib.ratelimit.RateLimitInterceptor import eu.kanade.tachiyomi.network.GET import eu.kanade.tachiyomi.network.asObservableSuccess +import eu.kanade.tachiyomi.network.interceptor.rateLimit import eu.kanade.tachiyomi.source.model.FilterList import eu.kanade.tachiyomi.source.model.MangasPage import eu.kanade.tachiyomi.source.model.Page @@ -28,7 +28,7 @@ class ZinChanManga : HttpSource() { private val apiClient by lazy { network.client.newBuilder() .sslSocketFactory(ZinChanCert.factory, ZinChanCert.manager) - .addInterceptor(RateLimitInterceptor(5, 50)) + .rateLimit(5, 50) .build() } diff --git a/src/es/lectormanga/build.gradle b/src/es/lectormanga/build.gradle index d3ea52af5..be2fa5d70 100755 --- a/src/es/lectormanga/build.gradle +++ b/src/es/lectormanga/build.gradle @@ -5,12 +5,8 @@ ext { extName = 'LectorManga' pkgNameSuffix = 'es.lectormanga' extClass = '.LectorManga' - extVersionCode = 23 + extVersionCode = 24 isNsfw = true } -dependencies { - implementation project(':lib-ratelimit') -} - apply from: "$rootDir/common.gradle" diff --git a/src/es/lectormanga/src/eu/kanade/tachiyomi/extension/es/lectormanga/LectorManga.kt b/src/es/lectormanga/src/eu/kanade/tachiyomi/extension/es/lectormanga/LectorManga.kt index 3151df742..61f768435 100755 --- a/src/es/lectormanga/src/eu/kanade/tachiyomi/extension/es/lectormanga/LectorManga.kt +++ b/src/es/lectormanga/src/eu/kanade/tachiyomi/extension/es/lectormanga/LectorManga.kt @@ -2,9 +2,9 @@ package eu.kanade.tachiyomi.extension.es.lectormanga import android.app.Application import android.content.SharedPreferences -import eu.kanade.tachiyomi.lib.ratelimit.SpecificHostRateLimitInterceptor import eu.kanade.tachiyomi.network.GET import eu.kanade.tachiyomi.network.asObservableSuccess +import eu.kanade.tachiyomi.network.interceptor.rateLimitHost import eu.kanade.tachiyomi.source.ConfigurableSource import eu.kanade.tachiyomi.source.model.Filter import eu.kanade.tachiyomi.source.model.FilterList @@ -52,37 +52,27 @@ class LectorManga : ConfigurableSource, ParsedHttpSource() { Injekt.get().getSharedPreferences("source_$id", 0x0000) } - private val webRateLimitInterceptor = SpecificHostRateLimitInterceptor( - baseUrl.toHttpUrlOrNull()!!, - preferences.getString(WEB_RATELIMIT_PREF, WEB_RATELIMIT_PREF_DEFAULT_VALUE)!!.toInt(), 60 - ) - - private val imageCDNRateLimitInterceptor = SpecificHostRateLimitInterceptor( - imageCDNUrls[0].toHttpUrlOrNull()!!, - preferences.getString(IMAGE_CDN_RATELIMIT_PREF, IMAGE_CDN_RATELIMIT_PREF_DEFAULT_VALUE)!!.toInt(), 60 - ) - - private val imageCDNRateLimitInterceptor1 = SpecificHostRateLimitInterceptor( - imageCDNUrls[1].toHttpUrlOrNull()!!, - preferences.getString(IMAGE_CDN_RATELIMIT_PREF, IMAGE_CDN_RATELIMIT_PREF_DEFAULT_VALUE)!!.toInt(), 60 - ) - - private val imageCDNRateLimitInterceptor2 = SpecificHostRateLimitInterceptor( - imageCDNUrls[2].toHttpUrlOrNull()!!, - preferences.getString(IMAGE_CDN_RATELIMIT_PREF, IMAGE_CDN_RATELIMIT_PREF_DEFAULT_VALUE)!!.toInt(), 60 - ) - - private val imageCDNRateLimitInterceptor3 = SpecificHostRateLimitInterceptor( - imageCDNUrls[3].toHttpUrlOrNull()!!, - preferences.getString(IMAGE_CDN_RATELIMIT_PREF, IMAGE_CDN_RATELIMIT_PREF_DEFAULT_VALUE)!!.toInt(), 60 - ) - override val client: OkHttpClient = network.client.newBuilder() - .addNetworkInterceptor(webRateLimitInterceptor) - .addNetworkInterceptor(imageCDNRateLimitInterceptor) - .addNetworkInterceptor(imageCDNRateLimitInterceptor1) - .addNetworkInterceptor(imageCDNRateLimitInterceptor2) - .addNetworkInterceptor(imageCDNRateLimitInterceptor3) + .rateLimitHost( + baseUrl.toHttpUrlOrNull()!!, + preferences.getString(WEB_RATELIMIT_PREF, WEB_RATELIMIT_PREF_DEFAULT_VALUE)!!.toInt(), 60 + ) + .rateLimitHost( + imageCDNUrls[0].toHttpUrlOrNull()!!, + preferences.getString(IMAGE_CDN_RATELIMIT_PREF, IMAGE_CDN_RATELIMIT_PREF_DEFAULT_VALUE)!!.toInt(), 60 + ) + .rateLimitHost( + imageCDNUrls[1].toHttpUrlOrNull()!!, + preferences.getString(IMAGE_CDN_RATELIMIT_PREF, IMAGE_CDN_RATELIMIT_PREF_DEFAULT_VALUE)!!.toInt(), 60 + ) + .rateLimitHost( + imageCDNUrls[2].toHttpUrlOrNull()!!, + preferences.getString(IMAGE_CDN_RATELIMIT_PREF, IMAGE_CDN_RATELIMIT_PREF_DEFAULT_VALUE)!!.toInt(), 60 + ) + .rateLimitHost( + imageCDNUrls[3].toHttpUrlOrNull()!!, + preferences.getString(IMAGE_CDN_RATELIMIT_PREF, IMAGE_CDN_RATELIMIT_PREF_DEFAULT_VALUE)!!.toInt(), 60 + ) .build() override fun popularMangaRequest(page: Int) = GET("$baseUrl/library?order_item=likes_count&order_dir=desc&type=&filter_by=title&page=$page", headers) diff --git a/src/es/tumangaonline/build.gradle b/src/es/tumangaonline/build.gradle index 969d5da3f..35de0d6c9 100644 --- a/src/es/tumangaonline/build.gradle +++ b/src/es/tumangaonline/build.gradle @@ -5,12 +5,8 @@ ext { extName = 'TuMangaOnline' pkgNameSuffix = 'es.tumangaonline' extClass = '.TuMangaOnline' - extVersionCode = 37 + extVersionCode = 38 isNsfw = true } -dependencies { - implementation project(':lib-ratelimit') -} - apply from: "$rootDir/common.gradle" diff --git a/src/es/tumangaonline/src/eu/kanade/tachiyomi/extension/es/tumangaonline/TuMangaOnline.kt b/src/es/tumangaonline/src/eu/kanade/tachiyomi/extension/es/tumangaonline/TuMangaOnline.kt index 663c51b53..3956c7915 100644 --- a/src/es/tumangaonline/src/eu/kanade/tachiyomi/extension/es/tumangaonline/TuMangaOnline.kt +++ b/src/es/tumangaonline/src/eu/kanade/tachiyomi/extension/es/tumangaonline/TuMangaOnline.kt @@ -2,9 +2,9 @@ package eu.kanade.tachiyomi.extension.es.tumangaonline import android.app.Application import android.content.SharedPreferences -import eu.kanade.tachiyomi.lib.ratelimit.SpecificHostRateLimitInterceptor import eu.kanade.tachiyomi.network.GET import eu.kanade.tachiyomi.network.asObservableSuccess +import eu.kanade.tachiyomi.network.interceptor.rateLimitHost import eu.kanade.tachiyomi.source.ConfigurableSource import eu.kanade.tachiyomi.source.model.Filter import eu.kanade.tachiyomi.source.model.FilterList @@ -52,21 +52,17 @@ class TuMangaOnline : ConfigurableSource, ParsedHttpSource() { Injekt.get().getSharedPreferences("source_$id", 0x0000) } - private val webRateLimitInterceptor = SpecificHostRateLimitInterceptor( - baseUrl.toHttpUrlOrNull()!!, - preferences.getString(WEB_RATELIMIT_PREF, WEB_RATELIMIT_PREF_DEFAULT_VALUE)!!.toInt(), - 60 - ) - - private val imageCDNRateLimitInterceptor = SpecificHostRateLimitInterceptor( - imageCDNUrl.toHttpUrlOrNull()!!, - preferences.getString(IMAGE_CDN_RATELIMIT_PREF, IMAGE_CDN_RATELIMIT_PREF_DEFAULT_VALUE)!!.toInt(), - 60 - ) - override val client: OkHttpClient = network.client.newBuilder() - .addNetworkInterceptor(webRateLimitInterceptor) - .addNetworkInterceptor(imageCDNRateLimitInterceptor) + .rateLimitHost( + baseUrl.toHttpUrlOrNull()!!, + preferences.getString(WEB_RATELIMIT_PREF, WEB_RATELIMIT_PREF_DEFAULT_VALUE)!!.toInt(), + 60 + ) + .rateLimitHost( + imageCDNUrl.toHttpUrlOrNull()!!, + preferences.getString(IMAGE_CDN_RATELIMIT_PREF, IMAGE_CDN_RATELIMIT_PREF_DEFAULT_VALUE)!!.toInt(), + 60 + ) .build() // Marks erotic content as false and excludes: Ecchi(6), GirlsLove(17), BoysLove(18) and Harem(19) genders diff --git a/src/fr/furyosquad/build.gradle b/src/fr/furyosquad/build.gradle index 9f66a59d0..12ac81a46 100644 --- a/src/fr/furyosquad/build.gradle +++ b/src/fr/furyosquad/build.gradle @@ -5,11 +5,7 @@ ext { extName = 'FuryoSquad' pkgNameSuffix = 'fr.furyosquad' extClass = '.FuryoSquad' - extVersionCode = 1 -} - -dependencies { - implementation project(':lib-ratelimit') + extVersionCode = 2 } apply from: "$rootDir/common.gradle" diff --git a/src/fr/furyosquad/src/eu/kanade/tachiyomi/extension/fr/furyosquad/FuryoSquad.kt b/src/fr/furyosquad/src/eu/kanade/tachiyomi/extension/fr/furyosquad/FuryoSquad.kt index 63a37bc7b..239a1e884 100644 --- a/src/fr/furyosquad/src/eu/kanade/tachiyomi/extension/fr/furyosquad/FuryoSquad.kt +++ b/src/fr/furyosquad/src/eu/kanade/tachiyomi/extension/fr/furyosquad/FuryoSquad.kt @@ -1,8 +1,8 @@ package eu.kanade.tachiyomi.extension.fr.furyosquad -import eu.kanade.tachiyomi.lib.ratelimit.RateLimitInterceptor import eu.kanade.tachiyomi.network.GET import eu.kanade.tachiyomi.network.asObservableSuccess +import eu.kanade.tachiyomi.network.interceptor.rateLimit import eu.kanade.tachiyomi.source.model.FilterList import eu.kanade.tachiyomi.source.model.MangasPage import eu.kanade.tachiyomi.source.model.Page @@ -31,12 +31,10 @@ class FuryoSquad : ParsedHttpSource() { override val supportsLatest = true - private val rateLimitInterceptor = RateLimitInterceptor(1) - override val client: OkHttpClient = network.cloudflareClient.newBuilder() .connectTimeout(10, TimeUnit.SECONDS) .readTimeout(30, TimeUnit.SECONDS) - .addNetworkInterceptor(rateLimitInterceptor) + .rateLimit(1) .build() // Popular diff --git a/src/fr/mangakawaii/build.gradle b/src/fr/mangakawaii/build.gradle index c66abd345..3a8ce4e3d 100644 --- a/src/fr/mangakawaii/build.gradle +++ b/src/fr/mangakawaii/build.gradle @@ -5,11 +5,7 @@ ext { extName = 'Mangakawaii' pkgNameSuffix = 'fr.mangakawaii' extClass = '.MangaKawaii' - extVersionCode = 34 -} - -dependencies { - implementation project(':lib-ratelimit') + extVersionCode = 35 } apply from: "$rootDir/common.gradle" diff --git a/src/fr/mangakawaii/src/eu/kanade/tachiyomi/extension/fr/mangakawaii/MangaKawaii.kt b/src/fr/mangakawaii/src/eu/kanade/tachiyomi/extension/fr/mangakawaii/MangaKawaii.kt index a4b42f778..f2f64a03a 100644 --- a/src/fr/mangakawaii/src/eu/kanade/tachiyomi/extension/fr/mangakawaii/MangaKawaii.kt +++ b/src/fr/mangakawaii/src/eu/kanade/tachiyomi/extension/fr/mangakawaii/MangaKawaii.kt @@ -1,8 +1,8 @@ package eu.kanade.tachiyomi.extension.fr.mangakawaii import android.net.Uri -import eu.kanade.tachiyomi.lib.ratelimit.RateLimitInterceptor import eu.kanade.tachiyomi.network.GET +import eu.kanade.tachiyomi.network.interceptor.rateLimit import eu.kanade.tachiyomi.source.model.FilterList import eu.kanade.tachiyomi.source.model.Page import eu.kanade.tachiyomi.source.model.SChapter @@ -32,12 +32,11 @@ class MangaKawaii : ParsedHttpSource() { val cdnUrl = "https://cdn.mangakawaii.pics" override val lang = "fr" override val supportsLatest = true - private val rateLimitInterceptor = RateLimitInterceptor(1) // 1 request per second override val client: OkHttpClient = network.cloudflareClient.newBuilder() .connectTimeout(10, TimeUnit.SECONDS) .readTimeout(30, TimeUnit.SECONDS) - .addNetworkInterceptor(rateLimitInterceptor) + .rateLimit(1) .build() protected open val userAgentRandomizer1 = "${Random.nextInt(9).absoluteValue}" diff --git a/src/fr/scantrad/build.gradle b/src/fr/scantrad/build.gradle index afb968c7a..76cf77d61 100644 --- a/src/fr/scantrad/build.gradle +++ b/src/fr/scantrad/build.gradle @@ -5,11 +5,7 @@ ext { extName = 'Scantrad' pkgNameSuffix = 'fr.scantrad' extClass = '.Scantrad' - extVersionCode = 17 -} - -dependencies { - implementation project(':lib-ratelimit') + extVersionCode = 18 } apply from: "$rootDir/common.gradle" diff --git a/src/fr/scantrad/src/eu/kanade/tachiyomi/extension/fr/scantrad/Scantrad.kt b/src/fr/scantrad/src/eu/kanade/tachiyomi/extension/fr/scantrad/Scantrad.kt index 93080dc44..de06028a1 100644 --- a/src/fr/scantrad/src/eu/kanade/tachiyomi/extension/fr/scantrad/Scantrad.kt +++ b/src/fr/scantrad/src/eu/kanade/tachiyomi/extension/fr/scantrad/Scantrad.kt @@ -1,8 +1,8 @@ package eu.kanade.tachiyomi.extension.fr.scantrad -import eu.kanade.tachiyomi.lib.ratelimit.RateLimitInterceptor import eu.kanade.tachiyomi.network.GET import eu.kanade.tachiyomi.network.asObservableSuccess +import eu.kanade.tachiyomi.network.interceptor.rateLimit import eu.kanade.tachiyomi.source.model.FilterList import eu.kanade.tachiyomi.source.model.MangasPage import eu.kanade.tachiyomi.source.model.Page @@ -32,12 +32,10 @@ class Scantrad : ParsedHttpSource() { override val supportsLatest = true - private val rateLimitInterceptor = RateLimitInterceptor(1) - override val client: OkHttpClient = network.cloudflareClient.newBuilder() .connectTimeout(10, TimeUnit.SECONDS) .readTimeout(30, TimeUnit.SECONDS) - .addNetworkInterceptor(rateLimitInterceptor) + .rateLimit(1) .build() override fun headersBuilder(): Headers.Builder = Headers.Builder() diff --git a/src/ko/newtoki/build.gradle b/src/ko/newtoki/build.gradle index edaff9098..d3ca11203 100644 --- a/src/ko/newtoki/build.gradle +++ b/src/ko/newtoki/build.gradle @@ -5,11 +5,7 @@ ext { extName = 'NewToki / ManaToki' pkgNameSuffix = 'ko.newtoki' extClass = '.NewTokiFactory' - extVersionCode = 22 -} - -dependencies { - implementation project(':lib-ratelimit') + extVersionCode = 23 } apply from: "$rootDir/common.gradle" diff --git a/src/ko/newtoki/src/eu/kanade/tachiyomi/extension/ko/newtoki/NewToki.kt b/src/ko/newtoki/src/eu/kanade/tachiyomi/extension/ko/newtoki/NewToki.kt index 40c2ac858..0144468d9 100644 --- a/src/ko/newtoki/src/eu/kanade/tachiyomi/extension/ko/newtoki/NewToki.kt +++ b/src/ko/newtoki/src/eu/kanade/tachiyomi/extension/ko/newtoki/NewToki.kt @@ -4,10 +4,10 @@ import android.annotation.SuppressLint import android.app.Application import android.content.SharedPreferences import android.widget.Toast -import eu.kanade.tachiyomi.lib.ratelimit.RateLimitInterceptor import eu.kanade.tachiyomi.AppInfo import eu.kanade.tachiyomi.network.GET import eu.kanade.tachiyomi.network.asObservableSuccess +import eu.kanade.tachiyomi.network.interceptor.rateLimit import eu.kanade.tachiyomi.source.ConfigurableSource import eu.kanade.tachiyomi.source.model.FilterList import eu.kanade.tachiyomi.source.model.MangasPage @@ -40,7 +40,7 @@ open class NewToki(override val name: String, private val defaultBaseUrl: String override val client: OkHttpClient = network.cloudflareClient protected val rateLimitedClient: OkHttpClient by lazy { network.cloudflareClient.newBuilder() - .addNetworkInterceptor(RateLimitInterceptor(1, getRateLimitPeriod())) + .rateLimit(1, getRateLimitPeriod()) .build() } diff --git a/src/pt/argosscan/build.gradle b/src/pt/argosscan/build.gradle index d0ce7c42e..b64851d47 100644 --- a/src/pt/argosscan/build.gradle +++ b/src/pt/argosscan/build.gradle @@ -6,11 +6,7 @@ ext { extName = 'Argos Scan' pkgNameSuffix = 'pt.argosscan' extClass = '.ArgosScan' - extVersionCode = 20 -} - -dependencies { - implementation project(':lib-ratelimit') + extVersionCode = 21 } apply from: "$rootDir/common.gradle" diff --git a/src/pt/argosscan/src/eu/kanade/tachiyomi/extension/pt/argosscan/ArgosScan.kt b/src/pt/argosscan/src/eu/kanade/tachiyomi/extension/pt/argosscan/ArgosScan.kt index d72d0af77..12b2a4a9d 100644 --- a/src/pt/argosscan/src/eu/kanade/tachiyomi/extension/pt/argosscan/ArgosScan.kt +++ b/src/pt/argosscan/src/eu/kanade/tachiyomi/extension/pt/argosscan/ArgosScan.kt @@ -5,10 +5,10 @@ import android.content.SharedPreferences import android.text.InputType import androidx.preference.EditTextPreference import androidx.preference.PreferenceScreen -import eu.kanade.tachiyomi.lib.ratelimit.RateLimitInterceptor import eu.kanade.tachiyomi.network.GET import eu.kanade.tachiyomi.network.POST import eu.kanade.tachiyomi.network.asObservableSuccess +import eu.kanade.tachiyomi.network.interceptor.rateLimit import eu.kanade.tachiyomi.source.ConfigurableSource import eu.kanade.tachiyomi.source.model.FilterList import eu.kanade.tachiyomi.source.model.MangasPage @@ -54,7 +54,7 @@ class ArgosScan : HttpSource(), ConfigurableSource { override val client: OkHttpClient = network.cloudflareClient.newBuilder() .addInterceptor(::loginIntercept) - .addInterceptor(RateLimitInterceptor(1, 2, TimeUnit.SECONDS)) + .rateLimit(1, 2, TimeUnit.SECONDS) .build() private val json: Json by injectLazy() diff --git a/src/pt/bakai/build.gradle b/src/pt/bakai/build.gradle index ceddf4b9f..5817d0272 100644 --- a/src/pt/bakai/build.gradle +++ b/src/pt/bakai/build.gradle @@ -5,12 +5,8 @@ ext { extName = 'Bakai' pkgNameSuffix = 'pt.bakai' extClass = '.Bakai' - extVersionCode = 2 + extVersionCode = 3 isNsfw = true } -dependencies { - implementation project(':lib-ratelimit') -} - apply from: "$rootDir/common.gradle" diff --git a/src/pt/bakai/src/eu/kanade/tachiyomi/extension/pt/bakai/Bakai.kt b/src/pt/bakai/src/eu/kanade/tachiyomi/extension/pt/bakai/Bakai.kt index b5e2c9592..6302a26da 100644 --- a/src/pt/bakai/src/eu/kanade/tachiyomi/extension/pt/bakai/Bakai.kt +++ b/src/pt/bakai/src/eu/kanade/tachiyomi/extension/pt/bakai/Bakai.kt @@ -1,7 +1,7 @@ package eu.kanade.tachiyomi.extension.pt.bakai -import eu.kanade.tachiyomi.lib.ratelimit.SpecificHostRateLimitInterceptor import eu.kanade.tachiyomi.network.GET +import eu.kanade.tachiyomi.network.interceptor.rateLimitHost import eu.kanade.tachiyomi.source.model.FilterList import eu.kanade.tachiyomi.source.model.Page import eu.kanade.tachiyomi.source.model.SChapter @@ -27,8 +27,8 @@ class Bakai : ParsedHttpSource() { override val supportsLatest = true override val client: OkHttpClient = network.cloudflareClient.newBuilder() - .addInterceptor(SpecificHostRateLimitInterceptor(baseUrl.toHttpUrl(), 1, 2)) - .addInterceptor(SpecificHostRateLimitInterceptor(CDN_URL.toHttpUrl(), 1, 1)) + .rateLimitHost(baseUrl.toHttpUrl(), 1, 2) + .rateLimitHost(CDN_URL.toHttpUrl(), 1, 1) .build() override fun headersBuilder(): Headers.Builder = Headers.Builder() diff --git a/src/pt/brmangas/build.gradle b/src/pt/brmangas/build.gradle index f4f60f51e..8ad9c2a5e 100644 --- a/src/pt/brmangas/build.gradle +++ b/src/pt/brmangas/build.gradle @@ -5,12 +5,8 @@ ext { extName = 'BR Mangás' pkgNameSuffix = 'pt.brmangas' extClass = '.BrMangas' - extVersionCode = 3 + extVersionCode = 4 isNsfw = true } -dependencies { - implementation project(':lib-ratelimit') -} - apply from: "$rootDir/common.gradle" diff --git a/src/pt/brmangas/src/eu/kanade/tachiyomi/extension/pt/brmangas/BrMangas.kt b/src/pt/brmangas/src/eu/kanade/tachiyomi/extension/pt/brmangas/BrMangas.kt index c52dc9ab2..b84619bc9 100644 --- a/src/pt/brmangas/src/eu/kanade/tachiyomi/extension/pt/brmangas/BrMangas.kt +++ b/src/pt/brmangas/src/eu/kanade/tachiyomi/extension/pt/brmangas/BrMangas.kt @@ -1,7 +1,7 @@ package eu.kanade.tachiyomi.extension.pt.brmangas -import eu.kanade.tachiyomi.lib.ratelimit.RateLimitInterceptor import eu.kanade.tachiyomi.network.GET +import eu.kanade.tachiyomi.network.interceptor.rateLimit import eu.kanade.tachiyomi.source.model.FilterList import eu.kanade.tachiyomi.source.model.Page import eu.kanade.tachiyomi.source.model.SChapter @@ -27,7 +27,7 @@ class BrMangas : ParsedHttpSource() { override val supportsLatest = true override val client: OkHttpClient = network.cloudflareClient.newBuilder() - .addInterceptor(RateLimitInterceptor(1, 2, TimeUnit.SECONDS)) + .rateLimit(1, 2, TimeUnit.SECONDS) .build() override fun headersBuilder(): Headers.Builder = Headers.Builder() diff --git a/src/pt/bruttal/build.gradle b/src/pt/bruttal/build.gradle index 00652b3b1..2fee25975 100644 --- a/src/pt/bruttal/build.gradle +++ b/src/pt/bruttal/build.gradle @@ -6,11 +6,7 @@ ext { extName = 'Bruttal' pkgNameSuffix = 'pt.bruttal' extClass = '.Bruttal' - extVersionCode = 4 -} - -dependencies { - implementation project(':lib-ratelimit') + extVersionCode = 5 } apply from: "$rootDir/common.gradle" diff --git a/src/pt/bruttal/src/eu/kanade/tachiyomi/extension/pt/bruttal/Bruttal.kt b/src/pt/bruttal/src/eu/kanade/tachiyomi/extension/pt/bruttal/Bruttal.kt index f2d489719..159d7d710 100644 --- a/src/pt/bruttal/src/eu/kanade/tachiyomi/extension/pt/bruttal/Bruttal.kt +++ b/src/pt/bruttal/src/eu/kanade/tachiyomi/extension/pt/bruttal/Bruttal.kt @@ -1,8 +1,8 @@ package eu.kanade.tachiyomi.extension.pt.bruttal -import eu.kanade.tachiyomi.lib.ratelimit.RateLimitInterceptor import eu.kanade.tachiyomi.network.GET import eu.kanade.tachiyomi.network.asObservableSuccess +import eu.kanade.tachiyomi.network.interceptor.rateLimit import eu.kanade.tachiyomi.source.model.FilterList import eu.kanade.tachiyomi.source.model.MangasPage import eu.kanade.tachiyomi.source.model.Page @@ -30,7 +30,7 @@ class Bruttal : HttpSource() { override val supportsLatest = false override val client: OkHttpClient = network.client.newBuilder() - .addInterceptor(RateLimitInterceptor(1, 2, TimeUnit.SECONDS)) + .rateLimit(1, 2, TimeUnit.SECONDS) .build() override fun headersBuilder(): Headers.Builder = Headers.Builder() diff --git a/src/pt/goldenmangas/build.gradle b/src/pt/goldenmangas/build.gradle index 2a21fcf50..4261dfee0 100644 --- a/src/pt/goldenmangas/build.gradle +++ b/src/pt/goldenmangas/build.gradle @@ -5,12 +5,8 @@ ext { extName = 'Golden Mangás' pkgNameSuffix = 'pt.goldenmangas' extClass = '.GoldenMangas' - extVersionCode = 15 + extVersionCode = 16 isNsfw = true } -dependencies { - implementation project(':lib-ratelimit') -} - apply from: "$rootDir/common.gradle" diff --git a/src/pt/goldenmangas/src/eu/kanade/tachiyomi/extension/pt/goldenmangas/GoldenMangas.kt b/src/pt/goldenmangas/src/eu/kanade/tachiyomi/extension/pt/goldenmangas/GoldenMangas.kt index a7ade3470..362405285 100644 --- a/src/pt/goldenmangas/src/eu/kanade/tachiyomi/extension/pt/goldenmangas/GoldenMangas.kt +++ b/src/pt/goldenmangas/src/eu/kanade/tachiyomi/extension/pt/goldenmangas/GoldenMangas.kt @@ -1,7 +1,7 @@ package eu.kanade.tachiyomi.extension.pt.goldenmangas -import eu.kanade.tachiyomi.lib.ratelimit.RateLimitInterceptor import eu.kanade.tachiyomi.network.GET +import eu.kanade.tachiyomi.network.interceptor.rateLimit import eu.kanade.tachiyomi.source.model.FilterList import eu.kanade.tachiyomi.source.model.Page import eu.kanade.tachiyomi.source.model.SChapter @@ -34,7 +34,7 @@ class GoldenMangas : ParsedHttpSource() { .connectTimeout(1, TimeUnit.MINUTES) .readTimeout(1, TimeUnit.MINUTES) .writeTimeout(1, TimeUnit.MINUTES) - .addInterceptor(RateLimitInterceptor(1, 3, TimeUnit.SECONDS)) + .rateLimit(1, 3, TimeUnit.SECONDS) .build() override fun headersBuilder(): Headers.Builder = Headers.Builder() diff --git a/src/pt/hqnow/build.gradle b/src/pt/hqnow/build.gradle index fce3b2c08..4b87b16bb 100644 --- a/src/pt/hqnow/build.gradle +++ b/src/pt/hqnow/build.gradle @@ -6,11 +6,7 @@ ext { extName = 'HQ Now!' pkgNameSuffix = 'pt.hqnow' extClass = '.HQNow' - extVersionCode = 5 -} - -dependencies { - implementation project(':lib-ratelimit') + extVersionCode = 6 } apply from: "$rootDir/common.gradle" diff --git a/src/pt/hqnow/src/eu/kanade/tachiyomi/extension/pt/hqnow/HQNow.kt b/src/pt/hqnow/src/eu/kanade/tachiyomi/extension/pt/hqnow/HQNow.kt index d006fba40..3b77e3fdf 100644 --- a/src/pt/hqnow/src/eu/kanade/tachiyomi/extension/pt/hqnow/HQNow.kt +++ b/src/pt/hqnow/src/eu/kanade/tachiyomi/extension/pt/hqnow/HQNow.kt @@ -1,9 +1,9 @@ package eu.kanade.tachiyomi.extension.pt.hqnow -import eu.kanade.tachiyomi.lib.ratelimit.RateLimitInterceptor import eu.kanade.tachiyomi.network.GET import eu.kanade.tachiyomi.network.POST import eu.kanade.tachiyomi.network.asObservableSuccess +import eu.kanade.tachiyomi.network.interceptor.rateLimit import eu.kanade.tachiyomi.source.model.FilterList import eu.kanade.tachiyomi.source.model.MangasPage import eu.kanade.tachiyomi.source.model.Page @@ -39,7 +39,7 @@ class HQNow : HttpSource() { override val supportsLatest = true override val client: OkHttpClient = network.cloudflareClient.newBuilder() - .addInterceptor(RateLimitInterceptor(1, 2, TimeUnit.SECONDS)) + .rateLimit(1, 2, TimeUnit.SECONDS) .build() private val json: Json by injectLazy() diff --git a/src/pt/mangavibe/build.gradle b/src/pt/mangavibe/build.gradle index f3583a47b..ba098e6fa 100644 --- a/src/pt/mangavibe/build.gradle +++ b/src/pt/mangavibe/build.gradle @@ -6,12 +6,8 @@ ext { extName = 'MangaVibe' pkgNameSuffix = 'pt.mangavibe' extClass = '.MangaVibe' - extVersionCode = 1 + extVersionCode = 2 isNsfw = true } -dependencies { - implementation project(':lib-ratelimit') -} - apply from: "$rootDir/common.gradle" diff --git a/src/pt/mangavibe/src/eu/kanade/tachiyomi/extension/pt/mangavibe/MangaVibe.kt b/src/pt/mangavibe/src/eu/kanade/tachiyomi/extension/pt/mangavibe/MangaVibe.kt index 73ad0515f..f4d56a97e 100644 --- a/src/pt/mangavibe/src/eu/kanade/tachiyomi/extension/pt/mangavibe/MangaVibe.kt +++ b/src/pt/mangavibe/src/eu/kanade/tachiyomi/extension/pt/mangavibe/MangaVibe.kt @@ -1,8 +1,8 @@ package eu.kanade.tachiyomi.extension.pt.mangavibe -import eu.kanade.tachiyomi.lib.ratelimit.RateLimitInterceptor import eu.kanade.tachiyomi.network.GET import eu.kanade.tachiyomi.network.asObservableSuccess +import eu.kanade.tachiyomi.network.interceptor.rateLimit import eu.kanade.tachiyomi.source.model.FilterList import eu.kanade.tachiyomi.source.model.MangasPage import eu.kanade.tachiyomi.source.model.Page @@ -39,7 +39,7 @@ class MangaVibe : HttpSource() { override val supportsLatest = true override val client: OkHttpClient = network.cloudflareClient.newBuilder() - .addInterceptor(RateLimitInterceptor(1, 2, TimeUnit.SECONDS)) + .rateLimit(1, 2, TimeUnit.SECONDS) .addInterceptor(::directoryCacheIntercept) .build() diff --git a/src/pt/muitohentai/build.gradle b/src/pt/muitohentai/build.gradle index a1a9d283d..b3e11995b 100644 --- a/src/pt/muitohentai/build.gradle +++ b/src/pt/muitohentai/build.gradle @@ -6,13 +6,8 @@ ext { extName = 'Muito Hentai' pkgNameSuffix = 'pt.muitohentai' extClass = '.MuitoHentai' - extVersionCode = 1 + extVersionCode = 2 isNsfw = true } -dependencies { - implementation project(':lib-ratelimit') -} - apply from: "$rootDir/common.gradle" - diff --git a/src/pt/muitohentai/src/eu/kanade/tachiyomi/extension/pt/muitohentai/MuitoHentai.kt b/src/pt/muitohentai/src/eu/kanade/tachiyomi/extension/pt/muitohentai/MuitoHentai.kt index ac135e26a..831dc694d 100644 --- a/src/pt/muitohentai/src/eu/kanade/tachiyomi/extension/pt/muitohentai/MuitoHentai.kt +++ b/src/pt/muitohentai/src/eu/kanade/tachiyomi/extension/pt/muitohentai/MuitoHentai.kt @@ -1,7 +1,7 @@ package eu.kanade.tachiyomi.extension.pt.muitohentai -import eu.kanade.tachiyomi.lib.ratelimit.RateLimitInterceptor import eu.kanade.tachiyomi.network.GET +import eu.kanade.tachiyomi.network.interceptor.rateLimit import eu.kanade.tachiyomi.source.model.FilterList import eu.kanade.tachiyomi.source.model.Page import eu.kanade.tachiyomi.source.model.SChapter @@ -32,7 +32,7 @@ class MuitoHentai : ParsedHttpSource() { override val supportsLatest = true override val client: OkHttpClient = network.cloudflareClient.newBuilder() - .addInterceptor(RateLimitInterceptor(1, 2, TimeUnit.SECONDS)) + .rateLimit(1, 2, TimeUnit.SECONDS) .build() private val json: Json by injectLazy() diff --git a/src/pt/muitomanga/build.gradle b/src/pt/muitomanga/build.gradle index e61641ef9..820ec3014 100644 --- a/src/pt/muitomanga/build.gradle +++ b/src/pt/muitomanga/build.gradle @@ -6,12 +6,8 @@ ext { extName = 'Muito Mangá' pkgNameSuffix = 'pt.muitomanga' extClass = '.MuitoManga' - extVersionCode = 5 + extVersionCode = 6 isNsfw = true } -dependencies { - implementation project(':lib-ratelimit') -} - apply from: "$rootDir/common.gradle" diff --git a/src/pt/muitomanga/src/eu/kanade/tachiyomi/extension/pt/muitomanga/MuitoManga.kt b/src/pt/muitomanga/src/eu/kanade/tachiyomi/extension/pt/muitomanga/MuitoManga.kt index 0213757d4..bb0923f14 100644 --- a/src/pt/muitomanga/src/eu/kanade/tachiyomi/extension/pt/muitomanga/MuitoManga.kt +++ b/src/pt/muitomanga/src/eu/kanade/tachiyomi/extension/pt/muitomanga/MuitoManga.kt @@ -1,7 +1,7 @@ package eu.kanade.tachiyomi.extension.pt.muitomanga -import eu.kanade.tachiyomi.lib.ratelimit.RateLimitInterceptor import eu.kanade.tachiyomi.network.GET +import eu.kanade.tachiyomi.network.interceptor.rateLimit import eu.kanade.tachiyomi.source.model.FilterList import eu.kanade.tachiyomi.source.model.MangasPage import eu.kanade.tachiyomi.source.model.Page @@ -38,7 +38,7 @@ class MuitoManga : ParsedHttpSource() { override val supportsLatest = true override val client: OkHttpClient = network.cloudflareClient.newBuilder() - .addInterceptor(RateLimitInterceptor(1, 2, TimeUnit.SECONDS)) + .rateLimit(1, 2, TimeUnit.SECONDS) .addInterceptor(::directoryCacheIntercept) .build() diff --git a/src/pt/mundohentai/build.gradle b/src/pt/mundohentai/build.gradle index d946e94f5..66cf37729 100644 --- a/src/pt/mundohentai/build.gradle +++ b/src/pt/mundohentai/build.gradle @@ -5,13 +5,8 @@ ext { extName = 'Mundo Hentai' pkgNameSuffix = 'pt.mundohentai' extClass = '.MundoHentai' - extVersionCode = 3 + extVersionCode = 4 isNsfw = true } -dependencies { - implementation project(':lib-ratelimit') -} - apply from: "$rootDir/common.gradle" - diff --git a/src/pt/mundohentai/src/eu/kanade/tachiyomi/extension/pt/mundohentai/MundoHentai.kt b/src/pt/mundohentai/src/eu/kanade/tachiyomi/extension/pt/mundohentai/MundoHentai.kt index f8189ba7f..be825671f 100644 --- a/src/pt/mundohentai/src/eu/kanade/tachiyomi/extension/pt/mundohentai/MundoHentai.kt +++ b/src/pt/mundohentai/src/eu/kanade/tachiyomi/extension/pt/mundohentai/MundoHentai.kt @@ -1,7 +1,7 @@ package eu.kanade.tachiyomi.extension.pt.mundohentai -import eu.kanade.tachiyomi.lib.ratelimit.RateLimitInterceptor import eu.kanade.tachiyomi.network.GET +import eu.kanade.tachiyomi.network.interceptor.rateLimit import eu.kanade.tachiyomi.source.model.Filter import eu.kanade.tachiyomi.source.model.FilterList import eu.kanade.tachiyomi.source.model.Page @@ -27,7 +27,7 @@ class MundoHentai : ParsedHttpSource() { override val supportsLatest = false override val client: OkHttpClient = network.cloudflareClient.newBuilder() - .addInterceptor(RateLimitInterceptor(1, 2, TimeUnit.SECONDS)) + .rateLimit(1, 2, TimeUnit.SECONDS) .build() override fun headersBuilder(): Headers.Builder = Headers.Builder() diff --git a/src/pt/mundomangakun/build.gradle b/src/pt/mundomangakun/build.gradle index c824f542a..1af8a5caf 100644 --- a/src/pt/mundomangakun/build.gradle +++ b/src/pt/mundomangakun/build.gradle @@ -6,12 +6,8 @@ ext { extName = 'Mundo Mangá-Kun' pkgNameSuffix = 'pt.mundomangakun' extClass = '.MundoMangaKun' - extVersionCode = 8 + extVersionCode = 9 isNsfw = true } -dependencies { - implementation project(':lib-ratelimit') -} - apply from: "$rootDir/common.gradle" diff --git a/src/pt/mundomangakun/src/eu/kanade/tachiyomi/extension/pt/mundomangakun/MundoMangaKun.kt b/src/pt/mundomangakun/src/eu/kanade/tachiyomi/extension/pt/mundomangakun/MundoMangaKun.kt index 6d9ed1fb6..ef5965dbf 100644 --- a/src/pt/mundomangakun/src/eu/kanade/tachiyomi/extension/pt/mundomangakun/MundoMangaKun.kt +++ b/src/pt/mundomangakun/src/eu/kanade/tachiyomi/extension/pt/mundomangakun/MundoMangaKun.kt @@ -1,7 +1,7 @@ package eu.kanade.tachiyomi.extension.pt.mundomangakun -import eu.kanade.tachiyomi.lib.ratelimit.RateLimitInterceptor import eu.kanade.tachiyomi.network.GET +import eu.kanade.tachiyomi.network.interceptor.rateLimit import eu.kanade.tachiyomi.source.model.Filter import eu.kanade.tachiyomi.source.model.FilterList import eu.kanade.tachiyomi.source.model.Page @@ -33,7 +33,7 @@ class MundoMangaKun : ParsedHttpSource() { override val supportsLatest = false override val client: OkHttpClient = network.client.newBuilder() - .addInterceptor(RateLimitInterceptor(1, 3, TimeUnit.SECONDS)) + .rateLimit(1, 3, TimeUnit.SECONDS) .build() override fun headersBuilder(): Headers.Builder = Headers.Builder() diff --git a/src/pt/mundowebtoon/build.gradle b/src/pt/mundowebtoon/build.gradle index b86f90395..ea8c86a0c 100644 --- a/src/pt/mundowebtoon/build.gradle +++ b/src/pt/mundowebtoon/build.gradle @@ -5,12 +5,8 @@ ext { extName = 'Mundo Webtoon' pkgNameSuffix = 'pt.mundowebtoon' extClass = '.MundoWebtoon' - extVersionCode = 5 + extVersionCode = 6 isNsfw = true } -dependencies { - implementation project(':lib-ratelimit') -} - apply from: "$rootDir/common.gradle" diff --git a/src/pt/mundowebtoon/src/eu/kanade/tachiyomi/extension/pt/mundowebtoon/MundoWebtoon.kt b/src/pt/mundowebtoon/src/eu/kanade/tachiyomi/extension/pt/mundowebtoon/MundoWebtoon.kt index c8279b14c..f0b03e490 100644 --- a/src/pt/mundowebtoon/src/eu/kanade/tachiyomi/extension/pt/mundowebtoon/MundoWebtoon.kt +++ b/src/pt/mundowebtoon/src/eu/kanade/tachiyomi/extension/pt/mundowebtoon/MundoWebtoon.kt @@ -1,8 +1,8 @@ package eu.kanade.tachiyomi.extension.pt.mundowebtoon -import eu.kanade.tachiyomi.lib.ratelimit.RateLimitInterceptor import eu.kanade.tachiyomi.network.GET import eu.kanade.tachiyomi.network.POST +import eu.kanade.tachiyomi.network.interceptor.rateLimit import eu.kanade.tachiyomi.source.model.FilterList import eu.kanade.tachiyomi.source.model.Page import eu.kanade.tachiyomi.source.model.SChapter @@ -33,7 +33,7 @@ class MundoWebtoon : ParsedHttpSource() { override val supportsLatest = true override val client: OkHttpClient = network.cloudflareClient.newBuilder() - .addInterceptor(RateLimitInterceptor(1, 2, TimeUnit.SECONDS)) + .rateLimit(1, 2, TimeUnit.SECONDS) .build() override fun headersBuilder(): Headers.Builder = Headers.Builder() diff --git a/src/pt/opex/build.gradle b/src/pt/opex/build.gradle index 4cf78eb79..f28bd2809 100644 --- a/src/pt/opex/build.gradle +++ b/src/pt/opex/build.gradle @@ -6,11 +6,7 @@ ext { extName = 'One Piece Ex' pkgNameSuffix = 'pt.opex' extClass = '.OnePieceEx' - extVersionCode = 4 -} - -dependencies { - implementation project(':lib-ratelimit') + extVersionCode = 5 } apply from: "$rootDir/common.gradle" diff --git a/src/pt/opex/src/eu/kanade/tachiyomi/extension/pt/opex/OnePieceEx.kt b/src/pt/opex/src/eu/kanade/tachiyomi/extension/pt/opex/OnePieceEx.kt index afd33db2b..b9ba47616 100644 --- a/src/pt/opex/src/eu/kanade/tachiyomi/extension/pt/opex/OnePieceEx.kt +++ b/src/pt/opex/src/eu/kanade/tachiyomi/extension/pt/opex/OnePieceEx.kt @@ -1,7 +1,7 @@ package eu.kanade.tachiyomi.extension.pt.opex -import eu.kanade.tachiyomi.lib.ratelimit.RateLimitInterceptor import eu.kanade.tachiyomi.network.GET +import eu.kanade.tachiyomi.network.interceptor.rateLimit import eu.kanade.tachiyomi.source.model.FilterList import eu.kanade.tachiyomi.source.model.MangasPage import eu.kanade.tachiyomi.source.model.Page @@ -35,7 +35,7 @@ class OnePieceEx : ParsedHttpSource() { override val supportsLatest = false override val client: OkHttpClient = network.cloudflareClient.newBuilder() - .addInterceptor(RateLimitInterceptor(1, 2, TimeUnit.SECONDS)) + .rateLimit(1, 2, TimeUnit.SECONDS) .build() override fun headersBuilder(): Headers.Builder = Headers.Builder() diff --git a/src/pt/saikaiscan/build.gradle b/src/pt/saikaiscan/build.gradle index 520b8c3d1..3009cff3b 100644 --- a/src/pt/saikaiscan/build.gradle +++ b/src/pt/saikaiscan/build.gradle @@ -6,11 +6,7 @@ ext { extName = 'Saikai Scan' pkgNameSuffix = 'pt.saikaiscan' extClass = '.SaikaiScan' - extVersionCode = 8 -} - -dependencies { - implementation project(':lib-ratelimit') + extVersionCode = 9 } apply from: "$rootDir/common.gradle" diff --git a/src/pt/saikaiscan/src/eu/kanade/tachiyomi/extension/pt/saikaiscan/SaikaiScan.kt b/src/pt/saikaiscan/src/eu/kanade/tachiyomi/extension/pt/saikaiscan/SaikaiScan.kt index ccf6e6277..b9d580b0a 100644 --- a/src/pt/saikaiscan/src/eu/kanade/tachiyomi/extension/pt/saikaiscan/SaikaiScan.kt +++ b/src/pt/saikaiscan/src/eu/kanade/tachiyomi/extension/pt/saikaiscan/SaikaiScan.kt @@ -1,8 +1,8 @@ package eu.kanade.tachiyomi.extension.pt.saikaiscan -import eu.kanade.tachiyomi.lib.ratelimit.SpecificHostRateLimitInterceptor import eu.kanade.tachiyomi.network.GET import eu.kanade.tachiyomi.network.asObservableSuccess +import eu.kanade.tachiyomi.network.interceptor.rateLimitHost import eu.kanade.tachiyomi.source.model.FilterList import eu.kanade.tachiyomi.source.model.MangasPage import eu.kanade.tachiyomi.source.model.Page @@ -33,8 +33,8 @@ class SaikaiScan : HttpSource() { override val supportsLatest = true override val client: OkHttpClient = network.cloudflareClient.newBuilder() - .addInterceptor(SpecificHostRateLimitInterceptor(API_URL.toHttpUrl(), 1, 2)) - .addInterceptor(SpecificHostRateLimitInterceptor(IMAGE_SERVER_URL.toHttpUrl(), 1, 1)) + .rateLimitHost(API_URL.toHttpUrl(), 1, 2) + .rateLimitHost(IMAGE_SERVER_URL.toHttpUrl(), 1, 1) .build() private val json: Json by injectLazy() diff --git a/src/pt/taosect/build.gradle b/src/pt/taosect/build.gradle index 89641a142..60011bacc 100644 --- a/src/pt/taosect/build.gradle +++ b/src/pt/taosect/build.gradle @@ -6,12 +6,8 @@ ext { extName = 'Tao Sect' pkgNameSuffix = 'pt.taosect' extClass = '.TaoSect' - extVersionCode = 16 + extVersionCode = 17 isNsfw = true } -dependencies { - implementation project(':lib-ratelimit') -} - apply from: "$rootDir/common.gradle" diff --git a/src/pt/taosect/src/eu/kanade/tachiyomi/extension/pt/taosect/TaoSect.kt b/src/pt/taosect/src/eu/kanade/tachiyomi/extension/pt/taosect/TaoSect.kt index d5720d1ad..a2088a4c0 100644 --- a/src/pt/taosect/src/eu/kanade/tachiyomi/extension/pt/taosect/TaoSect.kt +++ b/src/pt/taosect/src/eu/kanade/tachiyomi/extension/pt/taosect/TaoSect.kt @@ -1,9 +1,9 @@ package eu.kanade.tachiyomi.extension.pt.taosect -import eu.kanade.tachiyomi.lib.ratelimit.RateLimitInterceptor import eu.kanade.tachiyomi.network.GET import eu.kanade.tachiyomi.network.POST import eu.kanade.tachiyomi.network.asObservableSuccess +import eu.kanade.tachiyomi.network.interceptor.rateLimit import eu.kanade.tachiyomi.source.model.FilterList import eu.kanade.tachiyomi.source.model.MangasPage import eu.kanade.tachiyomi.source.model.Page @@ -37,7 +37,7 @@ class TaoSect : HttpSource() { override val supportsLatest = true override val client: OkHttpClient = network.client.newBuilder() - .addInterceptor(RateLimitInterceptor(1, 2, TimeUnit.SECONDS)) + .rateLimit(1, 2, TimeUnit.SECONDS) .build() private val json: Json by injectLazy() diff --git a/src/ru/allhentai/build.gradle b/src/ru/allhentai/build.gradle index 250e7528e..362abd013 100644 --- a/src/ru/allhentai/build.gradle +++ b/src/ru/allhentai/build.gradle @@ -5,12 +5,8 @@ ext { extName = 'AllHentai' pkgNameSuffix = 'ru.allhentai' extClass = '.AllHentai' - extVersionCode = 21 + extVersionCode = 22 isNsfw = true } -dependencies { - implementation project(':lib-ratelimit') -} - apply from: "$rootDir/common.gradle" diff --git a/src/ru/allhentai/src/eu/kanade/tachiyomi/extension/ru/allhentai/AllHentai.kt b/src/ru/allhentai/src/eu/kanade/tachiyomi/extension/ru/allhentai/AllHentai.kt index 893d46381..101f78eb1 100644 --- a/src/ru/allhentai/src/eu/kanade/tachiyomi/extension/ru/allhentai/AllHentai.kt +++ b/src/ru/allhentai/src/eu/kanade/tachiyomi/extension/ru/allhentai/AllHentai.kt @@ -3,9 +3,9 @@ package eu.kanade.tachiyomi.extension.ru.allhentai import android.app.Application import android.content.SharedPreferences import android.widget.Toast -import eu.kanade.tachiyomi.lib.ratelimit.RateLimitInterceptor import eu.kanade.tachiyomi.network.GET import eu.kanade.tachiyomi.network.asObservableSuccess +import eu.kanade.tachiyomi.network.interceptor.rateLimit import eu.kanade.tachiyomi.source.ConfigurableSource import eu.kanade.tachiyomi.source.model.Filter import eu.kanade.tachiyomi.source.model.FilterList @@ -46,10 +46,8 @@ class AllHentai : ConfigurableSource, ParsedHttpSource() { override val supportsLatest = true - private val rateLimitInterceptor = RateLimitInterceptor(2) - override val client: OkHttpClient = network.client.newBuilder() - .addNetworkInterceptor(rateLimitInterceptor) + .rateLimit(2) .addNetworkInterceptor { chain -> val originalRequest = chain.request() val response = chain.proceed(originalRequest) diff --git a/src/ru/comx/build.gradle b/src/ru/comx/build.gradle index db2bd43ad..753adfc31 100644 --- a/src/ru/comx/build.gradle +++ b/src/ru/comx/build.gradle @@ -6,11 +6,7 @@ ext { extName = 'ComX' pkgNameSuffix = 'ru.comx' extClass = '.ComX' - extVersionCode = 16 -} - -dependencies { - implementation project(':lib-ratelimit') + extVersionCode = 17 } apply from: "$rootDir/common.gradle" diff --git a/src/ru/comx/src/eu/kanade/tachiyomi/extension/ru/comx/ComX.kt b/src/ru/comx/src/eu/kanade/tachiyomi/extension/ru/comx/ComX.kt index 9b5158715..3961d0297 100644 --- a/src/ru/comx/src/eu/kanade/tachiyomi/extension/ru/comx/ComX.kt +++ b/src/ru/comx/src/eu/kanade/tachiyomi/extension/ru/comx/ComX.kt @@ -1,9 +1,9 @@ package eu.kanade.tachiyomi.extension.ru.comx import android.webkit.CookieManager -import eu.kanade.tachiyomi.lib.ratelimit.RateLimitInterceptor import eu.kanade.tachiyomi.network.GET import eu.kanade.tachiyomi.network.POST +import eu.kanade.tachiyomi.network.interceptor.rateLimit import eu.kanade.tachiyomi.source.model.FilterList import eu.kanade.tachiyomi.source.model.MangasPage import eu.kanade.tachiyomi.source.model.Page @@ -48,7 +48,7 @@ class ComX : ParsedHttpSource() { override val client: OkHttpClient = network.cloudflareClient.newBuilder() .connectTimeout(10, TimeUnit.SECONDS) .readTimeout(30, TimeUnit.SECONDS) - .addNetworkInterceptor(RateLimitInterceptor(3)) + .rateLimit(3) .addNetworkInterceptor { chain -> val originalRequest = chain.request() val response = chain.proceed(originalRequest) diff --git a/src/ru/henchan/build.gradle b/src/ru/henchan/build.gradle index f3a44b0cc..135c07db2 100644 --- a/src/ru/henchan/build.gradle +++ b/src/ru/henchan/build.gradle @@ -6,12 +6,8 @@ ext { extName = 'Henchan' pkgNameSuffix = 'ru.henchan' extClass = '.Henchan' - extVersionCode = 34 + extVersionCode = 35 isNsfw = true } -dependencies { - implementation project(':lib-ratelimit') -} - apply from: "$rootDir/common.gradle" diff --git a/src/ru/henchan/src/eu/kanade/tachiyomi/extension/ru/henchan/Henchan.kt b/src/ru/henchan/src/eu/kanade/tachiyomi/extension/ru/henchan/Henchan.kt index 9cf86da83..cf03b8786 100644 --- a/src/ru/henchan/src/eu/kanade/tachiyomi/extension/ru/henchan/Henchan.kt +++ b/src/ru/henchan/src/eu/kanade/tachiyomi/extension/ru/henchan/Henchan.kt @@ -1,9 +1,9 @@ package eu.kanade.tachiyomi.extension.ru.henchan import android.annotation.SuppressLint -import eu.kanade.tachiyomi.lib.ratelimit.RateLimitInterceptor import eu.kanade.tachiyomi.network.GET import eu.kanade.tachiyomi.network.asObservable +import eu.kanade.tachiyomi.network.interceptor.rateLimit import eu.kanade.tachiyomi.source.model.Filter import eu.kanade.tachiyomi.source.model.FilterList import eu.kanade.tachiyomi.source.model.Page @@ -33,10 +33,9 @@ class Henchan : ParsedHttpSource() { override val supportsLatest = true - private val rateLimitInterceptor = RateLimitInterceptor(2) - override val client: OkHttpClient = network.client.newBuilder() - .addNetworkInterceptor(rateLimitInterceptor).build() + .rateLimit(2) + .build() override fun popularMangaRequest(page: Int): Request = GET("$baseUrl/mostfavorites&sort=manga?offset=${20 * (page - 1)}", headers) diff --git a/src/ru/libhentai/build.gradle b/src/ru/libhentai/build.gradle index 7155b823c..1baa34a12 100644 --- a/src/ru/libhentai/build.gradle +++ b/src/ru/libhentai/build.gradle @@ -6,12 +6,8 @@ ext { extName = 'HentaiLib' pkgNameSuffix = 'ru.libhentai' extClass = '.LibHentai' - extVersionCode = 17 + extVersionCode = 18 isNsfw = true } -dependencies { - implementation project(path: ':lib-ratelimit') -} - apply from: "$rootDir/common.gradle" diff --git a/src/ru/libhentai/src/eu/kanade/tachiyomi/extension/ru/libhentai/LibHentai.kt b/src/ru/libhentai/src/eu/kanade/tachiyomi/extension/ru/libhentai/LibHentai.kt index be997b115..6f216797c 100644 --- a/src/ru/libhentai/src/eu/kanade/tachiyomi/extension/ru/libhentai/LibHentai.kt +++ b/src/ru/libhentai/src/eu/kanade/tachiyomi/extension/ru/libhentai/LibHentai.kt @@ -5,11 +5,11 @@ import android.content.SharedPreferences import android.widget.Toast import androidx.preference.ListPreference import androidx.preference.PreferenceScreen -import eu.kanade.tachiyomi.lib.ratelimit.RateLimitInterceptor import eu.kanade.tachiyomi.network.GET import eu.kanade.tachiyomi.network.POST import eu.kanade.tachiyomi.network.asObservable import eu.kanade.tachiyomi.network.asObservableSuccess +import eu.kanade.tachiyomi.network.interceptor.rateLimit import eu.kanade.tachiyomi.source.ConfigurableSource import eu.kanade.tachiyomi.source.model.Filter import eu.kanade.tachiyomi.source.model.FilterList @@ -85,7 +85,7 @@ class LibHentai : ConfigurableSource, HttpSource() { override val client: OkHttpClient = network.cloudflareClient.newBuilder() .connectTimeout(10, TimeUnit.SECONDS) .readTimeout(30, TimeUnit.SECONDS) - .addNetworkInterceptor(RateLimitInterceptor(3)) + .rateLimit(3) .addInterceptor { imageContentTypeIntercept(it) } .addInterceptor { chain -> val originalRequest = chain.request() diff --git a/src/ru/libmanga/build.gradle b/src/ru/libmanga/build.gradle index f84ce2df1..10f614a62 100644 --- a/src/ru/libmanga/build.gradle +++ b/src/ru/libmanga/build.gradle @@ -6,11 +6,7 @@ ext { extName = 'MangaLib' pkgNameSuffix = 'ru.libmanga' extClass = '.LibManga' - extVersionCode = 72 -} - -dependencies { - implementation project(path: ':lib-ratelimit') + extVersionCode = 73 } apply from: "$rootDir/common.gradle" diff --git a/src/ru/libmanga/src/eu/kanade/tachiyomi/extension/ru/libmanga/LibManga.kt b/src/ru/libmanga/src/eu/kanade/tachiyomi/extension/ru/libmanga/LibManga.kt index 9ceaf3ec1..a1d852ef7 100644 --- a/src/ru/libmanga/src/eu/kanade/tachiyomi/extension/ru/libmanga/LibManga.kt +++ b/src/ru/libmanga/src/eu/kanade/tachiyomi/extension/ru/libmanga/LibManga.kt @@ -5,11 +5,11 @@ import android.content.SharedPreferences import android.widget.Toast import androidx.preference.ListPreference import androidx.preference.PreferenceScreen -import eu.kanade.tachiyomi.lib.ratelimit.RateLimitInterceptor import eu.kanade.tachiyomi.network.GET import eu.kanade.tachiyomi.network.POST import eu.kanade.tachiyomi.network.asObservable import eu.kanade.tachiyomi.network.asObservableSuccess +import eu.kanade.tachiyomi.network.interceptor.rateLimit import eu.kanade.tachiyomi.source.ConfigurableSource import eu.kanade.tachiyomi.source.model.Filter import eu.kanade.tachiyomi.source.model.FilterList @@ -74,7 +74,7 @@ class LibManga : ConfigurableSource, HttpSource() { override val client: OkHttpClient = network.cloudflareClient.newBuilder() .connectTimeout(10, TimeUnit.SECONDS) .readTimeout(30, TimeUnit.SECONDS) - .addNetworkInterceptor(RateLimitInterceptor(3)) + .rateLimit(3) .addInterceptor { imageContentTypeIntercept(it) } .build() diff --git a/src/ru/mangachan/build.gradle b/src/ru/mangachan/build.gradle index 1d3c303b0..f625589a7 100644 --- a/src/ru/mangachan/build.gradle +++ b/src/ru/mangachan/build.gradle @@ -5,11 +5,7 @@ ext { extName = 'Mangachan' pkgNameSuffix = 'ru.mangachan' extClass = '.Mangachan' - extVersionCode = 12 -} - -dependencies { - implementation project(':lib-ratelimit') + extVersionCode = 13 } apply from: "$rootDir/common.gradle" diff --git a/src/ru/mangachan/src/eu/kanade/tachiyomi/extension/ru/mangachan/Mangachan.kt b/src/ru/mangachan/src/eu/kanade/tachiyomi/extension/ru/mangachan/Mangachan.kt index 8848dca21..e6ac60054 100644 --- a/src/ru/mangachan/src/eu/kanade/tachiyomi/extension/ru/mangachan/Mangachan.kt +++ b/src/ru/mangachan/src/eu/kanade/tachiyomi/extension/ru/mangachan/Mangachan.kt @@ -1,7 +1,7 @@ package eu.kanade.tachiyomi.extension.ru.mangachan -import eu.kanade.tachiyomi.lib.ratelimit.RateLimitInterceptor import eu.kanade.tachiyomi.network.GET +import eu.kanade.tachiyomi.network.interceptor.rateLimit import eu.kanade.tachiyomi.source.model.Filter import eu.kanade.tachiyomi.source.model.FilterList import eu.kanade.tachiyomi.source.model.MangasPage @@ -30,10 +30,9 @@ class Mangachan : ParsedHttpSource() { override val supportsLatest = false - private val rateLimitInterceptor = RateLimitInterceptor(2) - override val client: OkHttpClient = network.client.newBuilder() - .addNetworkInterceptor(rateLimitInterceptor).build() + .rateLimit(2) + .build() override fun popularMangaRequest(page: Int): Request = GET("$baseUrl/mostfavorites?offset=${20 * (page - 1)}", headers) diff --git a/src/ru/mangahub/build.gradle b/src/ru/mangahub/build.gradle index 610e7a459..d71795d79 100644 --- a/src/ru/mangahub/build.gradle +++ b/src/ru/mangahub/build.gradle @@ -6,11 +6,7 @@ ext { extName = 'Mangahub' pkgNameSuffix = 'ru.mangahub' extClass = '.Mangahub' - extVersionCode = 14 -} - -dependencies { - implementation project(':lib-ratelimit') + extVersionCode = 15 } apply from: "$rootDir/common.gradle" diff --git a/src/ru/mangahub/src/eu/kanade/tachiyomi/extension/ru/mangahub/Mangahub.kt b/src/ru/mangahub/src/eu/kanade/tachiyomi/extension/ru/mangahub/Mangahub.kt index e83ea1119..3c1117ff7 100644 --- a/src/ru/mangahub/src/eu/kanade/tachiyomi/extension/ru/mangahub/Mangahub.kt +++ b/src/ru/mangahub/src/eu/kanade/tachiyomi/extension/ru/mangahub/Mangahub.kt @@ -1,7 +1,7 @@ package eu.kanade.tachiyomi.extension.ru.mangahub -import eu.kanade.tachiyomi.lib.ratelimit.RateLimitInterceptor import eu.kanade.tachiyomi.network.GET +import eu.kanade.tachiyomi.network.interceptor.rateLimit import eu.kanade.tachiyomi.source.model.FilterList import eu.kanade.tachiyomi.source.model.Page import eu.kanade.tachiyomi.source.model.SChapter @@ -31,7 +31,7 @@ open class Mangahub : ParsedHttpSource() { override val supportsLatest = true override val client: OkHttpClient = network.client.newBuilder() - .addNetworkInterceptor(RateLimitInterceptor(2)) + .rateLimit(2) .build() private val json: Json by injectLazy() diff --git a/src/ru/mintmanga/build.gradle b/src/ru/mintmanga/build.gradle index f6e916228..b0004f030 100644 --- a/src/ru/mintmanga/build.gradle +++ b/src/ru/mintmanga/build.gradle @@ -5,11 +5,7 @@ ext { extName = 'Mintmanga' pkgNameSuffix = 'ru.mintmanga' extClass = '.Mintmanga' - extVersionCode = 44 -} - -dependencies { - implementation project(':lib-ratelimit') + extVersionCode = 45 } apply from: "$rootDir/common.gradle" diff --git a/src/ru/mintmanga/src/eu/kanade/tachiyomi/extension/ru/mintmanga/Mintmanga.kt b/src/ru/mintmanga/src/eu/kanade/tachiyomi/extension/ru/mintmanga/Mintmanga.kt index c88a329d0..6d7aec6f6 100644 --- a/src/ru/mintmanga/src/eu/kanade/tachiyomi/extension/ru/mintmanga/Mintmanga.kt +++ b/src/ru/mintmanga/src/eu/kanade/tachiyomi/extension/ru/mintmanga/Mintmanga.kt @@ -3,9 +3,9 @@ package eu.kanade.tachiyomi.extension.ru.mintmanga import android.app.Application import android.content.SharedPreferences import android.widget.Toast -import eu.kanade.tachiyomi.lib.ratelimit.RateLimitInterceptor import eu.kanade.tachiyomi.network.GET import eu.kanade.tachiyomi.network.asObservableSuccess +import eu.kanade.tachiyomi.network.interceptor.rateLimit import eu.kanade.tachiyomi.source.ConfigurableSource import eu.kanade.tachiyomi.source.model.Filter import eu.kanade.tachiyomi.source.model.FilterList @@ -46,10 +46,8 @@ class Mintmanga : ConfigurableSource, ParsedHttpSource() { override val supportsLatest = true - private val rateLimitInterceptor = RateLimitInterceptor(2) - override val client: OkHttpClient = network.client.newBuilder() - .addNetworkInterceptor(rateLimitInterceptor) + .rateLimit(2) .addNetworkInterceptor { chain -> val originalRequest = chain.request() val response = chain.proceed(originalRequest) diff --git a/src/ru/readmanga/build.gradle b/src/ru/readmanga/build.gradle index 9505ab645..9e28b0160 100644 --- a/src/ru/readmanga/build.gradle +++ b/src/ru/readmanga/build.gradle @@ -5,11 +5,7 @@ ext { extName = 'Readmanga' pkgNameSuffix = 'ru.readmanga' extClass = '.Readmanga' - extVersionCode = 43 -} - -dependencies { - implementation project(':lib-ratelimit') + extVersionCode = 44 } apply from: "$rootDir/common.gradle" diff --git a/src/ru/readmanga/src/eu/kanade/tachiyomi/extension/ru/readmanga/Readmanga.kt b/src/ru/readmanga/src/eu/kanade/tachiyomi/extension/ru/readmanga/Readmanga.kt index 12625ea5c..6212ad4e2 100644 --- a/src/ru/readmanga/src/eu/kanade/tachiyomi/extension/ru/readmanga/Readmanga.kt +++ b/src/ru/readmanga/src/eu/kanade/tachiyomi/extension/ru/readmanga/Readmanga.kt @@ -3,9 +3,9 @@ package eu.kanade.tachiyomi.extension.ru.readmanga import android.app.Application import android.content.SharedPreferences import android.widget.Toast -import eu.kanade.tachiyomi.lib.ratelimit.RateLimitInterceptor import eu.kanade.tachiyomi.network.GET import eu.kanade.tachiyomi.network.asObservableSuccess +import eu.kanade.tachiyomi.network.interceptor.rateLimit import eu.kanade.tachiyomi.source.ConfigurableSource import eu.kanade.tachiyomi.source.model.Filter import eu.kanade.tachiyomi.source.model.FilterList @@ -46,10 +46,8 @@ class Readmanga : ConfigurableSource, ParsedHttpSource() { override val supportsLatest = true - private val rateLimitInterceptor = RateLimitInterceptor(2) - override val client: OkHttpClient = network.client.newBuilder() - .addNetworkInterceptor(rateLimitInterceptor) + .rateLimit(2) .addNetworkInterceptor { chain -> val originalRequest = chain.request() val response = chain.proceed(originalRequest) diff --git a/src/ru/selfmanga/build.gradle b/src/ru/selfmanga/build.gradle index 2cfc59677..4f036c3b7 100644 --- a/src/ru/selfmanga/build.gradle +++ b/src/ru/selfmanga/build.gradle @@ -5,11 +5,7 @@ ext { extName = 'Selfmanga' pkgNameSuffix = 'ru.selfmanga' extClass = '.Selfmanga' - extVersionCode = 21 -} - -dependencies { - implementation project(':lib-ratelimit') + extVersionCode = 22 } apply from: "$rootDir/common.gradle" diff --git a/src/ru/selfmanga/src/eu/kanade/tachiyomi/extension/ru/selfmanga/Selfmanga.kt b/src/ru/selfmanga/src/eu/kanade/tachiyomi/extension/ru/selfmanga/Selfmanga.kt index 743c4a83b..3641440b4 100644 --- a/src/ru/selfmanga/src/eu/kanade/tachiyomi/extension/ru/selfmanga/Selfmanga.kt +++ b/src/ru/selfmanga/src/eu/kanade/tachiyomi/extension/ru/selfmanga/Selfmanga.kt @@ -1,7 +1,7 @@ package eu.kanade.tachiyomi.extension.ru.selfmanga -import eu.kanade.tachiyomi.lib.ratelimit.RateLimitInterceptor import eu.kanade.tachiyomi.network.GET +import eu.kanade.tachiyomi.network.interceptor.rateLimit import eu.kanade.tachiyomi.source.model.Filter import eu.kanade.tachiyomi.source.model.FilterList import eu.kanade.tachiyomi.source.model.Page @@ -32,10 +32,8 @@ class Selfmanga : ParsedHttpSource() { override val supportsLatest = true - private val rateLimitInterceptor = RateLimitInterceptor(2) - override val client: OkHttpClient = network.client.newBuilder() - .addNetworkInterceptor(rateLimitInterceptor) + .rateLimit(2) .addNetworkInterceptor { chain -> val originalRequest = chain.request() val response = chain.proceed(originalRequest) diff --git a/src/ru/unicomics/build.gradle b/src/ru/unicomics/build.gradle index 411bc3ddf..a774d1962 100644 --- a/src/ru/unicomics/build.gradle +++ b/src/ru/unicomics/build.gradle @@ -6,11 +6,7 @@ ext { extName = 'UniComics' pkgNameSuffix = 'ru.unicomics' extClass = '.UniComics' - extVersionCode = 4 -} - -dependencies { - implementation project(':lib-ratelimit') + extVersionCode = 5 } apply from: "$rootDir/common.gradle" diff --git a/src/ru/unicomics/src/eu/kanade/tachiyomi/extension/ru/unicomics/UniComics.kt b/src/ru/unicomics/src/eu/kanade/tachiyomi/extension/ru/unicomics/UniComics.kt index 0b278f478..dfae8f21c 100644 --- a/src/ru/unicomics/src/eu/kanade/tachiyomi/extension/ru/unicomics/UniComics.kt +++ b/src/ru/unicomics/src/eu/kanade/tachiyomi/extension/ru/unicomics/UniComics.kt @@ -1,8 +1,8 @@ package eu.kanade.tachiyomi.extension.ru.unicomics -import eu.kanade.tachiyomi.lib.ratelimit.RateLimitInterceptor import eu.kanade.tachiyomi.network.GET import eu.kanade.tachiyomi.network.asObservableSuccess +import eu.kanade.tachiyomi.network.interceptor.rateLimit import eu.kanade.tachiyomi.source.model.Filter import eu.kanade.tachiyomi.source.model.FilterList import eu.kanade.tachiyomi.source.model.MangasPage @@ -35,7 +35,7 @@ class UniComics : ParsedHttpSource() { override val client: OkHttpClient = network.client.newBuilder() .connectTimeout(10, TimeUnit.SECONDS) .readTimeout(30, TimeUnit.SECONDS) - .addNetworkInterceptor(RateLimitInterceptor(3)) + .rateLimit(3) .build() override fun headersBuilder(): Headers.Builder = Headers.Builder() diff --git a/src/ru/webofcomics/build.gradle b/src/ru/webofcomics/build.gradle index c8f5dbad6..4978d46b8 100644 --- a/src/ru/webofcomics/build.gradle +++ b/src/ru/webofcomics/build.gradle @@ -5,11 +5,7 @@ ext { extName = 'Web of Comics' pkgNameSuffix = 'ru.webofcomics' extClass = '.WebOfComics' - extVersionCode = 3 -} - -dependencies { - implementation project(path: ':lib-ratelimit') + extVersionCode = 4 } apply from: "$rootDir/common.gradle" diff --git a/src/ru/webofcomics/src/eu/kanade/tachiyomi/extension/ru/webofcomics/WebOfComics.kt b/src/ru/webofcomics/src/eu/kanade/tachiyomi/extension/ru/webofcomics/WebOfComics.kt index b8be01513..069a5a739 100644 --- a/src/ru/webofcomics/src/eu/kanade/tachiyomi/extension/ru/webofcomics/WebOfComics.kt +++ b/src/ru/webofcomics/src/eu/kanade/tachiyomi/extension/ru/webofcomics/WebOfComics.kt @@ -1,8 +1,8 @@ package eu.kanade.tachiyomi.extension.ru.webofcomics -import eu.kanade.tachiyomi.lib.ratelimit.RateLimitInterceptor import eu.kanade.tachiyomi.network.GET import eu.kanade.tachiyomi.network.POST +import eu.kanade.tachiyomi.network.interceptor.rateLimit import eu.kanade.tachiyomi.source.model.Filter import eu.kanade.tachiyomi.source.model.FilterList import eu.kanade.tachiyomi.source.model.MangasPage @@ -40,7 +40,7 @@ class WebOfComics : ParsedHttpSource() { override val client: OkHttpClient = network.cloudflareClient.newBuilder() .connectTimeout(10, TimeUnit.SECONDS) .readTimeout(30, TimeUnit.SECONDS) - .addNetworkInterceptor(RateLimitInterceptor(3)) + .rateLimit(3) .build() override fun popularMangaRequest(page: Int): Request { diff --git a/src/ru/yaoichan/build.gradle b/src/ru/yaoichan/build.gradle index 1b4a61f9e..4414100be 100644 --- a/src/ru/yaoichan/build.gradle +++ b/src/ru/yaoichan/build.gradle @@ -5,12 +5,8 @@ ext { extName = 'Yaoichan' pkgNameSuffix = 'ru.yaoichan' extClass = '.Yaoichan' - extVersionCode = 3 + extVersionCode = 4 isNsfw = true } -dependencies { - implementation project(':lib-ratelimit') -} - apply from: "$rootDir/common.gradle" diff --git a/src/ru/yaoichan/src/eu/kanade/tachiyomi/extension/ru/yaoichan/Yaoichan.kt b/src/ru/yaoichan/src/eu/kanade/tachiyomi/extension/ru/yaoichan/Yaoichan.kt index 22f637395..0cf442d6b 100644 --- a/src/ru/yaoichan/src/eu/kanade/tachiyomi/extension/ru/yaoichan/Yaoichan.kt +++ b/src/ru/yaoichan/src/eu/kanade/tachiyomi/extension/ru/yaoichan/Yaoichan.kt @@ -1,7 +1,7 @@ package eu.kanade.tachiyomi.extension.ru.yaoichan -import eu.kanade.tachiyomi.lib.ratelimit.RateLimitInterceptor import eu.kanade.tachiyomi.network.GET +import eu.kanade.tachiyomi.network.interceptor.rateLimit import eu.kanade.tachiyomi.source.model.Filter import eu.kanade.tachiyomi.source.model.FilterList import eu.kanade.tachiyomi.source.model.Page @@ -26,10 +26,9 @@ class Yaoichan : ParsedHttpSource() { override val supportsLatest = false - private val rateLimitInterceptor = RateLimitInterceptor(2) - override val client: OkHttpClient = network.client.newBuilder() - .addNetworkInterceptor(rateLimitInterceptor).build() + .rateLimit(2) + .build() override fun popularMangaRequest(page: Int): Request = GET("$baseUrl/mostfavorites?offset=${20 * (page - 1)}", headers) diff --git a/src/zh/copymanga/build.gradle b/src/zh/copymanga/build.gradle index f5230029b..54dd4574a 100644 --- a/src/zh/copymanga/build.gradle +++ b/src/zh/copymanga/build.gradle @@ -5,11 +5,11 @@ ext { extName = 'CopyManga' pkgNameSuffix = 'zh.copymanga' extClass = '.CopyManga' - extVersionCode = 25 + extVersionCode = 26 } -apply from: "$rootDir/common.gradle" dependencies { implementation 'com.luhuiguo:chinese-utils:1.0' - implementation project(':lib-ratelimit') } + +apply from: "$rootDir/common.gradle" diff --git a/src/zh/copymanga/src/eu/kanade/tachiyomi/extension/zh/copymanga/CopyManga.kt b/src/zh/copymanga/src/eu/kanade/tachiyomi/extension/zh/copymanga/CopyManga.kt index 127c70222..2c6bfa8c9 100644 --- a/src/zh/copymanga/src/eu/kanade/tachiyomi/extension/zh/copymanga/CopyManga.kt +++ b/src/zh/copymanga/src/eu/kanade/tachiyomi/extension/zh/copymanga/CopyManga.kt @@ -4,8 +4,8 @@ import android.app.Application import android.content.SharedPreferences import com.luhuiguo.chinese.ChineseUtils import com.squareup.duktape.Duktape -import eu.kanade.tachiyomi.lib.ratelimit.SpecificHostRateLimitInterceptor import eu.kanade.tachiyomi.network.GET +import eu.kanade.tachiyomi.network.interceptor.rateLimitHost import eu.kanade.tachiyomi.source.ConfigurableSource import eu.kanade.tachiyomi.source.model.Filter import eu.kanade.tachiyomi.source.model.FilterList @@ -75,42 +75,32 @@ class CopyManga : ConfigurableSource, HttpSource() { init(null, arrayOf(trustManager), SecureRandom()) } - private val mainSiteApiRateLimitInterceptor = SpecificHostRateLimitInterceptor( - baseUrl.toHttpUrlOrNull()!!, - CONNECT_PERMITS, - CONNECT_PERIOD - ) - - private val mainlandCDN1RateLimitInterceptor = SpecificHostRateLimitInterceptor( - mainlandCdn1Url.toHttpUrlOrNull()!!, - CONNECT_PERMITS, - CONNECT_PERIOD - ) - - private val mainlandCDN2RateLimitInterceptor = SpecificHostRateLimitInterceptor( - mainlandCdn2Url.toHttpUrlOrNull()!!, - CONNECT_PERMITS, - CONNECT_PERIOD - ) - - private val overseasCDN1RateLimitInterceptor = SpecificHostRateLimitInterceptor( - overseasCdn1Url.toHttpUrlOrNull()!!, - CONNECT_PERMITS, - CONNECT_PERIOD - ) - - private val overseasCDN2RateLimitInterceptor = SpecificHostRateLimitInterceptor( - overseasCdn2Url.toHttpUrlOrNull()!!, - CONNECT_PERMITS, - CONNECT_PERIOD - ) - override val client: OkHttpClient = super.client.newBuilder() - .addInterceptor(mainSiteApiRateLimitInterceptor) - .addInterceptor(mainlandCDN1RateLimitInterceptor) - .addInterceptor(mainlandCDN2RateLimitInterceptor) - .addInterceptor(overseasCDN1RateLimitInterceptor) - .addInterceptor(overseasCDN2RateLimitInterceptor) + .rateLimitHost( + baseUrl.toHttpUrlOrNull()!!, + CONNECT_PERMITS, + CONNECT_PERIOD + ) + .rateLimitHost( + mainlandCdn1Url.toHttpUrlOrNull()!!, + CONNECT_PERMITS, + CONNECT_PERIOD + ) + .rateLimitHost( + mainlandCdn2Url.toHttpUrlOrNull()!!, + CONNECT_PERMITS, + CONNECT_PERIOD + ) + .rateLimitHost( + overseasCdn1Url.toHttpUrlOrNull()!!, + CONNECT_PERMITS, + CONNECT_PERIOD + ) + .rateLimitHost( + overseasCdn2Url.toHttpUrlOrNull()!!, + CONNECT_PERMITS, + CONNECT_PERIOD + ) .sslSocketFactory(sslContext.socketFactory, trustManager) .build() diff --git a/src/zh/dmzj/build.gradle b/src/zh/dmzj/build.gradle index dfb7d2266..e8f2e14ae 100644 --- a/src/zh/dmzj/build.gradle +++ b/src/zh/dmzj/build.gradle @@ -6,11 +6,7 @@ ext { extName = 'Dmzj' pkgNameSuffix = 'zh.dmzj' extClass = '.Dmzj' - extVersionCode = 28 -} - -dependencies { - implementation project(':lib-ratelimit') + extVersionCode = 29 } apply from: "$rootDir/common.gradle" diff --git a/src/zh/dmzj/src/eu/kanade/tachiyomi/extension/zh/dmzj/Dmzj.kt b/src/zh/dmzj/src/eu/kanade/tachiyomi/extension/zh/dmzj/Dmzj.kt index a6b53cd0e..39ba76852 100644 --- a/src/zh/dmzj/src/eu/kanade/tachiyomi/extension/zh/dmzj/Dmzj.kt +++ b/src/zh/dmzj/src/eu/kanade/tachiyomi/extension/zh/dmzj/Dmzj.kt @@ -10,9 +10,9 @@ import androidx.preference.PreferenceScreen import eu.kanade.tachiyomi.extension.zh.dmzj.protobuf.ComicDetailResponse import eu.kanade.tachiyomi.extension.zh.dmzj.utils.HttpGetFailoverInterceptor import eu.kanade.tachiyomi.extension.zh.dmzj.utils.RSA -import eu.kanade.tachiyomi.lib.ratelimit.SpecificHostRateLimitInterceptor import eu.kanade.tachiyomi.network.GET import eu.kanade.tachiyomi.network.asObservableSuccess +import eu.kanade.tachiyomi.network.interceptor.rateLimitHost import eu.kanade.tachiyomi.source.ConfigurableSource import eu.kanade.tachiyomi.source.model.Filter import eu.kanade.tachiyomi.source.model.FilterList @@ -64,34 +64,29 @@ class Dmzj : ConfigurableSource, HttpSource() { } private val httpGetFailoverInterceptor = HttpGetFailoverInterceptor() - private val v3apiRateLimitInterceptor = SpecificHostRateLimitInterceptor( - v3apiUrl.toHttpUrlOrNull()!!, - preferences.getString(API_RATELIMIT_PREF, "5")!!.toInt() - ) - private val v4apiRateLimitInterceptor = SpecificHostRateLimitInterceptor( - v4apiUrl.toHttpUrlOrNull()!!, - preferences.getString(API_RATELIMIT_PREF, "5")!!.toInt() - ) - private val apiRateLimitInterceptor = SpecificHostRateLimitInterceptor( - apiUrl.toHttpUrlOrNull()!!, - preferences.getString(API_RATELIMIT_PREF, "5")!!.toInt() - ) - private val imageCDNRateLimitInterceptor = SpecificHostRateLimitInterceptor( - imageCDNUrl.toHttpUrlOrNull()!!, - preferences.getString(IMAGE_CDN_RATELIMIT_PREF, "5")!!.toInt() - ) - private val imageSmallCDNRateLimitInterceptor = SpecificHostRateLimitInterceptor( - imageSmallCDNUrl.toHttpUrlOrNull()!!, - preferences.getString(IMAGE_CDN_RATELIMIT_PREF, "5")!!.toInt() - ) override val client: OkHttpClient = network.client.newBuilder() .addInterceptor(httpGetFailoverInterceptor) - .addNetworkInterceptor(apiRateLimitInterceptor) - .addNetworkInterceptor(v3apiRateLimitInterceptor) - .addNetworkInterceptor(v4apiRateLimitInterceptor) - .addNetworkInterceptor(imageCDNRateLimitInterceptor) - .addNetworkInterceptor(imageSmallCDNRateLimitInterceptor) + .rateLimitHost( + apiUrl.toHttpUrlOrNull()!!, + preferences.getString(API_RATELIMIT_PREF, "5")!!.toInt() + ) + .rateLimitHost( + v3apiUrl.toHttpUrlOrNull()!!, + preferences.getString(API_RATELIMIT_PREF, "5")!!.toInt() + ) + .rateLimitHost( + v4apiUrl.toHttpUrlOrNull()!!, + preferences.getString(API_RATELIMIT_PREF, "5")!!.toInt() + ) + .rateLimitHost( + imageCDNUrl.toHttpUrlOrNull()!!, + preferences.getString(IMAGE_CDN_RATELIMIT_PREF, "5")!!.toInt() + ) + .rateLimitHost( + imageSmallCDNUrl.toHttpUrlOrNull()!!, + preferences.getString(IMAGE_CDN_RATELIMIT_PREF, "5")!!.toInt() + ) .build() override fun headersBuilder() = Headers.Builder().apply { diff --git a/src/zh/mangabz/build.gradle b/src/zh/mangabz/build.gradle index ae4a86fb4..845d2541c 100644 --- a/src/zh/mangabz/build.gradle +++ b/src/zh/mangabz/build.gradle @@ -5,11 +5,10 @@ ext { extName = 'Mangabz' pkgNameSuffix = 'zh.mangabz' extClass = '.Mangabz' - extVersionCode = 2 + extVersionCode = 3 } dependencies { - implementation project(':lib-ratelimit') coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.1' } diff --git a/src/zh/mangabz/src/eu/kanade/tachiyomi/extension/zh/mangabz/Mangabz.kt b/src/zh/mangabz/src/eu/kanade/tachiyomi/extension/zh/mangabz/Mangabz.kt index f5dc22ad4..4d6edb7ac 100644 --- a/src/zh/mangabz/src/eu/kanade/tachiyomi/extension/zh/mangabz/Mangabz.kt +++ b/src/zh/mangabz/src/eu/kanade/tachiyomi/extension/zh/mangabz/Mangabz.kt @@ -3,9 +3,9 @@ package eu.kanade.tachiyomi.extension.zh.mangabz import android.app.Application import android.content.SharedPreferences import com.squareup.duktape.Duktape -import eu.kanade.tachiyomi.lib.ratelimit.SpecificHostRateLimitInterceptor import eu.kanade.tachiyomi.network.GET import eu.kanade.tachiyomi.network.asObservableSuccess +import eu.kanade.tachiyomi.network.interceptor.rateLimitHost import eu.kanade.tachiyomi.source.ConfigurableSource import eu.kanade.tachiyomi.source.model.FilterList import eu.kanade.tachiyomi.source.model.MangasPage @@ -40,10 +40,6 @@ class Mangabz : ConfigurableSource, HttpSource() { Injekt.get().getSharedPreferences("source_$id", 0x0000) } - private val mainSiteRateLimitInterceptor = SpecificHostRateLimitInterceptor(baseUrl.toHttpUrlOrNull()!!, preferences.getString(MAINSITE_RATELIMIT_PREF, "5")!!.toInt()) - private val imageCDNRateLimitInterceptor1 = SpecificHostRateLimitInterceptor(imageServer[0].toHttpUrlOrNull()!!, preferences.getString(IMAGE_CDN_RATELIMIT_PREF, "5")!!.toInt()) - private val imageCDNRateLimitInterceptor2 = SpecificHostRateLimitInterceptor(imageServer[1].toHttpUrlOrNull()!!, preferences.getString(IMAGE_CDN_RATELIMIT_PREF, "5")!!.toInt()) - override fun headersBuilder(): Headers.Builder = super.headersBuilder() .set("Referer", "https://mangabz.com") .set("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.104 Safari/537.36") @@ -51,9 +47,9 @@ class Mangabz : ConfigurableSource, HttpSource() { private val showZhHantWebsite = preferences.getBoolean(SHOW_ZH_HANT_WEBSITE_PREF, false) override val client: OkHttpClient = network.client.newBuilder() - .addNetworkInterceptor(mainSiteRateLimitInterceptor) - .addNetworkInterceptor(imageCDNRateLimitInterceptor1) - .addNetworkInterceptor(imageCDNRateLimitInterceptor2) + .rateLimitHost(baseUrl.toHttpUrlOrNull()!!, preferences.getString(MAINSITE_RATELIMIT_PREF, "5")!!.toInt()) + .rateLimitHost(imageServer[0].toHttpUrlOrNull()!!, preferences.getString(IMAGE_CDN_RATELIMIT_PREF, "5")!!.toInt()) + .rateLimitHost(imageServer[1].toHttpUrlOrNull()!!, preferences.getString(IMAGE_CDN_RATELIMIT_PREF, "5")!!.toInt()) .addNetworkInterceptor { chain -> val cookies = chain.request().header("Cookie")?.replace(replaceCookiesRegex, "") ?: "" val newReq = chain diff --git a/src/zh/manhuagui/build.gradle b/src/zh/manhuagui/build.gradle index 7f125ed9f..395b60ca9 100644 --- a/src/zh/manhuagui/build.gradle +++ b/src/zh/manhuagui/build.gradle @@ -6,12 +6,11 @@ ext { extName = 'ManHuaGui' pkgNameSuffix = 'zh.manhuagui' extClass = '.Manhuagui' - extVersionCode = 11 + extVersionCode = 13 } dependencies { compileOnly libs.bundles.coroutines - implementation project(':lib-ratelimit') } apply from: "$rootDir/common.gradle" diff --git a/src/zh/manhuagui/src/eu/kanade/tachiyomi/extension/zh/manhuagui/Manhuagui.kt b/src/zh/manhuagui/src/eu/kanade/tachiyomi/extension/zh/manhuagui/Manhuagui.kt index 2eb7415d5..48da2a14f 100644 --- a/src/zh/manhuagui/src/eu/kanade/tachiyomi/extension/zh/manhuagui/Manhuagui.kt +++ b/src/zh/manhuagui/src/eu/kanade/tachiyomi/extension/zh/manhuagui/Manhuagui.kt @@ -3,10 +3,10 @@ package eu.kanade.tachiyomi.extension.zh.manhuagui import android.app.Application import android.content.SharedPreferences import com.squareup.duktape.Duktape -import eu.kanade.tachiyomi.lib.ratelimit.SpecificHostRateLimitInterceptor import eu.kanade.tachiyomi.network.GET import eu.kanade.tachiyomi.network.POST import eu.kanade.tachiyomi.network.asObservableSuccess +import eu.kanade.tachiyomi.network.interceptor.rateLimitHost import eu.kanade.tachiyomi.source.ConfigurableSource import eu.kanade.tachiyomi.source.model.Filter import eu.kanade.tachiyomi.source.model.FilterList @@ -71,23 +71,19 @@ class Manhuagui : ConfigurableSource, ParsedHttpSource() { private val baseHttpUrl: HttpUrl = baseUrl.toHttpUrlOrNull()!! // Add rate limit to fix manga thumbnail load failure - private val mainSiteRateLimitInterceptor = SpecificHostRateLimitInterceptor(baseHttpUrl, preferences.getString(MAINSITE_RATELIMIT_PREF, MAINSITE_RATELIMIT_DEFAULT_VALUE)!!.toInt(), 10) - private val imageCDNRateLimitInterceptor1 = SpecificHostRateLimitInterceptor(imageServer[0].toHttpUrlOrNull()!!, preferences.getString(IMAGE_CDN_RATELIMIT_PREF, IMAGE_CDN_RATELIMIT_DEFAULT_VALUE)!!.toInt()) - private val imageCDNRateLimitInterceptor2 = SpecificHostRateLimitInterceptor(imageServer[1].toHttpUrlOrNull()!!, preferences.getString(IMAGE_CDN_RATELIMIT_PREF, IMAGE_CDN_RATELIMIT_DEFAULT_VALUE)!!.toInt()) - override val client: OkHttpClient = if (getShowR18()) network.client.newBuilder() - .addNetworkInterceptor(mainSiteRateLimitInterceptor) - .addNetworkInterceptor(imageCDNRateLimitInterceptor1) - .addNetworkInterceptor(imageCDNRateLimitInterceptor2) + .rateLimitHost(baseHttpUrl, preferences.getString(MAINSITE_RATELIMIT_PREF, MAINSITE_RATELIMIT_DEFAULT_VALUE)!!.toInt(), 10) + .rateLimitHost(imageServer[0].toHttpUrlOrNull()!!, preferences.getString(IMAGE_CDN_RATELIMIT_PREF, IMAGE_CDN_RATELIMIT_DEFAULT_VALUE)!!.toInt()) + .rateLimitHost(imageServer[1].toHttpUrlOrNull()!!, preferences.getString(IMAGE_CDN_RATELIMIT_PREF, IMAGE_CDN_RATELIMIT_DEFAULT_VALUE)!!.toInt()) .addNetworkInterceptor(AddCookieHeaderInterceptor(baseHttpUrl.host)) .build() else network.client.newBuilder() - .addNetworkInterceptor(mainSiteRateLimitInterceptor) - .addNetworkInterceptor(imageCDNRateLimitInterceptor1) - .addNetworkInterceptor(imageCDNRateLimitInterceptor2) + .rateLimitHost(baseHttpUrl, preferences.getString(MAINSITE_RATELIMIT_PREF, MAINSITE_RATELIMIT_DEFAULT_VALUE)!!.toInt(), 10) + .rateLimitHost(imageServer[0].toHttpUrlOrNull()!!, preferences.getString(IMAGE_CDN_RATELIMIT_PREF, IMAGE_CDN_RATELIMIT_DEFAULT_VALUE)!!.toInt()) + .rateLimitHost(imageServer[1].toHttpUrlOrNull()!!, preferences.getString(IMAGE_CDN_RATELIMIT_PREF, IMAGE_CDN_RATELIMIT_DEFAULT_VALUE)!!.toInt()) .build() // Add R18 verification cookie