mirror of
https://github.com/Corfirean/coa-server-manager.git
synced 2026-11-21 11:25:56 +00:00
Add the SQUID dashboard tab and make a stopped server stay stopped after updating
The Dashboard tab (shown with SQUID Playerbots) downloads the dashboard release of the bots' release series, starts it on a free local port and shows it in the window. After an update, a server that was stopped stays stopped unless the owner asked for it to start. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
4c4f8bbb3e
commit
838cc07e73
17 files changed
+564
-17
No files matched your search
@@ -86,6 +86,9 @@ export async function applyServerUpdate(id: string, opts?: { choices: Record<str
|
||||
const current = get(id);
|
||||
if (current.applying || current.stateError || (current.result && "pending" in current.result)) return false;
|
||||
if (!opts && (!p || p.conflicts.length > 0)) return false;
|
||||
// The update stops a running server and proves the new build by starting it; a server that was stopped stays stopped
|
||||
// unless the owner asked for it to start.
|
||||
const wasRunning = await api.status(id).then((s) => [s.observed.mysql, s.observed.auth, s.observed.world].some((x) => x.state === "running" || x.state === "starting")).catch(() => true);
|
||||
set(id, { applying: true, step: null, percent: 0, error: null, uiError: null, result: null });
|
||||
let un: (() => void) | undefined;
|
||||
try {
|
||||
@@ -96,8 +99,7 @@ export async function applyServerUpdate(id: string, opts?: { choices: Record<str
|
||||
try {
|
||||
const out = await api.applyUpdate(id, opts?.choices ?? {}, opts?.source);
|
||||
set(id, { result: out.txn.state === "committed" ? { committed: out.txn.to_version ?? "" } : { pending: out.txn } });
|
||||
// The update proved the new build starts and left it running; the owner may prefer it stopped again.
|
||||
if (out.txn.state === "committed" && !startAfterUpdate("server", id)) await api.stop(id).catch(() => undefined);
|
||||
if (out.txn.state === "committed" && !wasRunning && !startAfterUpdate("server", id)) await api.stop(id).catch(() => undefined);
|
||||
return true;
|
||||
} catch (e) {
|
||||
const ui = asUiError(e);
|
||||
|
||||
Reference in new issue
Block a user