fix: stop GPC flow on no-trial logs

This commit is contained in:
QLHazyCoder
2026-05-30 02:35:07 +08:00
parent 0afa951814
commit 8c2cb2f8e0
2 changed files with 38 additions and 0 deletions
@@ -289,6 +289,18 @@
return summary ? ` 最近日志:${summary}` : '';
}
function hasGpcNoTrialFailure(pageState = {}) {
if (pageState.noTrial) {
return true;
}
const text = normalizeText([
pageState.lastLogLine,
pageState.logText,
pageState.bodyText,
].filter(Boolean).join(' '));
return /(?:该|此|当前)?账[户号].{0,12}(?:没有|无|不具备).{0,8}试用资格|(?:没有|无|不具备).{0,8}试用资格/.test(text);
}
async function ensureGpcCardMode(tabId) {
if (!chrome?.scripting?.executeScript) {
throw new Error('步骤 7:当前运行环境不支持脚本注入,无法切换 GPC 卡密充值模式。');
@@ -485,6 +497,7 @@
while (Date.now() <= deadline) {
throwIfStopped();
const pageState = await inspectGpcPortalPage(tabId);
pageState.noTrial = hasGpcNoTrialFailure(pageState);
const buttonText = normalizeText(pageState.startButtonText);
await collectStatusLog(pageState, buttonText);