Fix temporary blocking for a source and add a message. (#7437)
This commit is contained in:
parent
5295e43d68
commit
74b8b601c5
|
@ -2,7 +2,9 @@ package eu.kanade.tachiyomi.extension.pt.ichirinnohanayuri
|
|||
|
||||
import eu.kanade.tachiyomi.lib.ratelimit.RateLimitInterceptor
|
||||
import eu.kanade.tachiyomi.multisrc.madara.Madara
|
||||
import okhttp3.Headers
|
||||
import okhttp3.OkHttpClient
|
||||
import java.io.IOException
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.Locale
|
||||
import java.util.concurrent.TimeUnit
|
||||
|
@ -15,6 +17,23 @@ class IchirinNoHanaYuri : Madara(
|
|||
) {
|
||||
|
||||
override val client: OkHttpClient = super.client.newBuilder()
|
||||
.addInterceptor(RateLimitInterceptor(1, 1, TimeUnit.SECONDS))
|
||||
.build()
|
||||
.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()
|
||||
|
||||
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."
|
||||
}
|
||||
}
|
||||
|
|
|
@ -75,7 +75,7 @@ class MadaraGenerator : ThemeSourceGenerator {
|
|||
SingleLang("Hiperdex", "https://hiperdex.com", "en", isNsfw = true, overrideVersionCode = 1),
|
||||
SingleLang("Hscans", "https://hscans.com", "en", overrideVersionCode = 1),
|
||||
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("Império dos Otakus", "https://imperiodosotakus.tk", "pt-BR", className = "ImperioDosOtakus"),
|
||||
SingleLang("IsekaiScan.com", "https://isekaiscan.com", "en", className = "IsekaiScanCom", overrideVersionCode = 2),
|
||||
|
|
Loading…
Reference in New Issue