From b8070f1871a562f9bf1412ff254b2c41b99c294f Mon Sep 17 00:00:00 2001 From: Louis Date: Sun, 3 Aug 2025 23:32:27 +0700 Subject: [PATCH] chore: able to disable updater via env flag --- web-app/src/providers/DataProvider.tsx | 7 ++++++- web-app/src/types/global.d.ts | 1 + web-app/vite.config.ts | 13 ++++++++----- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/web-app/src/providers/DataProvider.tsx b/web-app/src/providers/DataProvider.tsx index dcfacd536..6110f9dd5 100644 --- a/web-app/src/providers/DataProvider.tsx +++ b/web-app/src/providers/DataProvider.tsx @@ -62,7 +62,12 @@ export function DataProvider() { // Check for app updates useEffect(() => { - checkForUpdate() + // Only check for updates if the auto updater is not disabled + // App might be distributed via other package managers + // or methods that handle updates differently + if (!AUTO_UPDATER_DISABLED) { + checkForUpdate() + } }, [checkForUpdate]) const handleDeepLink = (urls: string[] | null) => { diff --git a/web-app/src/types/global.d.ts b/web-app/src/types/global.d.ts index fe33f3d46..b104314b0 100644 --- a/web-app/src/types/global.d.ts +++ b/web-app/src/types/global.d.ts @@ -19,6 +19,7 @@ declare global { declare const POSTHOG_KEY: string declare const POSTHOG_HOST: string declare const MODEL_CATALOG_URL: string + declare const AUTO_UPDATER_DISABLED: boolean interface Window { core: AppCore | undefined } diff --git a/web-app/vite.config.ts b/web-app/vite.config.ts index 697c1a64f..4c1b2ab40 100644 --- a/web-app/vite.config.ts +++ b/web-app/vite.config.ts @@ -33,19 +33,19 @@ export default defineConfig(({ mode }) => { define: { IS_TAURI: JSON.stringify(process.env.IS_TAURI), IS_MACOS: JSON.stringify( - process.env.TAURI_ENV_PLATFORM?.includes('darwin') ?? 'false' + process.env.TAURI_ENV_PLATFORM?.includes('darwin') ?? false ), IS_WINDOWS: JSON.stringify( - process.env.TAURI_ENV_PLATFORM?.includes('windows') ?? 'false' + process.env.TAURI_ENV_PLATFORM?.includes('windows') ?? false ), IS_LINUX: JSON.stringify( - process.env.TAURI_ENV_PLATFORM?.includes('linux') ?? 'false' + process.env.TAURI_ENV_PLATFORM?.includes('linux') ?? false ), IS_IOS: JSON.stringify( - process.env.TAURI_ENV_PLATFORM?.includes('ios') ?? 'false' + process.env.TAURI_ENV_PLATFORM?.includes('ios') ?? false ), IS_ANDROID: JSON.stringify( - process.env.TAURI_ENV_PLATFORM?.includes('android') ?? 'false' + process.env.TAURI_ENV_PLATFORM?.includes('android') ?? false ), PLATFORM: JSON.stringify(process.env.TAURI_ENV_PLATFORM), @@ -56,6 +56,9 @@ export default defineConfig(({ mode }) => { MODEL_CATALOG_URL: JSON.stringify( 'https://raw.githubusercontent.com/menloresearch/model-catalog/main/model_catalog.json' ), + AUTO_UPDATER_DISABLED: JSON.stringify( + env.AUTO_UPDATER_DISABLED === 'true' + ), }, // Vite options tailored for Tauri development and only applied in `tauri dev` or `tauri build`