Fix temporary blocking for a source and add a message. (#7437)

This commit is contained in:
Alessandro Jean 2021-06-03 21:27:11 -03:00 committed by GitHub
parent 5295e43d68
commit 74b8b601c5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 2 deletions

View File

@ -2,7 +2,9 @@ package eu.kanade.tachiyomi.extension.pt.ichirinnohanayuri
import eu.kanade.tachiyomi.lib.ratelimit.RateLimitInterceptor import eu.kanade.tachiyomi.lib.ratelimit.RateLimitInterceptor
import eu.kanade.tachiyomi.multisrc.madara.Madara import eu.kanade.tachiyomi.multisrc.madara.Madara
import okhttp3.Headers
import okhttp3.OkHttpClient import okhttp3.OkHttpClient
import java.io.IOException
import java.text.SimpleDateFormat import java.text.SimpleDateFormat
import java.util.Locale import java.util.Locale
import java.util.concurrent.TimeUnit import java.util.concurrent.TimeUnit
@ -15,6 +17,23 @@ class IchirinNoHanaYuri : Madara(
) { ) {
override val client: OkHttpClient = super.client.newBuilder() override val client: OkHttpClient = super.client.newBuilder()
.addInterceptor(RateLimitInterceptor(1, 1, TimeUnit.SECONDS)) .addInterceptor(RateLimitInterceptor(1, 2, TimeUnit.SECONDS))
.addInterceptor { chain ->
val response = chain.proceed(chain.request())
if (response.code == 403) {
response.close()
throw IOException(BLOCKING_MESSAGE)
}
response
}
.build() .build()
override fun headersBuilder(): Headers.Builder = Headers.Builder()
companion object {
private const val BLOCKING_MESSAGE = "O site está bloqueando o Tachiyomi. " +
"Migre para outra fonte caso o problema persistir."
}
} }

View File

@ -75,7 +75,7 @@ class MadaraGenerator : ThemeSourceGenerator {
SingleLang("Hiperdex", "https://hiperdex.com", "en", isNsfw = true, overrideVersionCode = 1), SingleLang("Hiperdex", "https://hiperdex.com", "en", isNsfw = true, overrideVersionCode = 1),
SingleLang("Hscans", "https://hscans.com", "en", overrideVersionCode = 1), SingleLang("Hscans", "https://hscans.com", "en", overrideVersionCode = 1),
SingleLang("Hunter Fansub", "https://hunterfansub.com", "es"), SingleLang("Hunter Fansub", "https://hunterfansub.com", "es"),
SingleLang("Ichirin No Hana Yuri", "https://ichirinnohanayuri.com.br", "pt-BR", overrideVersionCode = 1), SingleLang("Ichirin No Hana Yuri", "https://ichirinnohanayuri.com.br", "pt-BR", overrideVersionCode = 2),
SingleLang("Immortal Updates", "https://immortalupdates.com", "en", overrideVersionCode = 1), SingleLang("Immortal Updates", "https://immortalupdates.com", "en", overrideVersionCode = 1),
SingleLang("Império dos Otakus", "https://imperiodosotakus.tk", "pt-BR", className = "ImperioDosOtakus"), SingleLang("Império dos Otakus", "https://imperiodosotakus.tk", "pt-BR", className = "ImperioDosOtakus"),
SingleLang("IsekaiScan.com", "https://isekaiscan.com", "en", className = "IsekaiScanCom", overrideVersionCode = 2), SingleLang("IsekaiScan.com", "https://isekaiscan.com", "en", className = "IsekaiScanCom", overrideVersionCode = 2),