feat(Ipc): add architecture information and update check logic for Windows arm64
This commit is contained in:
parent
8b95a131ec
commit
fa19f41385
@ -1,4 +1,5 @@
|
|||||||
import fs from 'node:fs'
|
import fs from 'node:fs'
|
||||||
|
import { arch } from 'node:os'
|
||||||
|
|
||||||
import { isMac, isWin } from '@main/constant'
|
import { isMac, isWin } from '@main/constant'
|
||||||
import { getBinaryPath, isBinaryExists, runInstallScript } from '@main/utils/process'
|
import { getBinaryPath, isBinaryExists, runInstallScript } from '@main/utils/process'
|
||||||
@ -46,7 +47,8 @@ export function registerIpc(mainWindow: BrowserWindow, app: Electron.App) {
|
|||||||
configPath: getConfigDir(),
|
configPath: getConfigDir(),
|
||||||
appDataPath: app.getPath('userData'),
|
appDataPath: app.getPath('userData'),
|
||||||
resourcesPath: getResourcePath(),
|
resourcesPath: getResourcePath(),
|
||||||
logsPath: log.transports.file.getFile().path
|
logsPath: log.transports.file.getFile().path,
|
||||||
|
arch: arch()
|
||||||
}))
|
}))
|
||||||
|
|
||||||
ipcMain.handle(IpcChannel.App_Proxy, async (_, proxy: string) => {
|
ipcMain.handle(IpcChannel.App_Proxy, async (_, proxy: string) => {
|
||||||
@ -152,7 +154,16 @@ export function registerIpc(mainWindow: BrowserWindow, app: Electron.App) {
|
|||||||
|
|
||||||
// check for update
|
// check for update
|
||||||
ipcMain.handle(IpcChannel.App_CheckForUpdate, async () => {
|
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()
|
const update = await appUpdater.autoUpdater.checkForUpdates()
|
||||||
|
|
||||||
return {
|
return {
|
||||||
currentVersion: appUpdater.autoUpdater.currentVersion,
|
currentVersion: appUpdater.autoUpdater.currentVersion,
|
||||||
updateInfo: update?.updateInfo
|
updateInfo: update?.updateInfo
|
||||||
|
|||||||
@ -2,6 +2,7 @@ import { GithubOutlined } from '@ant-design/icons'
|
|||||||
import { FileProtectOutlined, GlobalOutlined, MailOutlined, SoundOutlined } from '@ant-design/icons'
|
import { FileProtectOutlined, GlobalOutlined, MailOutlined, SoundOutlined } from '@ant-design/icons'
|
||||||
import IndicatorLight from '@renderer/components/IndicatorLight'
|
import IndicatorLight from '@renderer/components/IndicatorLight'
|
||||||
import { HStack } from '@renderer/components/Layout'
|
import { HStack } from '@renderer/components/Layout'
|
||||||
|
import { isWindows } from '@renderer/config/constant'
|
||||||
import { APP_NAME, AppLogo } from '@renderer/config/env'
|
import { APP_NAME, AppLogo } from '@renderer/config/env'
|
||||||
import { useTheme } from '@renderer/context/ThemeProvider'
|
import { useTheme } from '@renderer/context/ThemeProvider'
|
||||||
import { useMinappPopup } from '@renderer/hooks/useMinappPopup'
|
import { useMinappPopup } from '@renderer/hooks/useMinappPopup'
|
||||||
@ -33,6 +34,13 @@ const AboutSettings: FC = () => {
|
|||||||
|
|
||||||
const onCheckUpdate = debounce(
|
const onCheckUpdate = debounce(
|
||||||
async () => {
|
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) {
|
if (update.checking || update.downloading) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
@ -237,6 +237,7 @@ export type AppInfo = {
|
|||||||
resourcesPath: string
|
resourcesPath: string
|
||||||
filesPath: string
|
filesPath: string
|
||||||
logsPath: string
|
logsPath: string
|
||||||
|
arch: string
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface Shortcut {
|
export interface Shortcut {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user