Skip to content

Commit 4c9f4e0

Browse files
authored
feat(projects): does the configuration support automatic updates. close#612 (#617)
1 parent 9c012c7 commit 4c9f4e0

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

.env

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,6 @@ VITE_SOURCE_MAP=N
4646

4747
# Used to differentiate storage across different domains
4848
VITE_STORAGE_PREFIX=SOY_
49+
50+
# used to control whether the program automatically detects updates
51+
VITE_AUTOMATICALLY_DETECT_UPDATE=Y

src/plugins/app.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
import { h } from 'vue';
22
import { NButton } from 'naive-ui';
3-
import { $t } from '../locales';
3+
import { $t } from '@/locales';
44

55
export function setupAppVersionNotification() {
6+
const canAutoUpdateApp = import.meta.env.VITE_AUTOMATICALLY_DETECT_UPDATE === 'Y';
7+
8+
if (!canAutoUpdateApp) return;
9+
610
let isShow = false;
711

812
document.addEventListener('visibilitychange', async () => {

src/typings/env.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,8 @@ declare namespace Env {
103103
readonly VITE_ICONIFY_URL?: string;
104104
/** Used to differentiate storage across different domains */
105105
readonly VITE_STORAGE_PREFIX?: string;
106+
/** Whether to automatically detect updates after configuring application packaging */
107+
readonly VITE_AUTOMATICALLY_DETECT_UPDATE?: CommonType.YesOrNo;
106108
}
107109
}
108110

0 commit comments

Comments
 (0)