diff --git a/src/es/tumangaonline/build.gradle b/src/es/tumangaonline/build.gradle index d42ae1e86..94c860b34 100644 --- a/src/es/tumangaonline/build.gradle +++ b/src/es/tumangaonline/build.gradle @@ -5,8 +5,12 @@ ext { extName = 'TuMangaOnline' pkgNameSuffix = 'es.tumangaonline' extClass = '.TuMangaOnline' - extVersionCode = 29 + extVersionCode = 30 libVersion = '1.2' } +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 d30b22a77..ce3f6386c 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 @@ -4,6 +4,7 @@ import android.app.Application import android.content.SharedPreferences import android.support.v7.preference.ListPreference import android.support.v7.preference.PreferenceScreen +import eu.kanade.tachiyomi.lib.ratelimit.RateLimitInterceptor import eu.kanade.tachiyomi.network.GET import eu.kanade.tachiyomi.network.asObservableSuccess import eu.kanade.tachiyomi.source.ConfigurableSource @@ -17,6 +18,7 @@ import eu.kanade.tachiyomi.source.online.ParsedHttpSource import eu.kanade.tachiyomi.util.asJsoup import okhttp3.Headers import okhttp3.HttpUrl +import okhttp3.OkHttpClient import okhttp3.Request import okhttp3.Response import org.jsoup.nodes.Document @@ -39,6 +41,12 @@ class TuMangaOnline : ConfigurableSource, ParsedHttpSource() { private val userAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.132 Safari/537.36" + private val rateLimitInterceptor = RateLimitInterceptor(1) + + override val client: OkHttpClient = network.client.newBuilder() + .addNetworkInterceptor(rateLimitInterceptor) + .build() + override fun headersBuilder(): Headers.Builder { return Headers.Builder() .add("User-Agent", userAgent)