feat(Ipc): add architecture information and update check logic for Windows arm64

This commit is contained in:
kangfenmao 2025-04-12 20:42:20 +08:00
parent 8b95a131ec
commit fa19f41385
3 changed files with 21 additions and 1 deletions

View File

@ -1,4 +1,5 @@
import fs from 'node:fs'
import { arch } from 'node:os'
import { isMac, isWin } from '@main/constant'
import { getBinaryPath, isBinaryExists, runInstallScript } from '@main/utils/process'
@ -46,7 +47,8 @@ export function registerIpc(mainWindow: BrowserWindow, app: Electron.App) {
configPath: getConfigDir(),
appDataPath: app.getPath('userData'),
resourcesPath: getResourcePath(),
logsPath: log.transports.file.getFile().path
logsPath: log.transports.file.getFile().path,
arch: arch()
}))
ipcMain.handle(IpcChannel.App_Proxy, async (_, proxy: string) => {
@ -152,7 +154,16 @@ export function registerIpc(mainWindow: BrowserWindow, app: Electron.App) {
// check for update
ipcMain.handle(IpcChannel.App_CheckForUpdate, async () => {
// 在 Windows 上,如果架构是 arm64则不检查更新
if (isWin && arch().includes('arm')) {
return {
currentVersion: app.getVersion(),
updateInfo: null
}
}
const update = await appUpdater.autoUpdater.checkForUpdates()
return {
currentVersion: appUpdater.autoUpdater.currentVersion,
updateInfo: update?.updateInfo

View File

@ -2,6 +2,7 @@ import { GithubOutlined } from '@ant-design/icons'
import { FileProtectOutlined, GlobalOutlined, MailOutlined, SoundOutlined } from '@ant-design/icons'
import IndicatorLight from '@renderer/components/IndicatorLight'
import { HStack } from '@renderer/components/Layout'
import { isWindows } from '@renderer/config/constant'
import { APP_NAME, AppLogo } from '@renderer/config/env'
import { useTheme } from '@renderer/context/ThemeProvider'
import { useMinappPopup } from '@renderer/hooks/useMinappPopup'
@ -33,6 +34,13 @@ const AboutSettings: FC = () => {
const onCheckUpdate = debounce(
async () => {
const { arch } = await window.api.getAppInfo()
if (isWindows && arch.includes('arm')) {
window.open('https://cherry-ai.com/download', '_blank')
return
}
if (update.checking || update.downloading) {
return
}

View File

@ -237,6 +237,7 @@ export type AppInfo = {
resourcesPath: string
filesPath: string
logsPath: string
arch: string
}
export interface Shortcut {