[feat] added auto update option on advance settings for windows (#773)

* [feat] added auto update option on advance settings for windows

* minor fixes + translations

* [feat] added popover for manual bsm update

* [feat] added logic on update and restart

* [feat] fixed sonar issues and added missing translations

* Fix availve update and current app version were the same

* Add a "See changelog"

* Set autoupdate always enabled by default

---------

Co-authored-by: Zagrios <40181755+Zagrios@users.noreply.github.com>
This commit is contained in:
silentrald
2025-06-13 00:58:41 +08:00
committed by GitHub
parent 9d945cdcfb
commit feb6ea3f87
21 changed files with 315 additions and 45 deletions
+14 -1
View File
@@ -1,8 +1,9 @@
import { autoUpdater, CancellationToken, ProgressInfo } from "electron-updater";
import { autoUpdater, CancellationToken, ProgressInfo, UpdateInfo } from "electron-updater";
import log from "electron-log";
import { gt } from "semver";
import { Progression } from "main/helpers/fs.helpers";
import { Observable } from "rxjs";
import { safeGt } from "shared/helpers/semver.helpers";
export class AutoUpdaterService {
private static instance: AutoUpdaterService;
@@ -31,6 +32,18 @@ export class AutoUpdaterService {
});
}
public async getAvailableUpdate(): Promise<UpdateInfo | null> {
return autoUpdater.checkForUpdates().then(info => {
if (info?.updateInfo && safeGt(info.updateInfo.version, autoUpdater.currentVersion.version)) {
return info.updateInfo;
}
return null;
}).catch((error: Error): UpdateInfo | null => {
log.error("Could not get update", error);
return null;
});
}
public downloadUpdate(): Observable<Progression> {
return new Observable<Progression>(observer => {
@@ -5,6 +5,7 @@ import { PROTON_BINARY_PREFIX, WINE_BINARY_PREFIX } from "main/constants";
import { Observable, Subject } from "rxjs";
import { CustomError } from "shared/models/exceptions/custom-error.class";
import { BSVersion } from "shared/bs-version.interface";
import { AutoUpdate } from "shared/models/config";
export class StaticConfigurationService {
private static instance: StaticConfigurationService;
@@ -30,8 +31,8 @@ export class StaticConfigurationService {
return this.store.has(key);
}
public get<K extends StaticConfigKeys>(key: K): StaticConfigKeyValues[K] {
return this.store.get<K>(key) as StaticConfigKeyValues[K];
public get<K extends StaticConfigKeys>(key: K, defaultValue?: StaticConfigKeyValues[K]): StaticConfigKeyValues[K] {
return this.store.get<K>(key, defaultValue) as StaticConfigKeyValues[K];
}
public take<K extends StaticConfigKeys>(key: K, cb: (val: StaticConfigKeyValues[K]) => void): void {
@@ -90,6 +91,7 @@ export interface StaticConfigKeyValues {
"use-symlinks": boolean;
"use-system-proxy": boolean;
"last-version-launched": BSVersion;
"auto-update": AutoUpdate;
// Linux Specific static configs
"proton-folder": string;