[bugfix] remove auto update for linux builds

This commit is contained in:
silentrald
2024-12-10 09:26:57 +08:00
parent 60c410671a
commit a47f17e766
4 changed files with 61 additions and 21 deletions
+4 -2
View File
@@ -69,7 +69,7 @@ const installExtensions = async () => {
.catch(log.error);
};
const createWindow = async (window: AppWindow = "launcher.html") => {
const createWindow = async (window: AppWindow) => {
if (isDebug) {
await installExtensions();
}
@@ -131,7 +131,9 @@ if (!gotTheLock) {
} else if (associatedFile) {
FileAssociationService.getInstance().handleFileAssociation(associatedFile);
} else {
createWindow();
createWindow(process.platform === "linux"
? "index.html" : "launcher.html"
);
}
SteamLauncherService.getInstance().restoreSteamVR();
+10 -4
View File
@@ -19,10 +19,16 @@ export class AutoUpdaterService {
autoUpdater.autoDownload = false;
}
public isUpdateAvailable(): Promise<boolean> {
return autoUpdater.checkForUpdates().then(info => {
return !!info?.updateInfo && gt(info.updateInfo.version, autoUpdater.currentVersion.version);
}).catch(() => false);
public async isUpdateAvailable(): Promise<boolean> {
return autoUpdater.checkForUpdates()
.then(info => {
return !!info?.updateInfo && gt(
info.updateInfo.version, autoUpdater.currentVersion.version
)})
.catch(error => {
log.error("Could not get update", error);
return false;
});
}
public downloadUpdate(): Observable<Progression> {
@@ -12,6 +12,51 @@ import { useService } from "renderer/hooks/use-service.hook";
import { lastValueFrom } from "rxjs";
import { useWindowControls } from "renderer/hooks/use-window-controls.hook";
function TitleBarTags({
ipcService
}: Readonly<{
ipcService: IpcService
}>) {
const [previewVersion, setPreviewVersion] = useState("");
const [outdated, setOutdated] = useState(false);
useEffect(() => {
const requests: Promise<any>[] = [
lastValueFrom(ipcService.sendV2("current-version"))
];
if (window.electron.platform === "linux") {
requests.push(lastValueFrom(ipcService.sendV2("check-update")));
}
Promise.all(requests).then(([ currentVersion, outdated ]) => {
handlePrerelease(currentVersion);
setOutdated(outdated);
});
}, []);
const handlePrerelease = (version: string) => {
if (version.toLowerCase().includes("alpha")) {
return setPreviewVersion("ALPHA");
}
if (version.toLowerCase().includes("beta")) {
return setPreviewVersion("BETA");
}
}
return <>
{previewVersion &&
<span className="bg-main-color-1 text-white dark:text-black dark:bg-white rounded-full ml-1 text-[10px] italic px-1 uppercase h-3.5 font-bold">
{previewVersion}
</span>
}
{outdated &&
<span className="bg-main-color-1 text-white dark:text-black dark:bg-white rounded-full ml-1 text-[10px] italic px-1 uppercase h-3.5 font-bold">
Outdated
</span>
}
</>;
}
export default function TitleBar({ template = "index.html" }: { template: AppWindow }) {
const ipcService = useService(IpcService);
const audio = useService(AudioPlayerService);
@@ -20,19 +65,6 @@ export default function TitleBar({ template = "index.html" }: { template: AppWin
const volume = useObservable(() => audio.volume$, audio.volume);
const color = useThemeColor("first-color");
const [previewVersion, setPreviewVersion] = useState(null);
useEffect(() => {
lastValueFrom(ipcService.sendV2("current-version")).then(version => {
if (version.toLowerCase().includes("alpha")) {
return setPreviewVersion("ALPHA");
}
if (version.toLowerCase().includes("beta")) {
return setPreviewVersion("BETA");
}
});
}, []);
const [maximized, setMaximized] = useState(false);
const closeWindow = () => {
@@ -76,7 +108,7 @@ export default function TitleBar({ template = "index.html" }: { template: AppWin
<div id="drag-region" className="grow basis-0 h-full">
<div id="window-title" className="pl-1">
<span className="text-gray-800 dark:text-gray-100 font-bold text-xs italic">BSManager</span>
{previewVersion && <span className="bg-main-color-1 text-white dark:text-black dark:bg-white rounded-full ml-1 text-[10px] italic px-1 uppercase h-3.5 font-bold">{previewVersion}</span>}
<TitleBarTags ipcService={ipcService} />
</div>
</div>
<div id="window-controls" className="h-full flex shrink-0 items-center">
@@ -31,7 +31,7 @@ export class AutoUpdaterService {
this.ipcService = IpcService.getInstance();
}
public isUpdateAvailable(): Promise<boolean> {
public async isUpdateAvailable(): Promise<boolean> {
return lastValueFrom(this.ipcService.sendV2("check-update")).catch(() => false);
}