mirror of
https://github.com/mihonapp/mihon.git
synced 2025-06-26 02:57:50 +02:00
Show help banner when Cloudflare captcha page is shown in WebView
This commit is contained in:
@ -44,7 +44,7 @@ class CloudflareInterceptor(
|
||||
// Because OkHttp's enqueue only handles IOExceptions, wrap the exception so that
|
||||
// we don't crash the entire app
|
||||
catch (e: CloudflareBypassException) {
|
||||
throw IOException(context.getString(R.string.information_cloudflare_bypass_failure))
|
||||
throw IOException(context.getString(R.string.information_cloudflare_bypass_failure), e)
|
||||
} catch (e: Exception) {
|
||||
throw IOException(e)
|
||||
}
|
||||
|
@ -6,8 +6,10 @@ import android.content.pm.PackageManager
|
||||
import android.webkit.CookieManager
|
||||
import android.webkit.WebSettings
|
||||
import android.webkit.WebView
|
||||
import kotlinx.coroutines.suspendCancellableCoroutine
|
||||
import logcat.LogPriority
|
||||
import tachiyomi.core.util.system.logcat
|
||||
import kotlin.coroutines.resume
|
||||
|
||||
object WebViewUtil {
|
||||
const val SPOOF_PACKAGE_NAME = "org.chromium.chrome"
|
||||
@ -32,6 +34,10 @@ fun WebView.isOutdated(): Boolean {
|
||||
return getWebViewMajorVersion() < WebViewUtil.MINIMUM_WEBVIEW_VERSION
|
||||
}
|
||||
|
||||
suspend fun WebView.getHtml(): String = suspendCancellableCoroutine {
|
||||
evaluateJavascript("document.documentElement.outerHTML") { html -> it.resume(html) }
|
||||
}
|
||||
|
||||
@SuppressLint("SetJavaScriptEnabled")
|
||||
fun WebView.setDefaultSettings() {
|
||||
with(settings) {
|
||||
|
Reference in New Issue
Block a user