refactor: 移除网络超时相关逻辑,简化错误处理
This commit is contained in:
@@ -66,9 +66,8 @@
|
||||
? 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 && !maxCheckAttemptsBlocked && !operationTimedOutBlocked) {
|
||||
if (!titleMatched && !detailMatched && !maxCheckAttemptsBlocked) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -80,7 +79,6 @@
|
||||
titleMatched,
|
||||
detailMatched,
|
||||
maxCheckAttemptsBlocked,
|
||||
operationTimedOutBlocked,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -146,12 +144,6 @@
|
||||
);
|
||||
}
|
||||
|
||||
if (retryState.operationTimedOutBlocked) {
|
||||
throw new Error(
|
||||
'NETWORK_TIMEOUT_BLOCKED::请检查当前网络节点是否稳定,若你使用的代理 /VPN 节点无延迟过高问题,请换一个服务器继续使用此邮箱继续登陆'
|
||||
);
|
||||
}
|
||||
|
||||
if (retryState.retryButton && retryState.retryEnabled) {
|
||||
clickCount += 1;
|
||||
if (typeof log === 'function') {
|
||||
|
||||
+2
-11
@@ -937,9 +937,8 @@ function getAuthTimeoutErrorPageState(options = {}) {
|
||||
|| AUTH_TIMEOUT_ERROR_TITLE_PATTERN.test(document.title || '');
|
||||
const detailMatched = AUTH_TIMEOUT_ERROR_DETAIL_PATTERN.test(text);
|
||||
const maxCheckAttemptsBlocked = /max_check_attempts/i.test(text);
|
||||
const operationTimedOutBlocked = /operation\s+timed\s+out/i.test(text);
|
||||
|
||||
if (!titleMatched && !detailMatched && !maxCheckAttemptsBlocked && !operationTimedOutBlocked) {
|
||||
if (!titleMatched && !detailMatched && !maxCheckAttemptsBlocked) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -951,7 +950,6 @@ function getAuthTimeoutErrorPageState(options = {}) {
|
||||
titleMatched,
|
||||
detailMatched,
|
||||
maxCheckAttemptsBlocked,
|
||||
operationTimedOutBlocked,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1007,10 +1005,6 @@ async function recoverCurrentAuthRetryPage(payload = {}) {
|
||||
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;
|
||||
log(`${logLabel || `步骤 ${step || '?'}:检测到重试页,正在点击“重试”恢复`}(第 ${clickCount} 次)...`, 'warn');
|
||||
@@ -1099,7 +1093,6 @@ function inspectLoginAuthState() {
|
||||
titleMatched: Boolean(retryState?.titleMatched),
|
||||
detailMatched: Boolean(retryState?.detailMatched),
|
||||
maxCheckAttemptsBlocked: Boolean(retryState?.maxCheckAttemptsBlocked),
|
||||
operationTimedOutBlocked: Boolean(retryState?.operationTimedOutBlocked),
|
||||
verificationTarget,
|
||||
passwordInput,
|
||||
emailInput,
|
||||
@@ -1166,7 +1159,6 @@ function serializeLoginAuthState(snapshot) {
|
||||
titleMatched: Boolean(snapshot?.titleMatched),
|
||||
detailMatched: Boolean(snapshot?.detailMatched),
|
||||
maxCheckAttemptsBlocked: Boolean(snapshot?.maxCheckAttemptsBlocked),
|
||||
operationTimedOutBlocked: Boolean(snapshot?.operationTimedOutBlocked),
|
||||
hasVerificationTarget: Boolean(snapshot?.verificationTarget),
|
||||
hasPasswordInput: Boolean(snapshot?.passwordInput),
|
||||
hasEmailInput: Boolean(snapshot?.emailInput),
|
||||
@@ -1271,7 +1263,7 @@ async function createStep6LoginTimeoutRecoverableResult(reason, snapshot, messag
|
||||
log('步骤 7:登录超时报错页已点击“重试”,准备重新执行当前步骤。', 'warn');
|
||||
}
|
||||
} catch (error) {
|
||||
if (/(?:CF_SECURITY_BLOCKED|NETWORK_TIMEOUT_BLOCKED)::/i.test(String(error?.message || error || ''))) {
|
||||
if (/CF_SECURITY_BLOCKED::/i.test(String(error?.message || error || ''))) {
|
||||
throw error;
|
||||
}
|
||||
log(`步骤 7:登录超时报错页自动点击“重试”失败:${error.message}`, 'warn');
|
||||
@@ -1985,7 +1977,6 @@ function getStep8State() {
|
||||
retryTitleMatched: Boolean(retryState?.titleMatched),
|
||||
retryDetailMatched: Boolean(retryState?.detailMatched),
|
||||
maxCheckAttemptsBlocked: Boolean(retryState?.maxCheckAttemptsBlocked),
|
||||
operationTimedOutBlocked: Boolean(retryState?.operationTimedOutBlocked),
|
||||
buttonFound: Boolean(continueBtn),
|
||||
buttonEnabled: isButtonEnabled(continueBtn),
|
||||
buttonText: continueBtn ? getActionText(continueBtn) : '',
|
||||
|
||||
Reference in New Issue
Block a user