mirror of
https://github.com/Corfirean/coa-server-manager.git
synced 2026-11-20 11:25:56 +00:00
fix(preview): separate app updater manifest, enable preview self-update, add qualification evidence
This commit is contained in:
1 parent
c3664b881d
commit
3dbfffba76
17 files changed
+841
-10
No files matched your search
+22
-4
@@ -1,6 +1,6 @@
|
||||
import { useSyncExternalStore } from "react";
|
||||
import { getCurrentWindow } from "@tauri-apps/api/window";
|
||||
import type { Update } from "@tauri-apps/plugin-updater";
|
||||
import { check, type Update } from "@tauri-apps/plugin-updater";
|
||||
import { relaunch } from "@tauri-apps/plugin-process";
|
||||
|
||||
/**
|
||||
@@ -44,9 +44,27 @@ export function setAutoUpdate(on: boolean) {
|
||||
listeners.forEach((l) => l());
|
||||
}
|
||||
|
||||
/** 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 });
|
||||
/** Look for a new preview version from the dedicated Preview Manager update channel. */
|
||||
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) });
|
||||
}
|
||||
}
|
||||
|
||||
async function downloadPending(): Promise<void> {
|
||||
|
||||
Reference in new issue
Block a user