修复在有nhentai账号的情况下,验证cf时cookie 同步失败导致无限循环的bug#273
Open
FC383 wants to merge 2 commits into
Open
Conversation
上个修改:如果cf cookie过期,则会退出 ###修复方案 一处 — Desktop onTitleChange 将「JS 查 DOM 元素判断成功」改为「先查 cookie 是否存在,再查页面是否为 CF 挑战页」: getCookies 检查 cf_clearance 是否存在 evaluateJavascript 检查 typeof _cf_chl_opt !== 'undefined' 确认不在挑战页 两项都通过 → 保存 cookie + 关闭 WebView + 触发重试 二处 — Mobile onTitleChange 同上,JS 返回值类型适配为 Dart bool。 三处 — Mobile onStarted 回归为仅保存 UA。cookie 检测逻辑统一放在 onTitleChange 中处理,避免 onStarted 阶段页面未渲染导致 _cf_chl_opt 检查不可靠。
Author
|
等cookie过期后再测试一次 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
##问题
nhentai 触发 CF 验证时,用户点击「继续」进入 WebView 后,自动弹出.
##根因
passCloudflare() 中检测 CF 验证成功的机制有两层缺陷:
##修复
将检测机制从脆弱的 DOM 元素改为 Cloudflare 标准 cookie cf_clearance,该 cookie 在 CF 验证通过后持久存在于 WebView 的 cookie store 中。
选择 cf_clearance 作为检测目标的理由:它是 Cloudflare 标准验证 cookie,验证通过后跨页面持久存在,不受页面重定向影响,且二次进入 WebView 时可直接命中。