diff --git a/apps/web/src/common/desktop-bridge/index.desktop.ts b/apps/web/src/common/desktop-bridge/index.desktop.ts index 89bc30085..4da04a24c 100644 --- a/apps/web/src/common/desktop-bridge/index.desktop.ts +++ b/apps/web/src/common/desktop-bridge/index.desktop.ts @@ -24,6 +24,7 @@ import { AppEventManager, AppEvents } from "../app-events"; import { TaskScheduler } from "../../utils/task-scheduler"; import { checkForUpdate } from "../../utils/updater"; import { showToast } from "../../utils/toast"; +import { store as settingStore } from "../../stores/setting-store"; export const desktop = createTRPCProxyClient({ links: [ipcLink()] @@ -64,7 +65,7 @@ function attachListeners() { ); TaskScheduler.register("updateCheck", "0 0 */12 * * * *", () => { - checkForUpdate(); + checkForUpdate(settingStore.get().autoUpdates); }); } diff --git a/apps/web/src/hooks/use-auto-updater.ts b/apps/web/src/hooks/use-auto-updater.ts index 80b19b05e..1fd226183 100644 --- a/apps/web/src/hooks/use-auto-updater.ts +++ b/apps/web/src/hooks/use-auto-updater.ts @@ -18,11 +18,11 @@ along with this program. If not, see . */ import { useEffect } from "react"; - import { checkForUpdate } from "../utils/updater"; import { AppEventManager, AppEvents } from "../common/app-events"; import BaseStore from "../stores"; import createStore from "../common/store"; +import { store as settingStore } from "../stores/setting-store"; type CompletedUpdateStatus = { type: "completed"; version: string }; type DownloadingUpdateStatus = { type: "downloading"; progress: number }; @@ -104,7 +104,7 @@ export function useAutoUpdater() { ); checkingForUpdate(); - checkForUpdate().catch(console.error); + checkForUpdate(settingStore.get().autoUpdates).catch(console.error); return () => { checkingForUpdateEvent.unsubscribe(); diff --git a/apps/web/src/stores/setting-store.ts b/apps/web/src/stores/setting-store.ts index f08cc4efb..ab0c3240c 100644 --- a/apps/web/src/stores/setting-store.ts +++ b/apps/web/src/stores/setting-store.ts @@ -87,7 +87,7 @@ class SettingStore extends BaseStore { ImageCompressionOptions.ASK_EVERY_TIME ); desktopIntegrationSettings?: DesktopIntegration; - autoUpdates = true; + autoUpdates = false; isFlatpak = false; isSnap = false; proxyRules?: string; diff --git a/apps/web/src/utils/updater.ts b/apps/web/src/utils/updater.ts index b0052defa..fc1883de9 100644 --- a/apps/web/src/utils/updater.ts +++ b/apps/web/src/utils/updater.ts @@ -21,9 +21,12 @@ import { AppEventManager, AppEvents } from "../common/app-events"; import { desktop } from "../common/desktop-bridge"; import { appVersion, getServiceWorkerVersion } from "./version"; -export async function checkForUpdate() { - if (IS_DESKTOP_APP) await desktop?.updater.check.query().catch(console.error); - else { +export async function checkForUpdate(checkOnDesktop = true) { + if (IS_DESKTOP_APP && checkOnDesktop) { + await desktop?.updater.check.query().catch(console.error); + } + + if (!IS_DESKTOP_APP) { AppEventManager.publish(AppEvents.checkingForUpdate); const registrations =