新增 Windows 旧版提示功能,提醒用户升级至新版系统以提高安全性和性能
Build / Windows (push) Waiting to run
Build / Windows_7 (push) Waiting to run
Build / Mac (push) Waiting to run
Build / Linux (push) Waiting to run

This commit is contained in:
lyswhut
2026-09-19 00:50:49 +08:00
parent e20b2844fb
commit d2f5485996
3 changed files with 46 additions and 0 deletions
+1
View File
@@ -16,6 +16,7 @@ import registerModules from '@main/modules'
// 初始化应用
const init = () => {
console.log('init')
if (process.env.BUILD_WIN7 == 'true') import('./utils/winLegacy')
void initAppSetting().then(() => {
registerModules()
global.lx.event_app.app_inited()
+44
View File
@@ -0,0 +1,44 @@
import os from 'node:os'
import { dialog } from 'electron'
import { STORE_NAMES } from '@common/constants'
import getStore from '@main/utils/store'
import { openUrl } from '@common/utils/electron'
const showWinLegacyMessage = () => {
if (process.platform !== 'win32') return
const storeKey = 'winLegacyMessageShown'
const dataStore = getStore(STORE_NAMES.DATA)
const count = dataStore.get<number>(storeKey) || 0
if (count > 2) return
const osVersion = os.release()
const majorVersion = parseInt(osVersion.split('.')[0], 10)
const isOldWindows = majorVersion < 10
if (isOldWindows) {
const result = dialog.showMessageBoxSync({
type: 'warning',
title: 'Windows 旧版提示',
message: '您正在使用专为旧版 Windows 准备的 Any Listen,它仅用于实在无法升级到新版系统的用户。\n该版本缺乏安全更新,可能存在安全风险,并且功能未经测试,可能存在兼容性问题。\n\n如果您的设备支持 Windows 10 或更高版本,强烈建议升级系统,切换到标准版本的 Any Listen,以获得更好的安全性和性能。',
buttons: ['知道了'],
})
if (result === 0) {
dataStore.set(storeKey, count + 1)
}
} else {
const result = dialog.showMessageBoxSync({
type: 'warning',
title: '您正在使用旧版',
message: '您正在使用专为旧版 Windows 准备的 Any Listen,它仅用于实在无法升级到新版系统的用户,但您的系统似乎在标准版的支持范围内,为了获得最佳体验,请切换到 Any Listen 的标准版本。\n\n注意:当前版本缺乏安全更新,可能存在安全风险,并且功能未经测试,可能存在兼容性问题。',
buttons: ['跳转新版发布页', '知道了'],
})
if (result === 0) {
void openUrl('https://github.com/lyswhut/lx-music-desktop/releases')
} else if (result === 1) {
dataStore.set('winLegacyMessageShown', count + 1)
}
}
}
showWinLegacyMessage()