fix(pause): F8 resume after manual popup close was stuck waiting 30s

Repro: auto-mode -> F8 pause -> manually close invalid popup -> F8 resume
-> stuck in WAITING for full timeout. Root cause: tick returns immediately
while paused, so taskClickTime stays frozen at the pre-pause click; on resume
elapsed includes pause duration. Worse, the manually-closed popup is gone,
so findRLModal/isPayDialog return null and WAITING has no branch to detect
'the popup I was waiting for is gone' -> falls through to the timeout tail.

Fix in setRuntimePaused(resume): if currently WAITING, reset taskClickTime to
now (re-count elapsed from resume); if no popup present anymore (closed during
pause), drop straight to IDLE to retry instead of waiting out the timeout.
Explains why not-closing-the-popup was fine (popup still detectable on resume).
This commit is contained in:
OLmatter
2026-06-23 05:11:36 +08:00
parent cfa8306c62
commit 5023168f46
+12
View File
@@ -753,6 +753,18 @@
if (runtimePaused) {
setBar(`⏸️ 脚本已暂停(${source})。${pauseHotkey()} 恢复。`, '#722ed1');
} else {
// 恢复时:如果正在 WAITING,重置 taskClickTime(让超时从恢复时刻重新算,
// 避免暂停期间 elapsed 虚高导致误超时);如果 WAITING 但弹窗已不在
// (暂停期间被手动关了),直接回 IDLE 重试,避免干等到超时。
if (state === 'TASK_UNIT' && taskPhase === 'WAITING') {
taskClickTime = Date.now();
const hasModal = findRLModal() || isPayDialog() || isSuccessDialog();
if (!hasModal) {
taskPhase = 'IDLE';
setBar(`▶️ 脚本已恢复(${source}),弹窗已关,重试点订阅。`, '#237804');
return;
}
}
setBar(`▶️ 脚本已恢复(${source})。`, '#237804');
}
}