mirror of
https://github.com/Corfirean/coa-server-manager.git
synced 2026-11-19 03:25:56 +00:00
The community moved the game client behind its official launcher (account sign-in, signed manifest, its own CDN), so the public manifest now answers 404 and the Manager must not pose as the launcher. Remove the client download and update path (clientdl, plan/sync/download/cancel commands, update job and progress UI, version tracking) and reduce "Set up the game client" to: open coa-development.org for the launcher, or pick a folder that already has the game. Linking a folder, realmlist switch, companion addon and the custom-race patch are unchanged. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
29 lines
1.1 KiB
TypeScript
29 lines
1.1 KiB
TypeScript
import { useState } from "react";
|
|
|
|
/**
|
|
* Whether a finished server update starts the server. Off by default: updating a stopped server leaves it stopped (a
|
|
* server that was running is started again, as the update had to stop it).
|
|
*/
|
|
export type AfterUpdate = "server";
|
|
|
|
const key = (kind: AfterUpdate, id: string) => `coa-start-after-${kind}-update:${id}`;
|
|
const fallback = (_kind: AfterUpdate) => false;
|
|
|
|
export function startAfterUpdate(kind: AfterUpdate, id: string): boolean {
|
|
try {
|
|
const value = localStorage.getItem(key(kind, id));
|
|
return value === null ? fallback(kind) : value === "1";
|
|
} catch {
|
|
return fallback(kind);
|
|
}
|
|
}
|
|
|
|
export function setStartAfterUpdate(kind: AfterUpdate, id: string, on: boolean) {
|
|
try { localStorage.setItem(key(kind, id), on ? "1" : "0"); } catch { /* storage unavailable: the default applies */ }
|
|
}
|
|
|
|
export function useStartAfterUpdate(kind: AfterUpdate, id: string): [boolean, (on: boolean) => void] {
|
|
const [on, setOn] = useState(() => startAfterUpdate(kind, id));
|
|
return [on, (next) => { setStartAfterUpdate(kind, id, next); setOn(next); }];
|
|
}
|