mirror of
https://github.com/Corfirean/coa-server-manager.git
synced 2026-11-24 11:25:56 +00:00
Compare commits
3
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a8afe88c83 | ||
|
|
657229aafc | ||
|
|
b5abc6fc4f |
No files matched your search
@@ -8,6 +8,12 @@ Published releases and previews. Pre-release entries do not change the stable up
|
||||
|
||||
Dates follow GitHub publication (UTC); legacy records retain their archived dates. Newest releases first.
|
||||
|
||||
## 0.9.17 — 2026-11-23
|
||||
|
||||
- The game client link points to the new community site, conquestofazerothcore.to.
|
||||
|
||||
[Release](https://github.com/Corfirean/coa-server-manager/releases/tag/v0.9.17) · [Source changes](https://github.com/Corfirean/coa-server-manager/compare/v0.9.16...v0.9.17)
|
||||
|
||||
## 0.9.16 — 2026-11-20
|
||||
|
||||
- The game client now comes from the community launcher, not from the Manager.
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
---
|
||||
area: manager
|
||||
type: fixed
|
||||
audience: admins
|
||||
title: Settings now shows the server version and update button after you have checked for updates
|
||||
---
|
||||
The Server card in Settings > Updates could stay empty, with only "…" and no update button, while the main screen already offered an update. It now shows the same version and update as the main screen.
|
||||
+13
-1
@@ -196,7 +196,8 @@
|
||||
"Corfirean/coa-server-manager:20261120-hd-graphics-hint-and-patch-labels.md",
|
||||
"Corfirean/coa-server-manager:20261120-server-log-auto-cleanup.md",
|
||||
"Corfirean/coa-server-manager:20261120-startup-fleet-creates-missing-companions.md",
|
||||
"Corfirean/coa-server-manager:20261120-weekly-world-restart.md"
|
||||
"Corfirean/coa-server-manager:20261120-weekly-world-restart.md",
|
||||
"Corfirean/coa-server-manager:20261123-client-site-link.md"
|
||||
],
|
||||
"releases": [
|
||||
{
|
||||
@@ -1002,6 +1003,17 @@
|
||||
],
|
||||
"commit": "316ef078e8047c790cb081f0991d9e0d618fcd2d",
|
||||
"compare": "https://github.com/Corfirean/coa-server-manager/compare/v0.9.15...v0.9.16"
|
||||
},
|
||||
{
|
||||
"tag": "v0.9.17",
|
||||
"version": "0.9.17",
|
||||
"date": "2026-11-23",
|
||||
"url": "https://github.com/Corfirean/coa-server-manager/releases/tag/v0.9.17",
|
||||
"notes": [
|
||||
"The game client link points to the new community site, conquestofazerothcore.to"
|
||||
],
|
||||
"commit": "b5abc6fc4f6ab348efd57521136a2153ec948ca0",
|
||||
"compare": "https://github.com/Corfirean/coa-server-manager/compare/v0.9.16...v0.9.17"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -63,6 +63,11 @@ export function startServerUpdatePolling(id: string): () => void {
|
||||
return () => clearInterval(t);
|
||||
}
|
||||
|
||||
/** How many update attempts and disk-state refreshes have finished for this server. */
|
||||
export function getServerUpdateRevision(id: string): number {
|
||||
return get(id).stateRevision;
|
||||
}
|
||||
|
||||
export function clearServerUpdateResult(id: string) {
|
||||
set(id, { result: null, uiError: null });
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { useEffect, useState } from "react";
|
||||
import { open } from "@tauri-apps/plugin-dialog";
|
||||
import { ChevronDown, ChevronRight, Loader2, RefreshCw, Server } from "lucide-react";
|
||||
import { applyServerUpdate, clearServerUpdateResult, refreshServerUpdateState, useServerUpdate } from "@/lib/serverUpdate";
|
||||
import { applyServerUpdate, clearServerUpdateResult, getServerUpdateRevision, refreshServerUpdateState, useServerUpdate } from "@/lib/serverUpdate";
|
||||
import { isUpdateCurrent } from "@/lib/serverUpdateStatus";
|
||||
import { api, asUiError, type UiError, type UpdatePreview, type UpdateTxn } from "@/lib/api";
|
||||
import { Button } from "@/components/ui/button";
|
||||
@@ -17,7 +17,12 @@ export function ServerUpdateCard({ serverId, onHistory, onAttention }: { serverI
|
||||
const { t } = useI18n();
|
||||
const upd = useServerUpdate(serverId);
|
||||
const human = useHuman();
|
||||
const [preview, setPreview] = useState<UpdatePreview | null>(upd.preview);
|
||||
// The offer shown here is the shared one the main screen uses (it is checked at start and every five minutes), unless
|
||||
// the owner pressed the check button on this card. A manual check counts only until the next finished update attempt,
|
||||
// which is why it carries the revision it was made at. Nothing is copied from the shared state when this card opens,
|
||||
// so an offer that arrives later, or one found before the card was opened, still shows.
|
||||
const [manual, setManual] = useState<{ revision: number; preview: UpdatePreview | null } | null>(null);
|
||||
const preview = manual && manual.revision === upd.stateRevision ? manual.preview : upd.preview;
|
||||
const [pending, setPending] = useState<UpdateTxn | null>(null);
|
||||
const [pendingChecked, setPendingChecked] = useState(false);
|
||||
const [pendingStateError, setPendingStateError] = useState<UiError | null>(null);
|
||||
@@ -29,7 +34,8 @@ export function ServerUpdateCard({ serverId, onHistory, onAttention }: { serverI
|
||||
const error = pendingStateError ?? localError ?? upd.uiError;
|
||||
const [localDone, setDone] = useState<string | null>(null);
|
||||
const done = upd.result && "committed" in upd.result ? t("upd.updatedTo", { v: upd.result.committed }) : localDone;
|
||||
const [choices, setChoices] = useState<Record<string, "keep" | "replace">>(() => Object.fromEntries((upd.preview?.conflicts ?? []).map(c => [c, "keep" as const])));
|
||||
const [picked, setChoices] = useState<Record<string, "keep" | "replace">>({});
|
||||
const choices: Record<string, "keep" | "replace"> = Object.fromEntries((preview?.conflicts ?? []).map(c => [c, picked[c] ?? "keep"]));
|
||||
const [advanced, setAdvanced] = useState(false);
|
||||
const [source, setSource] = useState("");
|
||||
const [startAfter, setStartAfter] = useStartAfterUpdate("server", serverId);
|
||||
@@ -48,7 +54,6 @@ export function ServerUpdateCard({ serverId, onHistory, onAttention }: { serverI
|
||||
// Every finished attempt refreshes the disk state, including failures in the background.
|
||||
useEffect(() => {
|
||||
if (!upd.stateRevision) return;
|
||||
setPreview(null);
|
||||
setPendingChecked(!upd.stateError);
|
||||
setPendingStateError(upd.stateError);
|
||||
if (!upd.stateError) setPending(upd.result && "pending" in upd.result ? upd.result.pending : null);
|
||||
@@ -72,13 +77,13 @@ export function ServerUpdateCard({ serverId, onHistory, onAttention }: { serverI
|
||||
setError(null);
|
||||
setDone(null);
|
||||
clearServerUpdateResult(serverId);
|
||||
setPreview(null);
|
||||
setManual(null);
|
||||
try {
|
||||
const txn = await refreshPending();
|
||||
if (txn) return;
|
||||
const p = await api.checkUpdate(serverId, source.trim() || undefined);
|
||||
setPreview(p);
|
||||
setChoices(Object.fromEntries(p.conflicts.map((c) => [c, "keep" as const])));
|
||||
setManual({ revision: getServerUpdateRevision(serverId), preview: p });
|
||||
setChoices({});
|
||||
} catch (e) {
|
||||
setError(asUiError(e));
|
||||
} finally {
|
||||
@@ -116,7 +121,7 @@ export function ServerUpdateCard({ serverId, onHistory, onAttention }: { serverI
|
||||
const result = await api.retryUpdateValidation(serverId, txn.id);
|
||||
if (result.state === "committed") {
|
||||
setPending(null);
|
||||
setPreview(null);
|
||||
setManual(null);
|
||||
setDone(t("upd.updatedTo", { v: result.to_version }));
|
||||
clearServerUpdateResult(serverId);
|
||||
} else setPending(result);
|
||||
|
||||
@@ -0,0 +1,96 @@
|
||||
import assert from "node:assert/strict";
|
||||
import test from "node:test";
|
||||
import { createRequire } from "node:module";
|
||||
import { fileURLToPath } from "node:url";
|
||||
import { rolldown } from "rolldown";
|
||||
import { createElement } from "react";
|
||||
import { renderToStaticMarkup } from "react-dom/server";
|
||||
|
||||
// The Server card in Settings -> Updates, rendered with a tiny hook runtime so that its effects really run (a plain
|
||||
// server render skips them, which is where the offer used to be wiped when the tab was opened after an update attempt
|
||||
// had already finished). The card must show what the shared update state, which the main screen also uses, holds.
|
||||
const stubs = {
|
||||
react: `export const useState=(...a)=>globalThis.__hooks.useState(...a); export const useEffect=(...a)=>globalThis.__hooks.useEffect(...a);`,
|
||||
"@/lib/api": `export const api={pendingUpdate:async()=>null}; export const asUiError=e=>e;`,
|
||||
"@tauri-apps/plugin-dialog": `export const open=async()=>null;`,
|
||||
"@/i18n": `export const useI18n=()=>({t:(k,v)=>v?k+JSON.stringify(v):k}); export const useHuman=()=>h=>h; export const hasKey=()=>false;`,
|
||||
"@/lib/serverUpdate": `export const applyServerUpdate=async()=>false; export const clearServerUpdateResult=()=>{}; export const refreshServerUpdateState=async()=>null; export const getServerUpdateRevision=()=>0; export const useServerUpdate=()=>globalThis.__cardUpdate;`,
|
||||
"@/lib/updatePrefs": `export const useStartAfterUpdate=()=>[false,()=>{}];`,
|
||||
"@/components/ui/button": `import {createElement} from 'react'; export const Button=({children,disabled,onClick,className,...props})=>createElement('button',{disabled,onClick,className,...props},children);`,
|
||||
"@/components/ui/card": `import {createElement} from 'react'; export const Card=({children,...props})=>createElement('div',props,children);`,
|
||||
};
|
||||
const card = fileURLToPath(new URL("../src/screens/ServerUpdateCard.tsx", import.meta.url));
|
||||
const bundle = await rolldown({
|
||||
input: card,
|
||||
transform: { jsx: "react-jsx" },
|
||||
external: (id, importer) => id === "react/jsx-runtime" || id === "lucide-react" || (id === "react" && !importer?.endsWith("ServerUpdateCard.tsx")),
|
||||
plugins: [{ name: "card-test",
|
||||
resolveId(id, importer) {
|
||||
if (id === "@/lib/serverUpdateStatus") return fileURLToPath(new URL("../src/lib/serverUpdateStatus.ts", import.meta.url));
|
||||
if (id.startsWith("@/") || id.startsWith("@tauri-apps/") || (id === "react" && importer?.endsWith("ServerUpdateCard.tsx"))) return "\0" + id;
|
||||
},
|
||||
load(id) {
|
||||
if (!id.startsWith("\0")) return;
|
||||
return stubs[id.slice(1)] ?? `export const ${id.split("/").at(-1)}=()=>null;`;
|
||||
},
|
||||
}],
|
||||
});
|
||||
const result = await bundle.generate({ format: "cjs" });
|
||||
await bundle.close();
|
||||
const module = { exports: {} };
|
||||
new Function("require", "module", "exports", result.output[0].code)(createRequire(import.meta.url), module, module.exports);
|
||||
|
||||
const offer = { from_version: "0.261116.11201", to_version: "0.261119.11401", items: [{ path: "bin/worldserver.exe", action: "replace" }], conflicts: [], migrations: 0, download_bytes: 5 << 20 };
|
||||
async function render(update) {
|
||||
globalThis.__cardUpdate = { preview: null, available: false, checking: false, applying: false, step: null, percent: 0, error: null, uiError: null, stateError: null, stateRevision: 0, result: null, ...update };
|
||||
const slots = [], deps = [];
|
||||
let index = 0, effects = [], dirty = false;
|
||||
globalThis.__hooks = {
|
||||
useState(initial) {
|
||||
const i = index++;
|
||||
if (!(i in slots)) slots[i] = typeof initial === "function" ? initial() : initial;
|
||||
return [slots[i], (next) => { const value = typeof next === "function" ? next(slots[i]) : next; if (!Object.is(value, slots[i])) { slots[i] = value; dirty = true; } }];
|
||||
},
|
||||
useEffect(fn, list) {
|
||||
const i = index++;
|
||||
const before = deps[i];
|
||||
if (!before || !list || list.some((d, k) => !Object.is(d, before[k]))) effects.push(fn);
|
||||
deps[i] = list;
|
||||
},
|
||||
};
|
||||
let html = "";
|
||||
for (let pass = 0; pass < 10; pass++) {
|
||||
index = 0; effects = []; dirty = false;
|
||||
html = renderToStaticMarkup(createElement(module.exports.ServerUpdateCard, { serverId: "fixture", onHistory() {}, onAttention() {} }));
|
||||
effects.forEach((fn) => fn());
|
||||
await new Promise((resolve) => setTimeout(resolve, 0));
|
||||
if (!dirty) break;
|
||||
}
|
||||
return html.replaceAll(""", '"');
|
||||
}
|
||||
|
||||
test("Settings card shows the installed version and the update button from the shared offer", async () => {
|
||||
const html = await render({ preview: offer, available: true });
|
||||
assert.match(html, /settings\.version\{"v":"0\.261116\.11201"\}/);
|
||||
assert.match(html, /upd\.availableFrom/);
|
||||
assert.match(html, /upd\.now/);
|
||||
});
|
||||
|
||||
test("Settings card keeps the offer after an update attempt already finished (it is not wiped on open)", async () => {
|
||||
const html = await render({ preview: offer, available: true, stateRevision: 3 });
|
||||
assert.match(html, /settings\.version\{"v":"0\.261116\.11201"\}/);
|
||||
assert.match(html, /upd\.now/);
|
||||
});
|
||||
|
||||
test("Settings card shows an up-to-date server as current, without an update button", async () => {
|
||||
const same = { ...offer, to_version: offer.from_version, items: [{ path: "bin/worldserver.exe", action: "skip" }], pending_migrations: 0 };
|
||||
const html = await render({ preview: same });
|
||||
assert.match(html, /upd\.current/);
|
||||
assert.doesNotMatch(html, /upd\.now/);
|
||||
});
|
||||
|
||||
test("Settings card shows a placeholder while no check has finished", async () => {
|
||||
const html = await render({ checking: true });
|
||||
assert.doesNotMatch(html, /settings\.version/);
|
||||
assert.doesNotMatch(html, /upd\.now/);
|
||||
});
|
||||
Reference in new issue
Block a user