feat: 增强错误处理逻辑,添加 Cloudflare 风控和网络超时拦截提示

This commit is contained in:
QLHazyCoder
2026-04-18 20:54:00 +08:00
parent 82471af931
commit 609cdeaeb5
12 changed files with 440 additions and 17 deletions
+17 -1
View File
@@ -65,8 +65,10 @@
const detailMatched = detailPattern instanceof RegExp
? detailPattern.test(text)
: false;
const maxCheckAttemptsBlocked = /max_check_attempts/i.test(text);
const operationTimedOutBlocked = /operation\s+timed\s+out/i.test(text);
if (!titleMatched && !detailMatched) {
if (!titleMatched && !detailMatched && !maxCheckAttemptsBlocked && !operationTimedOutBlocked) {
return null;
}
@@ -77,6 +79,8 @@
retryEnabled: isActionEnabled(retryButton),
titleMatched,
detailMatched,
maxCheckAttemptsBlocked,
operationTimedOutBlocked,
};
}
@@ -136,6 +140,18 @@
};
}
if (retryState.maxCheckAttemptsBlocked) {
throw new Error(
'CF_SECURITY_BLOCKED::您已触发Cloudflare 安全防护系统,已完全停止流程,请不要短时间内多次进行重新发送验证码,连续刷新、反复点击重试会加重风控;请先关闭页面等待 15-30 分钟,让系统的临时限制自动解除。或者更换浏览器'
);
}
if (retryState.operationTimedOutBlocked) {
throw new Error(
'NETWORK_TIMEOUT_BLOCKED::请检查当前网络节点是否稳定,若你使用的代理 / /VPN 节点无延迟过高问题,请换一个服务器继续使用此邮箱继续登陆'
);
}
if (retryState.retryButton && retryState.retryEnabled) {
clickCount += 1;
if (typeof log === 'function') {