From fa19f413853c4146e1f43c1926b1cc84cb4749ae Mon Sep 17 00:00:00 2001 From: kangfenmao Date: Sat, 12 Apr 2025 20:42:20 +0800 Subject: [PATCH] feat(Ipc): add architecture information and update check logic for Windows arm64 --- src/main/ipc.ts | 13 ++++++++++++- src/renderer/src/pages/settings/AboutSettings.tsx | 8 ++++++++ src/renderer/src/types/index.ts | 1 + 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/src/main/ipc.ts b/src/main/ipc.ts index b4b84c63..18a61ffe 100644 --- a/src/main/ipc.ts +++ b/src/main/ipc.ts @@ -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 diff --git a/src/renderer/src/pages/settings/AboutSettings.tsx b/src/renderer/src/pages/settings/AboutSettings.tsx index fdea6e06..965c22bf 100644 --- a/src/renderer/src/pages/settings/AboutSettings.tsx +++ b/src/renderer/src/pages/settings/AboutSettings.tsx @@ -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 } diff --git a/src/renderer/src/types/index.ts b/src/renderer/src/types/index.ts index 49e06b4d..7077e559 100644 --- a/src/renderer/src/types/index.ts +++ b/src/renderer/src/types/index.ts @@ -237,6 +237,7 @@ export type AppInfo = { resourcesPath: string filesPath: string logsPath: string + arch: string } export interface Shortcut {