[RU]Hentailib: Crashing Tachiyomi (#11759)

This commit is contained in:
Ejan 2022-05-06 22:17:01 +05:00 committed by GitHub
parent b798f17039
commit cd8eda18db
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View File

@ -6,7 +6,7 @@ ext {
extName = 'HentaiLib'
pkgNameSuffix = 'ru.libhentai'
extClass = '.LibHentai'
extVersionCode = 15
extVersionCode = 16
isNsfw = true
}

View File

@ -42,6 +42,7 @@ import rx.Observable
import uy.kohesive.injekt.Injekt
import uy.kohesive.injekt.api.get
import uy.kohesive.injekt.injectLazy
import java.io.IOException
import java.text.SimpleDateFormat
import java.util.Locale
import java.util.concurrent.TimeUnit
@ -80,7 +81,6 @@ class LibHentai : ConfigurableSource, HttpSource() {
} else
response
}
private val authClient = network.cloudflareClient
override val client: OkHttpClient = network.cloudflareClient.newBuilder()
.connectTimeout(10, TimeUnit.SECONDS)
@ -90,10 +90,10 @@ class LibHentai : ConfigurableSource, HttpSource() {
.addInterceptor { chain ->
val originalRequest = chain.request()
if (originalRequest.url.toString().contains(baseUrl))
if (!authClient.newCall(GET(baseUrl, headers))
if (!network.cloudflareClient.newCall(GET(baseUrl, headers))
.execute().body!!.string().contains("m-menu__user-info")
)
throw Exception("Для просмотра 18+ контента необходима авторизация через WebView")
throw IOException("Для просмотра 18+ контента необходима авторизация через WebView")
return@addInterceptor chain.proceed(originalRequest)
}
.build()