mirror of
https://github.com/Corfirean/coa-server-manager.git
synced 2026-11-25 03:25:56 +00:00
Remove-server card, Accounts tab, quiet background update check, safer install cleanup
- Settings: a card removes a stopped server from the Manager (no files deleted). - The Players tab is now Accounts in all languages. - The five-minute background check no longer starts and stops MySQL on a stopped server; only an explicit check may start it. - A failed install keeps its marker until the folder is complete, cleans up after a failure that happens after the move, and reports the launcher's output; install and update errors have a Copy button. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
c6e8a34509
commit
072a657649
17 files changed
+185
-50
No files matched your search
+4
-1
@@ -285,6 +285,8 @@ export interface UpdatePreview {
|
||||
migrations: number;
|
||||
pending_migrations?: number;
|
||||
download_bytes: number;
|
||||
/** False when pending database changes were not counted (stopped server during a background check, or an error). */
|
||||
database_checked?: boolean;
|
||||
/** Set when the database could not be inspected; the file comparison is still valid. */
|
||||
database_check_error?: string;
|
||||
}
|
||||
@@ -451,7 +453,8 @@ export const api = {
|
||||
cancelInstall: () => invoke<void>("cancel_install"),
|
||||
createAccount: (id: string, username: string, password: string, administrator: boolean) =>
|
||||
invoke<void>("create_account", { id, username, password, administrator }),
|
||||
checkUpdate: (id: string, source?: string) => invoke<UpdatePreview>("check_update", { id, source: source ?? null }),
|
||||
/** `background`: the repeating check, which must not start the database of a stopped server. */
|
||||
checkUpdate: (id: string, source?: string, background?: boolean) => invoke<UpdatePreview>("check_update", { id, source: source ?? null, background: background ?? false }),
|
||||
pendingUpdate: (id: string) => invoke<UpdateTxn | null>("pending_update", { id }),
|
||||
applyUpdate: (id: string, resolutions: Record<string, "keep" | "replace">, source?: string) =>
|
||||
invoke<{ txn: UpdateTxn }>("apply_update", { id, source: source ?? null, resolutions }),
|
||||
|
||||
@@ -34,12 +34,12 @@ function set(id: string, next: Partial<ServerUpdateState>) {
|
||||
listeners.forEach((l) => l());
|
||||
}
|
||||
|
||||
export async function checkServerUpdate(id: string): Promise<void> {
|
||||
export async function checkServerUpdate(id: string, background = false): Promise<void> {
|
||||
const cur = get(id);
|
||||
if (cur.applying || cur.checking) return;
|
||||
set(id, { checking: true });
|
||||
try {
|
||||
const p = await api.checkUpdate(id);
|
||||
const p = await api.checkUpdate(id, undefined, background);
|
||||
set(id, { preview: p, available: !isUpdateCurrent(p), error: null });
|
||||
} catch (e) {
|
||||
// A cached offer is no longer safe after an update or failed recheck.
|
||||
@@ -51,8 +51,8 @@ export async function checkServerUpdate(id: string): Promise<void> {
|
||||
|
||||
/** Check now and then every five minutes. Returns the function that stops it. */
|
||||
export function startServerUpdatePolling(id: string): () => void {
|
||||
void checkServerUpdate(id);
|
||||
const t = setInterval(() => void checkServerUpdate(id), CHECK_EVERY_MS);
|
||||
void checkServerUpdate(id, true);
|
||||
const t = setInterval(() => void checkServerUpdate(id, true), CHECK_EVERY_MS);
|
||||
return () => clearInterval(t);
|
||||
}
|
||||
|
||||
|
||||
@@ -3,5 +3,5 @@ import type { UpdatePreview } from "./api";
|
||||
export function isUpdateCurrent(preview: UpdatePreview): boolean {
|
||||
return preview.from_version === preview.to_version
|
||||
&& preview.items.every((item) => item.action === "skip")
|
||||
&& (preview.database_check_error !== undefined || (preview.pending_migrations ?? (preview.migrations === 0 ? 0 : undefined)) === 0);
|
||||
&& (preview.database_check_error !== undefined || preview.database_checked === false || (preview.pending_migrations ?? (preview.migrations === 0 ? 0 : undefined)) === 0);
|
||||
}
|
||||
Reference in new issue
Block a user