From 28c151d109230a6b84c2246dc42458b86a332dd5 Mon Sep 17 00:00:00 2001 From: QLHazyCoder <2825305047@qq.com> Date: Sat, 11 Apr 2026 20:05:32 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E9=82=AE=E4=BB=B6?= =?UTF-8?q?=E6=B8=85=E7=90=86=E8=B0=83=E5=BA=A6=E5=8A=9F=E8=83=BD=EF=BC=8C?= =?UTF-8?q?=E4=BC=98=E5=8C=96=E9=82=AE=E4=BB=B6=E5=88=A0=E9=99=A4=E6=B5=81?= =?UTF-8?q?=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- content/mail-163.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/content/mail-163.js b/content/mail-163.js index 5455a5a..b5e5a46 100644 --- a/content/mail-163.js +++ b/content/mail-163.js @@ -145,6 +145,14 @@ function getMailTimestamp(item) { return null; } +function scheduleEmailCleanup(item, step) { + setTimeout(() => { + Promise.resolve(deleteEmail(item, step)).catch(() => { + // Cleanup is best effort only and must never affect the main verification flow. + }); + }, 0); +} + // ============================================================ // Email Polling // ============================================================ @@ -242,10 +250,8 @@ async function handlePollEmail(step, payload) { const timeLabel = mailTimestamp ? `,时间:${new Date(mailTimestamp).toLocaleString('zh-CN', { hour12: false })}` : ''; log(`步骤 ${step}:已找到验证码:${code}(来源:${source}${timeLabel},主题:${subject.slice(0, 40)})`, 'ok'); - // Delete this email via right-click menu, WAIT for it to finish before returning - await deleteEmail(item, step); - // Extra wait to ensure deletion is processed - await sleep(1000); + // Trigger cleanup only as a best-effort side effect. + scheduleEmailCleanup(item, step); return { ok: true, code, emailTimestamp: Date.now(), mailId: id }; } else if (code && seenCodes.has(code)) {