From 642e90ccc7ba636d0cf8e769383021365d7d3ab9 Mon Sep 17 00:00:00 2001 From: bapeey <90949336+bapeey@users.noreply.github.com> Date: Sat, 25 May 2024 05:30:31 -0500 Subject: [PATCH] DynastyScans: Add ratelimit (#3218) add ratelimit --- src/en/dynasty/build.gradle | 2 +- .../kanade/tachiyomi/extension/en/dynasty/DynastyScans.kt | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/en/dynasty/build.gradle b/src/en/dynasty/build.gradle index 274c14716..6c62be92a 100644 --- a/src/en/dynasty/build.gradle +++ b/src/en/dynasty/build.gradle @@ -1,7 +1,7 @@ ext { extName = 'Dynasty' extClass = '.DynastyFactory' - extVersionCode = 23 + extVersionCode = 24 } apply from: "$rootDir/common.gradle" diff --git a/src/en/dynasty/src/eu/kanade/tachiyomi/extension/en/dynasty/DynastyScans.kt b/src/en/dynasty/src/eu/kanade/tachiyomi/extension/en/dynasty/DynastyScans.kt index 26aece566..598b445da 100644 --- a/src/en/dynasty/src/eu/kanade/tachiyomi/extension/en/dynasty/DynastyScans.kt +++ b/src/en/dynasty/src/eu/kanade/tachiyomi/extension/en/dynasty/DynastyScans.kt @@ -3,6 +3,7 @@ package eu.kanade.tachiyomi.extension.en.dynasty import android.net.Uri 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 @@ -14,6 +15,7 @@ import kotlinx.serialization.json.Json import kotlinx.serialization.json.jsonArray import kotlinx.serialization.json.jsonObject import kotlinx.serialization.json.jsonPrimitive +import okhttp3.HttpUrl.Companion.toHttpUrl import okhttp3.Request import okhttp3.Response import org.jsoup.nodes.Document @@ -26,11 +28,16 @@ import uy.kohesive.injekt.injectLazy import java.text.SimpleDateFormat import java.util.ArrayList import java.util.Locale +import java.util.concurrent.TimeUnit abstract class DynastyScans : ParsedHttpSource() { override val baseUrl = "https://dynasty-scans.com" + override val client = network.cloudflareClient.newBuilder() + .rateLimitHost(baseUrl.toHttpUrl(), 1, 1, TimeUnit.SECONDS) + .build() + abstract fun popularMangaInitialUrl(): String override val lang = "en"