DemonSect: Add interceptor (#3326)

* Add an interceptor to show a message about login

* Use pathSegments
This commit is contained in:
Chopper 2024-06-02 03:47:27 -03:00 committed by GitHub
parent 56b372eeb8
commit 2bc4550143
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 10 additions and 1 deletions

View File

@ -3,7 +3,7 @@ ext {
extClass = '.DemonSect'
themePkg = 'madara'
baseUrl = 'https://dsectcomics.org'
overrideVersionCode = 6
overrideVersionCode = 7
}
apply from: "$rootDir/common.gradle"

View File

@ -5,6 +5,7 @@ import eu.kanade.tachiyomi.network.asObservable
import eu.kanade.tachiyomi.network.interceptor.rateLimit
import eu.kanade.tachiyomi.source.model.MangasPage
import okhttp3.OkHttpClient
import okio.IOException
import rx.Observable
import java.text.SimpleDateFormat
import java.util.Locale
@ -21,6 +22,14 @@ class DemonSect : Madara(
override val id: Long = 8168108118738519332
override val client: OkHttpClient = super.client.newBuilder()
.addInterceptor { chain ->
val response = chain.proceed(chain.request())
val pathSegments = response.request.url.pathSegments
if (pathSegments.contains("login")) {
throw IOException("Faça o login na WebView para acessar o contéudo")
}
response
}
.rateLimit(1, 2, TimeUnit.SECONDS)
.build()