disable auto update in portable exe
This commit is contained in:
parent
234a5e085f
commit
ef9c8fd037
@ -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
|
||||
|
||||
@ -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 = () => {
|
||||
</Tag>
|
||||
</VersionWrapper>
|
||||
</Row>
|
||||
<CheckUpdateButton
|
||||
onClick={onCheckUpdate}
|
||||
loading={update.checking}
|
||||
disabled={update.downloading || update.checking}>
|
||||
{update.downloading
|
||||
? t('settings.about.downloading')
|
||||
: update.available
|
||||
? t('settings.about.checkUpdate.available')
|
||||
: t('settings.about.checkUpdate')}
|
||||
</CheckUpdateButton>
|
||||
{!isPortable && (
|
||||
<CheckUpdateButton
|
||||
onClick={onCheckUpdate}
|
||||
loading={update.checking}
|
||||
disabled={update.downloading || update.checking}>
|
||||
{update.downloading
|
||||
? t('settings.about.downloading')
|
||||
: update.available
|
||||
? t('settings.about.checkUpdate.available')
|
||||
: t('settings.about.checkUpdate')}
|
||||
</CheckUpdateButton>
|
||||
)}
|
||||
</AboutHeader>
|
||||
<SettingDivider />
|
||||
<SettingRow>
|
||||
<SettingRowTitle>{t('settings.general.auto_check_update.title')}</SettingRowTitle>
|
||||
<Switch value={autoCheckUpdate} onChange={(v) => setAutoCheckUpdate(v)} />
|
||||
</SettingRow>
|
||||
{!isPortable && (
|
||||
<>
|
||||
<SettingDivider />
|
||||
<SettingRow>
|
||||
<SettingRowTitle>{t('settings.general.auto_check_update.title')}</SettingRowTitle>
|
||||
<Switch value={autoCheckUpdate} onChange={(v) => setAutoCheckUpdate(v)} />
|
||||
</SettingRow>
|
||||
</>
|
||||
)}
|
||||
</SettingGroup>
|
||||
{hasNewVersion && update.info && (
|
||||
<SettingGroup theme={theme}>
|
||||
|
||||
@ -246,6 +246,7 @@ export type AppInfo = {
|
||||
filesPath: string
|
||||
logsPath: string
|
||||
arch: string
|
||||
isPortable: boolean
|
||||
}
|
||||
|
||||
export interface Shortcut {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user