diff --git a/.env b/.env index 5ac4f32..5a4bf41 100644 --- a/.env +++ b/.env @@ -43,3 +43,6 @@ VITE_STATIC_SUPER_ROLE=R_SUPER # 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 8bf06c7..28ed4de 100644 --- a/src/plugins/app.ts +++ b/src/plugins/app.ts @@ -1,8 +1,12 @@ import { h } from 'vue'; import { Button } from 'ant-design-vue'; -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 8000a7e..90c9fae 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; } }