mirror of
https://github.com/Corfirean/coa-server-manager.git
synced 2026-11-20 19:25:56 +00:00
fix(preview): resolve Tauri updater plugin config deserialization panic on launch
This commit is contained in:
1 parent
3367be2e99
commit
d5ae38440d
2 files changed
+12
-22
No files matched your search
+4
-22
@@ -1,6 +1,6 @@
|
||||
import { useSyncExternalStore } from "react";
|
||||
import { getCurrentWindow } from "@tauri-apps/api/window";
|
||||
import { check, type Update } from "@tauri-apps/plugin-updater";
|
||||
import type { Update } from "@tauri-apps/plugin-updater";
|
||||
import { relaunch } from "@tauri-apps/plugin-process";
|
||||
|
||||
/**
|
||||
@@ -44,27 +44,9 @@ export function setAutoUpdate(on: boolean) {
|
||||
listeners.forEach((l) => l());
|
||||
}
|
||||
|
||||
/** Look for a new version. With `download` it also fetches the installer so it is ready to install on exit. */
|
||||
export async function lookForUpdate(opts: { download: boolean }): Promise<void> {
|
||||
if (state.phase === "checking" || state.phase === "downloading" || state.phase === "installing") return;
|
||||
set({ phase: "checking", error: undefined, percent: null });
|
||||
try {
|
||||
const u = await check();
|
||||
if (!u) {
|
||||
update = null;
|
||||
set({ phase: "current", version: undefined });
|
||||
return;
|
||||
}
|
||||
update = u;
|
||||
set({ version: u.version, notes: u.body ?? undefined });
|
||||
if (!opts.download) {
|
||||
set({ phase: "idle" });
|
||||
return;
|
||||
}
|
||||
await downloadPending();
|
||||
} catch (e) {
|
||||
set({ phase: "error", error: String(e) });
|
||||
}
|
||||
/** Look for a new version. Disabled in CSM Modules Preview to avoid overwriting with stable releases. */
|
||||
export async function lookForUpdate(_opts: { download: boolean }): Promise<void> {
|
||||
set({ phase: "current", version: undefined });
|
||||
}
|
||||
|
||||
async function downloadPending(): Promise<void> {
|
||||
|
||||
Reference in new issue
Block a user