feat: allow active update downloads to be canceled

Keep the dialog cancel action available during update downloads, abort the active network stream, and surface a clean canceled state with retry support. Normalize cancellation across updater, main process, renderer, and translations with regression coverage.
This commit is contained in:
Sucukdeluxe
2026-08-20 23:57:54 +02:00
parent bbdfc37fdc
commit 577e1dd9c9
7 changed files with 136 additions and 26 deletions
+6 -6
View File
@@ -359,9 +359,10 @@ async function prepareUpdate(onProgress, options = {}) {
return prepared;
} catch (err) {
const failure = signal.aborted ? new Error('Update abgebrochen') : err;
if (stagedInstallerPath) fs.rmSync(stagedInstallerPath, { force: true });
if (onProgress) onProgress({ stage: 'error', error: err.message });
throw err;
if (onProgress) onProgress({ stage: signal.aborted ? 'aborted' : 'error', error: failure.message });
throw failure;
} finally {
activeAbort = null;
}
@@ -387,10 +388,9 @@ function launchPreparedUpdate(prepared, options = {}) {
}
function abortUpdate() {
if (activeAbort) {
activeAbort.abort();
activeAbort = null;
}
if (!activeAbort) return false;
activeAbort.abort();
return true;
}
module.exports = { checkForUpdate, fetchGithubReleaseNotes, prepareUpdate, launchPreparedUpdate, abortUpdate, isNewer, resolveReleaseVersion, pickSetupAsset, parseLatestYml, createUpdateAnnouncementState };