Fix blank page on cloudflare guard
(cherry picked from commit 07599ade3aeb127f643b45e84a6b9ccdb1d0ba6d) Co-authored-by: Cuong-Tran <16017808+cuong-tran@users.noreply.github.com>
This commit is contained in:
parent
f5e1c1e5ce
commit
3344fd0755
1 changed files with 23 additions and 7 deletions
|
|
@ -93,15 +93,31 @@ class EhLoginActivity : BaseActivity() {
|
|||
xLogD(url)
|
||||
val parsedUrl = url.toUri()
|
||||
if (parsedUrl.host.equals("forums.e-hentai.org", ignoreCase = true)) {
|
||||
view.evaluateJavascript(
|
||||
"""
|
||||
(function() {
|
||||
let html = document.documentElement.innerHTML;
|
||||
return html.includes("/cdn-cgi/");
|
||||
})();
|
||||
""".trimIndent(),
|
||||
) { result ->
|
||||
val isCloudflareBlock = result == "true"
|
||||
|
||||
if (isCloudflareBlock) {
|
||||
xLogD("Cloudflare block detected — skipping logic")
|
||||
return@evaluateJavascript
|
||||
}
|
||||
|
||||
// Hide distracting content
|
||||
if (!parsedUrl.queryParameterNames.contains(PARAM_SKIP_INJECT)) {
|
||||
view.evaluateJavascript(HIDE_JS, null)
|
||||
}
|
||||
// Check login result
|
||||
|
||||
if (parsedUrl.getQueryParameter("code")?.toInt() != 0) {
|
||||
if (parsedUrl.getQueryParameter("code")?.toIntOrNull() != 0) {
|
||||
if (checkLoginCookies(url)) view.loadUrl("https://exhentai.org/")
|
||||
}
|
||||
}
|
||||
} else if (parsedUrl.host.equals("exhentai.org", ignoreCase = true)) {
|
||||
// At ExHentai, check that everything worked out...
|
||||
if (applyExHentaiCookies(url, customIgneous)) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue