Refactor to use app-provided rate limiting interceptors (#12087)

This commit is contained in:
arkon 2022-06-05 16:33:49 -04:00 committed by GitHub
parent 86d04b11b7
commit 341d067afc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
113 changed files with 260 additions and 534 deletions

View File

@ -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"

View File

@ -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()
}

View File

@ -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"

View File

@ -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()

View File

@ -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"

View File

@ -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) }

View File

@ -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"

View File

@ -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 {

View File

@ -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"

View File

@ -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()

View File

@ -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"

View File

@ -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 {

View File

@ -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"

View File

@ -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()

View File

@ -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"

View File

@ -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 {

View File

@ -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"

View File

@ -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()

View File

@ -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"

View File

@ -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()

View File

@ -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"

View File

@ -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)

View File

@ -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"

View File

@ -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(
override val client: OkHttpClient = network.cloudflareClient.newBuilder()
.rateLimitHost(
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)
.build()
override fun headersBuilder(): Headers.Builder = Headers.Builder()
.add("Referer", baseUrl)

View File

@ -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"

View File

@ -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 {

View File

@ -8,8 +8,4 @@ ext {
extVersionCode = 2
}
dependencies {
// implementation project(':lib-ratelimit')
}
apply from: "$rootDir/common.gradle"

View File

@ -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"

View File

@ -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()

View File

@ -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"

View File

@ -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()

View File

@ -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"

View File

@ -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

View File

@ -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"

View File

@ -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()
}

View File

@ -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"

View File

@ -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<Application>().getSharedPreferences("source_$id", 0x0000)
}
private val webRateLimitInterceptor = SpecificHostRateLimitInterceptor(
override val client: OkHttpClient = network.client.newBuilder()
.rateLimitHost(
baseUrl.toHttpUrlOrNull()!!,
preferences.getString(WEB_RATELIMIT_PREF, WEB_RATELIMIT_PREF_DEFAULT_VALUE)!!.toInt(), 60
)
private val imageCDNRateLimitInterceptor = SpecificHostRateLimitInterceptor(
.rateLimitHost(
imageCDNUrls[0].toHttpUrlOrNull()!!,
preferences.getString(IMAGE_CDN_RATELIMIT_PREF, IMAGE_CDN_RATELIMIT_PREF_DEFAULT_VALUE)!!.toInt(), 60
)
private val imageCDNRateLimitInterceptor1 = SpecificHostRateLimitInterceptor(
.rateLimitHost(
imageCDNUrls[1].toHttpUrlOrNull()!!,
preferences.getString(IMAGE_CDN_RATELIMIT_PREF, IMAGE_CDN_RATELIMIT_PREF_DEFAULT_VALUE)!!.toInt(), 60
)
private val imageCDNRateLimitInterceptor2 = SpecificHostRateLimitInterceptor(
.rateLimitHost(
imageCDNUrls[2].toHttpUrlOrNull()!!,
preferences.getString(IMAGE_CDN_RATELIMIT_PREF, IMAGE_CDN_RATELIMIT_PREF_DEFAULT_VALUE)!!.toInt(), 60
)
private val imageCDNRateLimitInterceptor3 = SpecificHostRateLimitInterceptor(
.rateLimitHost(
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)
.build()
override fun popularMangaRequest(page: Int) = GET("$baseUrl/library?order_item=likes_count&order_dir=desc&type=&filter_by=title&page=$page", headers)

View File

@ -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"

View File

@ -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<Application>().getSharedPreferences("source_$id", 0x0000)
}
private val webRateLimitInterceptor = SpecificHostRateLimitInterceptor(
override val client: OkHttpClient = network.client.newBuilder()
.rateLimitHost(
baseUrl.toHttpUrlOrNull()!!,
preferences.getString(WEB_RATELIMIT_PREF, WEB_RATELIMIT_PREF_DEFAULT_VALUE)!!.toInt(),
60
)
private val imageCDNRateLimitInterceptor = SpecificHostRateLimitInterceptor(
.rateLimitHost(
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)
.build()
// Marks erotic content as false and excludes: Ecchi(6), GirlsLove(17), BoysLove(18) and Harem(19) genders

View File

@ -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"

View File

@ -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

View File

@ -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"

View File

@ -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}"

View File

@ -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"

View File

@ -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()

View File

@ -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"

View File

@ -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()
}

View File

@ -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"

View File

@ -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()

View File

@ -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"

View File

@ -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()

View File

@ -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"

View File

@ -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()

View File

@ -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"

View File

@ -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()

View File

@ -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"

View File

@ -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()

View File

@ -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"

View File

@ -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()

View File

@ -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"

View File

@ -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()

View File

@ -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"

View File

@ -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()

View File

@ -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"

View File

@ -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()

View File

@ -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"

View File

@ -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()

View File

@ -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"

View File

@ -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()

View File

@ -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"

View File

@ -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()

View File

@ -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"

View File

@ -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()

View File

@ -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"

View File

@ -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()

View File

@ -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"

View File

@ -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()

View File

@ -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"

View File

@ -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)

View File

@ -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"

View File

@ -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)

View File

@ -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"

View File

@ -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)

View File

@ -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"

View File

@ -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()

View File

@ -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"

View File

@ -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()

View File

@ -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"

View File

@ -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)

View File

@ -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"

View File

@ -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()

View File

@ -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"

View File

@ -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)

View File

@ -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"

View File

@ -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)

View File

@ -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"

View File

@ -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)

View File

@ -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"

View File

@ -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()

View File

@ -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"

Some files were not shown because too many files have changed in this diff Show More