diff --git a/multisrc/overrides/libgroup/hentailib/src/HentaiLib.kt b/multisrc/overrides/libgroup/hentailib/src/HentaiLib.kt index 252349ca0..364fe9481 100644 --- a/multisrc/overrides/libgroup/hentailib/src/HentaiLib.kt +++ b/multisrc/overrides/libgroup/hentailib/src/HentaiLib.kt @@ -1,12 +1,12 @@ package eu.kanade.tachiyomi.extension.ru.hentailib import eu.kanade.tachiyomi.multisrc.libgroup.LibGroup -import eu.kanade.tachiyomi.network.GET import eu.kanade.tachiyomi.network.POST +import eu.kanade.tachiyomi.network.interceptor.rateLimitHost import eu.kanade.tachiyomi.source.model.Filter import eu.kanade.tachiyomi.source.model.FilterList -import java.io.IOException import okhttp3.Headers +import okhttp3.HttpUrl.Companion.toHttpUrl import okhttp3.OkHttpClient import okhttp3.Request @@ -15,6 +15,10 @@ class HentaiLib : LibGroup("HentaiLib", "https://hentailib.me", "ru") { override val id: Long = 6425650164840473547 override val client: OkHttpClient = super.client.newBuilder() + .rateLimitHost(baseUrl.toHttpUrl(),10) //source + .rateLimitHost("https://img2.hentailib.org".toHttpUrl(),1) //secondary + .rateLimitHost("https://img4.hentailib.org".toHttpUrl(),1) //fourth + .rateLimitHost("https://img3.hentailib.org".toHttpUrl(),1) //compress .addInterceptor(::imageContentTypeIntercept) .build() diff --git a/multisrc/overrides/libgroup/mangalib/src/MangaLib.kt b/multisrc/overrides/libgroup/mangalib/src/MangaLib.kt index 9215b0639..e05248ede 100644 --- a/multisrc/overrides/libgroup/mangalib/src/MangaLib.kt +++ b/multisrc/overrides/libgroup/mangalib/src/MangaLib.kt @@ -6,16 +6,16 @@ import android.widget.Toast import androidx.preference.ListPreference import androidx.preference.PreferenceScreen import eu.kanade.tachiyomi.multisrc.libgroup.LibGroup -import eu.kanade.tachiyomi.network.GET import eu.kanade.tachiyomi.network.POST +import eu.kanade.tachiyomi.network.interceptor.rateLimitHost import eu.kanade.tachiyomi.source.model.Filter import eu.kanade.tachiyomi.source.model.FilterList import okhttp3.Headers +import okhttp3.HttpUrl.Companion.toHttpUrl import okhttp3.OkHttpClient import okhttp3.Request import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.api.get -import java.io.IOException class MangaLib : LibGroup("MangaLib", "https://mangalib.me", "ru") { @@ -25,7 +25,16 @@ class MangaLib : LibGroup("MangaLib", "https://mangalib.me", "ru") { Injekt.get().getSharedPreferences("source_${id}_2", 0x0000) } + private val baseOrig: String = "https://mangalib.me" + private val baseMirr: String = "https://mangalib.org" + private var domain: String? = preferences.getString(DOMAIN_PREF, baseOrig) + override val baseUrl: String = domain.toString() + override val client: OkHttpClient = super.client.newBuilder() + .rateLimitHost(baseUrl.toHttpUrl(),10) //source + .rateLimitHost("https://img2.mixlib.me".toHttpUrl(),1) //secondary + .rateLimitHost("https://img4.imgslib.link".toHttpUrl(),1) //fourth + .rateLimitHost("https://img3.cdnlib.link".toHttpUrl(),1) //compress .addInterceptor(::imageContentTypeIntercept) .build() @@ -39,11 +48,6 @@ class MangaLib : LibGroup("MangaLib", "https://mangalib.me", "ru") { } .build() - private val baseOrig: String = "https://mangalib.me" - private val baseMirr: String = "https://mangalib.org" - private var domain: String? = preferences.getString(DOMAIN_PREF, baseOrig) - override val baseUrl: String = domain.toString() - override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request { if (csrfToken.isEmpty()) { val tokenResponse = client.newCall(popularMangaRequest(page)).execute() diff --git a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/libgroup/LibGenerator.kt b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/libgroup/LibGenerator.kt index d9d0fd8cb..9f8af3c40 100644 --- a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/libgroup/LibGenerator.kt +++ b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/libgroup/LibGenerator.kt @@ -9,7 +9,7 @@ class LibGenerator: ThemeSourceGenerator { override val themeClass = "LibGroup" - override val baseVersionCode: Int = 5 + override val baseVersionCode: Int = 6 override val sources = listOf( SingleLang("MangaLib", "https://mangalib.me", "ru", overrideVersionCode = 74), diff --git a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/libgroup/LibGroup.kt b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/libgroup/LibGroup.kt index 6ad80f5d6..0eef69f21 100644 --- a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/libgroup/LibGroup.kt +++ b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/libgroup/LibGroup.kt @@ -79,7 +79,6 @@ abstract class LibGroup( override val client: OkHttpClient = network.cloudflareClient.newBuilder() .connectTimeout(30, TimeUnit.SECONDS) .readTimeout(1, TimeUnit.MINUTES) - .rateLimit(2) .addInterceptor { chain -> val response = chain.proceed(chain.request()) if (response.code == 419)