A fully open source & end-to-end encrypted note taking alternative to Evernote.
TypeScript asp-net-coredotnet-coreelectronfosshacktoberfestnote-managmentnote-takingnote-taking-appnotebooknotesnotes-appopen-sourceopensourceprivacyproductivityreactreact-nativereactjsself-hosted
desktop: prevent downloading multiple updates
Abdullah Atta72a09f48e00a
diff --git a/apps/desktop/src/api/updater.ts b/apps/desktop/src/api/updater.tsindex 1a3238eef..405318293 100644--- a/apps/desktop/src/api/updater.ts+++ b/apps/desktop/src/api/updater.ts@@ -28,13 +28,17 @@ type UpdateInfo = { version: string };type Progress = { percent: number };const t = initTRPC.create();+let cancellationToken: CancellationToken | undefined = undefined;export const updaterRouter = t.router({autoUpdates: t.procedure.query(() => config.automaticUpdates),install: t.procedure.query(() => autoUpdater.quitAndInstall()),download: t.procedure.query(async () => {- const cancellationToken = new CancellationToken();- await autoUpdater.downloadUpdate(cancellationToken);+ if (cancellationToken) return;+ cancellationToken = new CancellationToken();+ await autoUpdater+ .downloadUpdate(cancellationToken)+ .finally(() => (cancellationToken = undefined));}),check: t.procedure.query(async () => {await autoUpdater.checkForUpdates();