From df82d0811bc23cfba1689e2494e782dc2b40a5d0 Mon Sep 17 00:00:00 2001 From: Abdullah Atta Date: Thu, 14 May 2026 13:07:11 +0500 Subject: [PATCH] desktop: disable auto updates for flatpak/snap/portable apps --- apps/desktop/src/api/updater.ts | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/apps/desktop/src/api/updater.ts b/apps/desktop/src/api/updater.ts index a84628503..3349ad7e1 100644 --- a/apps/desktop/src/api/updater.ts +++ b/apps/desktop/src/api/updater.ts @@ -24,6 +24,7 @@ import type { AppUpdaterEvents } from "electron-updater/out/AppUpdater"; import { z } from "zod"; import { config } from "../utils/config"; import { app } from "electron"; +import { isFlatpak, isPortable, isSnap } from "../utils"; type UpdateInfo = { version: string }; type Progress = { percent: number }; @@ -31,13 +32,15 @@ type Progress = { percent: number }; const t = initTRPC.create(); let cancellationToken: CancellationToken | undefined = undefined; let downloadTimeout: NodeJS.Timeout | undefined = undefined; - +const updatesSupported = !isFlatpak() && !isSnap() && !isPortable(); export const updaterRouter = t.router({ - autoUpdates: t.procedure.query(() => config.automaticUpdates), + autoUpdates: t.procedure.query( + () => updatesSupported && config.automaticUpdates + ), releaseTrack: t.procedure.query(() => config.releaseTrack), install: t.procedure.query(() => autoUpdater.quitAndInstall()), download: t.procedure.query(async () => { - if (cancellationToken) return; + if (!updatesSupported || cancellationToken) return; clearTimeout(downloadTimeout); await new Promise((resolve, reject) => { downloadTimeout = setTimeout(async () => { @@ -52,7 +55,7 @@ export const updaterRouter = t.router({ }); }), check: t.procedure.query(async () => { - if (cancellationToken) return; + if (!updatesSupported || cancellationToken) return; clearTimeout(downloadTimeout); await new Promise((resolve) => { downloadTimeout = setTimeout(async () => {