fix: 支持 Step 9 CPA 成功状态的多语言识别
- 合并 PR #81 的核心改动:将 Step 9 的成功状态识别从单一中文扩展为中文、英文、俄文白名单,并修正一处 background 日志乱码\n- 本地补充修复:无额外代码修复\n- 影响范围:Step 9 的 CPA 状态判定、诊断文案与 background 日志输出
This commit is contained in:
+1
-1
@@ -8256,7 +8256,7 @@ async function executeCpaStep9(state) {
|
||||
inject: injectFiles,
|
||||
timeoutMs: 45000,
|
||||
retryDelayMs: 900,
|
||||
logMessage: '姝ラ 9锛欳PA 闈㈡澘浠嶅湪鍔犺浇锛屾鍦ㄩ噸璇曡繛鎺ュ唴瀹硅剼鏈?..',
|
||||
logMessage: '步骤 9:CPA 面板仍在加载,正在重试连接...',
|
||||
});
|
||||
|
||||
await addLog('步骤 9:正在填写回调地址...');
|
||||
|
||||
+24
-5
@@ -232,13 +232,32 @@ function summarizeStatusBadgeEntries(entries) {
|
||||
.join(' | ');
|
||||
}
|
||||
|
||||
const STEP9_SUCCESS_STATUSES = new Set([
|
||||
'Authentication successful!',
|
||||
'Аутентификация успешна!',
|
||||
'认证成功!',
|
||||
]);
|
||||
|
||||
function normalizeStep9StatusText(statusText) {
|
||||
return String(statusText || '').replace(/\s+/g, ' ').trim();
|
||||
}
|
||||
|
||||
function isStep9SuccessStatus(statusText) {
|
||||
return STEP9_SUCCESS_STATUSES.has(normalizeStep9StatusText(statusText));
|
||||
}
|
||||
|
||||
function isStep9SuccessLikeStatus(statusText) {
|
||||
const text = normalizeStep9StatusText(statusText);
|
||||
return /authentication successful|аутентификац.*успеш|认证成功/i.test(text);
|
||||
}
|
||||
|
||||
function getStatusBadgeDiagnostics() {
|
||||
const entries = getStatusBadgeEntries();
|
||||
const visibleEntries = entries.filter((entry) => entry.visible);
|
||||
const selectedEntry = visibleEntries[0] || null;
|
||||
const selectedText = selectedEntry?.text || '';
|
||||
const successLikeEntries = visibleEntries.filter((entry) => /认证成功/.test(entry.text || ''));
|
||||
const exactSuccessEntries = visibleEntries.filter((entry) => entry.text === '认证成功!');
|
||||
const successLikeEntries = visibleEntries.filter((entry) => isStep9SuccessLikeStatus(entry.text));
|
||||
const exactSuccessEntries = visibleEntries.filter((entry) => isStep9SuccessStatus(entry.text));
|
||||
const visibleSummary = summarizeStatusBadgeEntries(visibleEntries);
|
||||
const pageSnippet = getPageTextSnippet();
|
||||
|
||||
@@ -322,7 +341,7 @@ async function waitForExactSuccessBadge(timeout = STEP9_SUCCESS_BADGE_TIMEOUT_MS
|
||||
if (typeof isRecoverableStep9AuthFailure === 'function' && isRecoverableStep9AuthFailure(statusText)) {
|
||||
throw new Error(`STEP9_OAUTH_RETRY::${statusText}`);
|
||||
}
|
||||
if (statusText === '认证成功!') {
|
||||
if (isStep9SuccessStatus(statusText)) {
|
||||
return statusText;
|
||||
}
|
||||
await sleep(200);
|
||||
@@ -338,8 +357,8 @@ async function waitForExactSuccessBadge(timeout = STEP9_SUCCESS_BADGE_TIMEOUT_MS
|
||||
throw new Error(`STEP9_OAUTH_RETRY::${finalText}${diagnosticsSuffix}`);
|
||||
}
|
||||
throw new Error(finalText
|
||||
? `CPA 面板状态不是“认证成功!”,当前为“${finalText}”。${diagnosticsSuffix}`
|
||||
: `CPA 面板长时间未出现“认证成功!”状态徽标。${diagnosticsSuffix}`);
|
||||
? `CPA 面板状态未进入成功状态,当前为“${finalText}”。${diagnosticsSuffix}`
|
||||
: `CPA 面板长时间未出现成功状态徽标。${diagnosticsSuffix}`);
|
||||
}
|
||||
|
||||
function findManagementKeyInput() {
|
||||
|
||||
Reference in New Issue
Block a user