This commit is contained in:
QLHazyCoder
2026-04-14 01:52:51 +08:00
3 changed files with 450 additions and 54 deletions
+5 -4
View File
@@ -199,15 +199,16 @@
</div>
</div>
<div class="data-row">
<span class="data-label">兜底</span>
<span class="data-label">自动重试</span>
<div class="data-inline fallback-inline">
<label class="toggle-switch" for="input-auto-skip-failures">
<input type="checkbox" id="input-auto-skip-failures" />
<label class="toggle-switch" for="input-auto-skip-failures" title="Auto retry restarts the current round from step 1 after a step failure.">
<input type="checkbox" id="input-auto-skip-failures" checked />
<span class="toggle-switch-track" aria-hidden="true">
<span class="toggle-switch-thumb"></span>
</span>
</label>
<div class="fallback-thread-interval">
<span class="auto-delay-caption">Retry the current round from step 1 after a short delay.</span>
<div class="fallback-thread-interval" style="display:none;">
<span class="auto-delay-caption">线程间隔</span>
<div class="auto-delay-controls">
<input type="number" id="input-auto-skip-failures-thread-interval-minutes" class="data-input auto-delay-input" value="0"
+7 -40
View File
@@ -671,8 +671,7 @@ function updateFallbackThreadIntervalInputState() {
return;
}
const enabled = inputAutoSkipFailures.checked && getRunCountValue() > 1;
inputAutoSkipFailuresThreadIntervalMinutes.disabled = !enabled;
inputAutoSkipFailuresThreadIntervalMinutes.disabled = true;
}
function updateAutoDelayInputState() {
@@ -846,7 +845,7 @@ function collectSettingsPayload() {
hotmailLocalBaseUrl: inputHotmailLocalBaseUrl.value.trim(),
cloudflareDomain: selectedCloudflareDomain,
cloudflareDomains: domains,
autoRunSkipFailures: inputAutoSkipFailures.checked,
autoRunSkipFailures: true,
autoRunFallbackThreadIntervalMinutes: normalizeAutoRunThreadIntervalMinutes(inputAutoSkipFailuresThreadIntervalMinutes.value),
autoRunDelayEnabled: inputAutoDelayEnabled.checked,
autoRunDelayMinutes: normalizeAutoDelayMinutes(inputAutoDelayMinutes.value),
@@ -1018,7 +1017,7 @@ function applyAutoRunStatus(payload = currentAutoRun) {
|| usesGeneratedAliasMailProvider(selectMailProvider.value)
|| isCustomEmailGeneratorSelected();
inputEmail.disabled = locked;
inputAutoSkipFailures.disabled = scheduled;
inputAutoSkipFailures.disabled = true;
if (currentAutoRun.totalRuns > 0) {
inputRunCount.value = String(currentAutoRun.totalRuns);
@@ -1122,7 +1121,7 @@ function applySettingsState(state) {
inputHotmailLocalBaseUrl.value = state?.hotmailLocalBaseUrl || '';
renderCloudflareDomainOptions(state?.cloudflareDomain || '');
setCloudflareDomainEditMode(false, { clearInput: true });
inputAutoSkipFailures.checked = Boolean(state?.autoRunSkipFailures);
inputAutoSkipFailures.checked = true;
inputAutoSkipFailuresThreadIntervalMinutes.value = String(normalizeAutoRunThreadIntervalMinutes(state?.autoRunFallbackThreadIntervalMinutes));
inputAutoDelayEnabled.checked = Boolean(state?.autoRunDelayEnabled);
inputAutoDelayMinutes.value = String(normalizeAutoDelayMinutes(state?.autoRunDelayMinutes));
@@ -2674,25 +2673,6 @@ btnAutoRun.addEventListener('click', async () => {
mode = choice;
}
const autoRunSkipFailures = inputAutoSkipFailures.checked;
const fallbackThreadIntervalMinutes = normalizeAutoRunThreadIntervalMinutes(
inputAutoSkipFailuresThreadIntervalMinutes.value
);
inputAutoSkipFailuresThreadIntervalMinutes.value = String(fallbackThreadIntervalMinutes);
if (
shouldWarnAutoRunFallbackRisk(totalRuns, autoRunSkipFailures)
&& !isAutoRunFallbackRiskPromptDismissed()
) {
const result = await openAutoRunFallbackRiskConfirmModal(totalRuns, fallbackThreadIntervalMinutes);
if (!result.confirmed) {
return;
}
if (result.dismissPrompt) {
setAutoRunFallbackRiskPromptDismissed(true);
}
}
btnAutoRun.disabled = true;
inputRunCount.disabled = true;
const delayEnabled = inputAutoDelayEnabled.checked;
@@ -2707,7 +2687,7 @@ btnAutoRun.addEventListener('click', async () => {
payload: {
totalRuns,
delayMinutes,
autoRunSkipFailures,
autoRunSkipFailures: true,
mode,
},
});
@@ -2990,21 +2970,8 @@ inputRunCount.addEventListener('blur', () => {
});
inputAutoSkipFailures.addEventListener('change', async () => {
if (inputAutoSkipFailures.checked && !isAutoSkipFailuresPromptDismissed()) {
const result = await openAutoSkipFailuresConfirmModal();
if (!result.confirmed) {
inputAutoSkipFailures.checked = false;
updateFallbackThreadIntervalInputState();
return;
}
if (result.dismissPrompt) {
setAutoSkipFailuresPromptDismissed(true);
}
}
inputAutoSkipFailures.checked = true;
updateFallbackThreadIntervalInputState();
markSettingsDirty(true);
saveSettings({ silent: true }).catch(() => { });
});
inputAutoSkipFailuresThreadIntervalMinutes.addEventListener('input', () => {
@@ -3137,7 +3104,7 @@ chrome.runtime.onMessage.addListener((message) => {
}
}
if (message.payload.autoRunSkipFailures !== undefined) {
inputAutoSkipFailures.checked = Boolean(message.payload.autoRunSkipFailures);
inputAutoSkipFailures.checked = true;
updateFallbackThreadIntervalInputState();
}
if (message.payload.autoRunDelayEnabled !== undefined) {