diff --git a/src/main/ipc.ts b/src/main/ipc.ts index 82c051bd..8613e9c3 100644 --- a/src/main/ipc.ts +++ b/src/main/ipc.ts @@ -48,7 +48,8 @@ export function registerIpc(mainWindow: BrowserWindow, app: Electron.App) { appDataPath: app.getPath('userData'), resourcesPath: getResourcePath(), logsPath: log.transports.file.getFile().path, - arch: arch() + arch: arch(), + isPortable: isWin && 'PORTABLE_EXECUTABLE_DIR' in process.env })) ipcMain.handle(IpcChannel.App_Proxy, async (_, proxy: string) => { @@ -176,7 +177,7 @@ export function registerIpc(mainWindow: BrowserWindow, app: Electron.App) { // check for update ipcMain.handle(IpcChannel.App_CheckForUpdate, async () => { // 在 Windows 上,如果架构是 arm64,则不检查更新 - if (isWin && arch().includes('arm')) { + if (isWin && (arch().includes('arm') || 'PORTABLE_EXECUTABLE_DIR' in process.env)) { return { currentVersion: app.getVersion(), updateInfo: null diff --git a/src/renderer/src/pages/settings/AboutSettings.tsx b/src/renderer/src/pages/settings/AboutSettings.tsx index b11f793f..25934137 100644 --- a/src/renderer/src/pages/settings/AboutSettings.tsx +++ b/src/renderer/src/pages/settings/AboutSettings.tsx @@ -24,6 +24,7 @@ import { SettingContainer, SettingDivider, SettingGroup, SettingRow, SettingTitl const AboutSettings: FC = () => { const [version, setVersion] = useState('') + const [isPortable, setIsPortable] = useState(false) const { t } = useTranslation() const { autoCheckUpdate, setAutoCheckUpdate } = useSettings() const { theme } = useTheme() @@ -102,6 +103,7 @@ const AboutSettings: FC = () => { runAsyncFunction(async () => { const appInfo = await window.api.getAppInfo() setVersion(appInfo.version) + setIsPortable(appInfo.isPortable) }) }, []) @@ -143,22 +145,28 @@ const AboutSettings: FC = () => { - - {update.downloading - ? t('settings.about.downloading') - : update.available - ? t('settings.about.checkUpdate.available') - : t('settings.about.checkUpdate')} - + {!isPortable && ( + + {update.downloading + ? t('settings.about.downloading') + : update.available + ? t('settings.about.checkUpdate.available') + : t('settings.about.checkUpdate')} + + )} - - - {t('settings.general.auto_check_update.title')} - setAutoCheckUpdate(v)} /> - + {!isPortable && ( + <> + + + {t('settings.general.auto_check_update.title')} + setAutoCheckUpdate(v)} /> + + + )} {hasNewVersion && update.info && ( diff --git a/src/renderer/src/types/index.ts b/src/renderer/src/types/index.ts index dfefc2ec..bccf403b 100644 --- a/src/renderer/src/types/index.ts +++ b/src/renderer/src/types/index.ts @@ -246,6 +246,7 @@ export type AppInfo = { filesPath: string logsPath: string arch: string + isPortable: boolean } export interface Shortcut {