From 0abfb4f7010be41637811bcac91a9f831ca4a49f Mon Sep 17 00:00:00 2001 From: Riztard Lanthorn Date: Sat, 20 Feb 2021 04:41:01 +0700 Subject: [PATCH] add rate limiter to Shield Manga (#5922) --- .../madara/shieldmanga/additional.gradle.kts | 4 ++++ .../madara/shieldmanga/src/ShieldManga.kt | 16 ++++++++++++++++ .../tachiyomi/multisrc/madara/MadaraGenerator.kt | 2 +- 3 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 multisrc/overrides/madara/shieldmanga/additional.gradle.kts create mode 100644 multisrc/overrides/madara/shieldmanga/src/ShieldManga.kt diff --git a/multisrc/overrides/madara/shieldmanga/additional.gradle.kts b/multisrc/overrides/madara/shieldmanga/additional.gradle.kts new file mode 100644 index 000000000..10beb8157 --- /dev/null +++ b/multisrc/overrides/madara/shieldmanga/additional.gradle.kts @@ -0,0 +1,4 @@ + +dependencies { + implementation project(':lib-ratelimit') +} diff --git a/multisrc/overrides/madara/shieldmanga/src/ShieldManga.kt b/multisrc/overrides/madara/shieldmanga/src/ShieldManga.kt new file mode 100644 index 000000000..082b5096a --- /dev/null +++ b/multisrc/overrides/madara/shieldmanga/src/ShieldManga.kt @@ -0,0 +1,16 @@ +package eu.kanade.tachiyomi.extension.en.shieldmanga + +import eu.kanade.tachiyomi.lib.ratelimit.RateLimitInterceptor +import eu.kanade.tachiyomi.multisrc.madara.Madara +import okhttp3.OkHttpClient +import java.util.concurrent.TimeUnit + +class ShieldManga : Madara("Shield Manga", "https://shieldmanga.club", "en") { + private val rateLimitInterceptor = RateLimitInterceptor(1) + + override val client: OkHttpClient = network.cloudflareClient.newBuilder() + .connectTimeout(10, TimeUnit.SECONDS) + .readTimeout(30, TimeUnit.SECONDS) + .addNetworkInterceptor(rateLimitInterceptor) + .build() +} diff --git a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/madara/MadaraGenerator.kt b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/madara/MadaraGenerator.kt index a91d3cccf..003549a54 100644 --- a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/madara/MadaraGenerator.kt +++ b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/madara/MadaraGenerator.kt @@ -188,7 +188,7 @@ class MadaraGenerator : ThemeSourceGenerator { SingleLang("Rüya Manga", "https://www.ruyamanga.com", "tr", className = "RuyaManga"), SingleLang("S2Manga", "https://s2manga.com", "en"), SingleLang("Sekte Doujin", "https://sektedoujin.xyz", "id", isNsfw = true), - SingleLang("Shield Manga", "https://shieldmanga.club", "en"), + SingleLang("Shield Manga", "https://shieldmanga.club", "en", overrideVersionCode = 1), SingleLang("ShoujoHearts", "http://shoujohearts.com", "en"), SingleLang("SiXiang Scans", "http://www.sixiangscans.com", "en"), SingleLang("Siyahmelek", "https://siyahmelek.com", "tr", isNsfw = true, overrideVersionCode = 1),