diff --git a/.env b/.env index fc9f6d6bc..4eb00bf7f 100644 --- a/.env +++ b/.env @@ -46,3 +46,6 @@ VITE_SOURCE_MAP=N # Used to differentiate storage across different domains VITE_STORAGE_PREFIX=SOY_ + +# used to control whether the program automatically detects updates +VITE_AUTOMATICALLY_DETECT_UPDATE=Y diff --git a/src/plugins/app.ts b/src/plugins/app.ts index 6dc88fed7..acdd2ca09 100644 --- a/src/plugins/app.ts +++ b/src/plugins/app.ts @@ -1,8 +1,12 @@ import { h } from 'vue'; import { NButton } from 'naive-ui'; -import { $t } from '../locales'; +import { $t } from '@/locales'; export function setupAppVersionNotification() { + const canAutoUpdateApp = import.meta.env.VITE_AUTOMATICALLY_DETECT_UPDATE === 'Y'; + + if (!canAutoUpdateApp) return; + let isShow = false; document.addEventListener('visibilitychange', async () => { diff --git a/src/typings/env.d.ts b/src/typings/env.d.ts index 8000a7e0a..90c9faeee 100644 --- a/src/typings/env.d.ts +++ b/src/typings/env.d.ts @@ -103,6 +103,8 @@ declare namespace Env { readonly VITE_ICONIFY_URL?: string; /** Used to differentiate storage across different domains */ readonly VITE_STORAGE_PREFIX?: string; + /** Whether to automatically detect updates after configuring application packaging */ + readonly VITE_AUTOMATICALLY_DETECT_UPDATE?: CommonType.YesOrNo; } }