Compare commits

...
Author SHA1 Message Date
ДмитрийandClaude Sonnet 5.5 a8afe88c83 Show the server version and update button in Settings after an update check
The Server card in Settings > Updates copied the shared update offer into local state once and
an effect wiped that copy whenever a finished update attempt or disk-state refresh had bumped
the shared revision, so after a check the card kept showing only "..." with no update button
while the main screen (which reads the shared state) still offered the update.

The card now derives the offer from the shared state; a manual check on the card is kept only
until the next finished attempt. Conflict choices default to "keep" without a copy as well.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-24 13:07:57 +05:00
github-actions[bot] 657229aafc Update published Manager changelog 2026-11-23 17:20:00 +00:00
Corfirean b5abc6fc4f Merge pull request #237 from Corfirean/release/manager-0.9.17
Manager 0.9.17: client link points to conquestofazerothcore.to
2026-11-23 21:52:24 +05:00
ДмитрийandClaude Sonnet 5.5 81c5556ffe Point the client setup link to conquestofazerothcore.to and prepare Manager 0.9.17
The old community site (coa-development.org) no longer works. The client setup dialog, the open-link
allowlist and the six translations now use https://conquestofazerothcore.to/, which serves the launcher
download and account sign-up. Version 0.9.17 (Manager only), reviewed note and its translations added.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-23 21:51:53 +05:00
github-actions[bot] 10cfdcf5a2 Update published Manager changelog 2026-11-20 17:37:52 +00:00
Corfirean 316ef078e8 Merge pull request #233 from Corfirean/release/manager-0.9.16
Manager 0.9.16
2026-11-20 22:08:03 +05:00
22 changed files with 206 additions and 37 deletions

No files matched your search

+16
View File
@@ -8,6 +8,22 @@ 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.
- Client setup says where to switch HD graphics; Custom Races patch card is translated.
- Clean server logs by hand or automatically when they grow too big.
- The startup limit for companions now creates the ones that are missing.
- Restart the world every week on a chosen day and time.
[Release](https://github.com/Corfirean/coa-server-manager/releases/tag/v0.9.16) · [Source changes](https://github.com/Corfirean/coa-server-manager/compare/v0.9.15...v0.9.16)
## 0.9.15 — 2026-11-19
- The Custom Races client update brings version 2.0.2.
Generated
+4 -4
View File
@@ -586,7 +586,7 @@ dependencies = [
[[package]]
name = "coa-core"
version = "0.9.16"
version = "0.9.17"
dependencies = [
"base64 0.22.1",
"chrono",
@@ -621,7 +621,7 @@ dependencies = [
[[package]]
name = "coa-launcher"
version = "0.9.16"
version = "0.9.17"
dependencies = [
"coa-core",
"serde_json",
@@ -644,7 +644,7 @@ dependencies = [
[[package]]
name = "coa-release"
version = "0.9.16"
version = "0.9.17"
dependencies = [
"chrono",
"coa-core",
@@ -653,7 +653,7 @@ dependencies = [
[[package]]
name = "coa-server-manager"
version = "0.9.16"
version = "0.9.17"
dependencies = [
"coa-control-proto",
"coa-core",
+1 -1
View File
@@ -4,7 +4,7 @@ members = ["crates/coa-core", "crates/coa-launcher", "crates/coa-release", "crat
exclude = ["services/coa-registry", "services/coa-registry-e2e", "services/coa-coordinator", "services/coa-relay"]
[workspace.package]
version = "0.9.16"
version = "0.9.17"
edition = "2021"
license = "AGPL-3.0-only"
+7
View File
@@ -0,0 +1,7 @@
---
area: manager
type: fixed
audience: players
title: The game client link points to the new community site, conquestofazerothcore.to
---
The old community website no longer works, so the client setup dialog now opens conquestofazerothcore.to, where you download the launcher and sign in.
@@ -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.
+33 -1
View File
@@ -191,7 +191,13 @@
"Corfirean/coa-server-manager:20261115-v2-feature-switches.md",
"Corfirean/coa-server-manager:20261116-companions-wildcard-reborn.md",
"Corfirean/coa-server-manager:20261116-custom-race-characters-off.md",
"Corfirean/coa-server-manager:20261118-custom-races-2-0-2-client.md"
"Corfirean/coa-server-manager:20261117-client-download-needs-launcher.md",
"Corfirean/coa-server-manager:20261118-custom-races-2-0-2-client.md",
"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:20261123-client-site-link.md"
],
"releases": [
{
@@ -982,6 +988,32 @@
],
"commit": "2b9021ce072e3b6c7e9c8106f8a54f59f1b37424",
"compare": "https://github.com/Corfirean/coa-server-manager/compare/v0.9.14...v0.9.15"
},
{
"tag": "v0.9.16",
"version": "0.9.16",
"date": "2026-11-20",
"url": "https://github.com/Corfirean/coa-server-manager/releases/tag/v0.9.16",
"notes": [
"The game client now comes from the community launcher, not from the Manager",
"Client setup says where to switch HD graphics; Custom Races patch card is translated",
"Clean server logs by hand or automatically when they grow too big",
"The startup limit for companions now creates the ones that are missing",
"Restart the world every week on a chosen day and time"
],
"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"
}
]
}
+2 -2
View File
@@ -1,12 +1,12 @@
{
"name": "coa-server-manager",
"version": "0.9.16",
"version": "0.9.17",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "coa-server-manager",
"version": "0.9.16",
"version": "0.9.17",
"dependencies": {
"@tauri-apps/api": "^2.12.0",
"@tauri-apps/plugin-dialog": "^2.8.0",
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "coa-server-manager",
"private": true,
"version": "0.9.16",
"version": "0.9.17",
"license": "AGPL-3.0-only",
"type": "module",
"scripts": {
+1 -1
View File
@@ -2680,7 +2680,7 @@ fn open_link(url: String) -> std::result::Result<(), UiError> {
"https://login.tailscale.com/",
"https://portforward.com/",
"https://github.com/Corfirean/",
"https://coa-development.org/",
"https://conquestofazerothcore.to/",
];
// A prefilled "new issue" page of one of the places a report can go (the Manager, Companions, SQUID Playerbots): the
// address must be exactly that page, and its query may carry `&` between the (percent-encoded) title and text.
+1 -1
View File
@@ -1,7 +1,7 @@
{
"$schema": "https://schema.tauri.app/config/2",
"productName": "CoA Server Manager",
"version": "0.9.16",
"version": "0.9.17",
"identifier": "com.coa.servermanager",
"build": {
"beforeDevCommand": "npm run dev",
+10 -5
View File
@@ -58,7 +58,8 @@
"Client setup says where to switch HD graphics; Custom Races patch card is translated": "Установка клиента подсказывает, где переключить HD-графику; карточка патча Custom Races переведена",
"Clean server logs by hand or automatically when they grow too big": "Очищайте логи сервера вручную или автоматически, когда они становятся слишком большими",
"The startup limit for companions now creates the ones that are missing": "Лимит запуска компаньонов теперь создаёт недостающих",
"Restart the world every week on a chosen day and time": "Перезапускайте мир каждую неделю в выбранный день и время"
"Restart the world every week on a chosen day and time": "Перезапускайте мир каждую неделю в выбранный день и время",
"The game client link points to the new community site, conquestofazerothcore.to": "Ссылка на клиент игры ведёт на новый сайт сообщества conquestofazerothcore.to"
},
"de": {
"Choose Parallel or Global level scaling in module settings": "Parallele oder globale Levelskalierung in den Moduleinstellungen wählen",
@@ -118,7 +119,8 @@
"Client setup says where to switch HD graphics; Custom Races patch card is translated": "Die Client-Einrichtung sagt, wo man die HD-Grafik umschaltet; die Karte des Custom-Races-Patches ist übersetzt",
"Clean server logs by hand or automatically when they grow too big": "Serverlogs von Hand oder automatisch bereinigen, wenn sie zu groß werden",
"The startup limit for companions now creates the ones that are missing": "Das Startlimit für Begleiter erstellt jetzt die fehlenden",
"Restart the world every week on a chosen day and time": "Die Welt jede Woche an einem gewählten Tag und zu einer gewählten Zeit neu starten"
"Restart the world every week on a chosen day and time": "Die Welt jede Woche an einem gewählten Tag und zu einer gewählten Zeit neu starten",
"The game client link points to the new community site, conquestofazerothcore.to": "Der Link zum Spielclient führt jetzt zur neuen Community-Website conquestofazerothcore.to"
},
"fr": {
"Choose Parallel or Global level scaling in module settings": "Choisissez une progression parallèle ou globale des niveaux dans les paramètres du module",
@@ -178,7 +180,8 @@
"Client setup says where to switch HD graphics; Custom Races patch card is translated": "La configuration du client indique où changer les graphismes HD ; la carte du patch Custom Races est traduite",
"Clean server logs by hand or automatically when they grow too big": "Nettoyez les journaux du serveur à la main ou automatiquement quand ils deviennent trop gros",
"The startup limit for companions now creates the ones that are missing": "La limite de démarrage des compagnons crée maintenant ceux qui manquent",
"Restart the world every week on a chosen day and time": "Redémarrez le monde chaque semaine au jour et à l’heure choisis"
"Restart the world every week on a chosen day and time": "Redémarrez le monde chaque semaine au jour et à l’heure choisis",
"The game client link points to the new community site, conquestofazerothcore.to": "Le lien vers le client du jeu mène au nouveau site de la communauté, conquestofazerothcore.to"
},
"es": {
"Choose Parallel or Global level scaling in module settings": "Elige escalado de nivel paralelo o global en los ajustes del módulo",
@@ -238,7 +241,8 @@
"Client setup says where to switch HD graphics; Custom Races patch card is translated": "La configuración del cliente indica dónde cambiar los gráficos HD; la tarjeta del parche de Custom Races está traducida",
"Clean server logs by hand or automatically when they grow too big": "Limpia los registros del servidor a mano o automáticamente cuando crecen demasiado",
"The startup limit for companions now creates the ones that are missing": "El límite de inicio de los compañeros ahora crea los que faltan",
"Restart the world every week on a chosen day and time": "Reinicia el mundo cada semana en el día y la hora elegidos"
"Restart the world every week on a chosen day and time": "Reinicia el mundo cada semana en el día y la hora elegidos",
"The game client link points to the new community site, conquestofazerothcore.to": "El enlace al cliente del juego apunta al nuevo sitio de la comunidad, conquestofazerothcore.to"
},
"zh": {
"Choose Parallel or Global level scaling in module settings": "在模块设置中选择并行或全局等级缩放",
@@ -298,7 +302,8 @@
"Client setup says where to switch HD graphics; Custom Races patch card is translated": "客户端设置会说明在哪里切换 HD 画质;Custom Races 补丁卡片已翻译",
"Clean server logs by hand or automatically when they grow too big": "手动清理服务器日志,或在日志过大时自动清理",
"The startup limit for companions now creates the ones that are missing": "同伴的启动上限现在会创建缺少的同伴",
"Restart the world every week on a chosen day and time": "每周在选定的日期和时间重启世界"
"Restart the world every week on a chosen day and time": "每周在选定的日期和时间重启世界",
"The game client link points to the new community site, conquestofazerothcore.to": "游戏客户端链接现指向新的社区网站 conquestofazerothcore.to"
}
},
"server": {
+1 -1
View File
@@ -650,7 +650,7 @@ const de: Partial<Record<keyof typeof en, string>> = {
"client.setup.title": "Spielclient einrichten",
"client.setup.intro": "Zum Spielen brauchst du den Spielclient. Die Community gibt ihn über ihren offiziellen Launcher heraus.",
"client.setup.have": "Ich habe bereits einen Client",
"client.setup.getLauncher": "Launcher holen (coa-development.org)",
"client.setup.getLauncher": "Launcher holen (conquestofazerothcore.to)",
"client.setup.getLauncherHint": "Öffnet die Website der Community im Browser. Lade dort den Launcher herunter, installiere ihn, melde dich mit deinem Konto an und lass ihn das Spiel laden (etwa 43 GB).",
"client.setup.haveHint": "Wähle den Ordner, in den der Launcher das Spiel installiert hat, oder eine andere Kopie des Clients.",
"client.setup.hdHint": "Standard- oder HD-Grafik wählst du im Launcher: Öffne dort die Einstellungen und schalte „HD graphics“ um. Der Manager kann das nicht ändern.",
+1 -1
View File
@@ -758,7 +758,7 @@ const en = {
"client.setup.title": "Set up the game client",
"client.setup.intro": "To play you need the game client. The community hands it out through its official launcher.",
"client.setup.have": "I already have a client",
"client.setup.getLauncher": "Get the launcher (coa-development.org)",
"client.setup.getLauncher": "Get the launcher (conquestofazerothcore.to)",
"client.setup.getLauncherHint": "Opens the community website in your browser. Download and install the launcher there, sign in with your account and let it download the game (about 43 GB).",
"client.setup.haveHint": "Pick the folder the launcher installed the game to, or any other copy of the client.",
"client.setup.hdHint": "Standard or HD graphics is chosen in the launcher: open its Settings and switch \"HD graphics\". The Manager cannot change it.",
+1 -1
View File
@@ -650,7 +650,7 @@ const es: Partial<Record<keyof typeof en, string>> = {
"client.setup.title": "Configurar el cliente del juego",
"client.setup.intro": "Para jugar necesitas el cliente del juego. La comunidad lo entrega a través de su launcher oficial.",
"client.setup.have": "Ya tengo un cliente",
"client.setup.getLauncher": "Obtener el launcher (coa-development.org)",
"client.setup.getLauncher": "Obtener el launcher (conquestofazerothcore.to)",
"client.setup.getLauncherHint": "Abre la web de la comunidad en tu navegador. Descarga e instala allí el launcher, inicia sesión con tu cuenta y deja que descargue el juego (unos 43 GB).",
"client.setup.haveHint": "Elige la carpeta donde el launcher instaló el juego, o cualquier otra copia del cliente.",
"client.setup.hdHint": "Los gráficos estándar o HD se eligen en el launcher: abre sus Ajustes y cambia «HD graphics». El Manager no puede cambiarlo.",
+1 -1
View File
@@ -650,7 +650,7 @@ const fr: Partial<Record<keyof typeof en, string>> = {
"client.setup.title": "Configurer le client du jeu",
"client.setup.intro": "Pour jouer, il faut le client du jeu. La communauté le distribue via son lanceur officiel.",
"client.setup.have": "J’ai déjà un client",
"client.setup.getLauncher": "Obtenir le lanceur (coa-development.org)",
"client.setup.getLauncher": "Obtenir le lanceur (conquestofazerothcore.to)",
"client.setup.getLauncherHint": "Ouvre le site de la communauté dans votre navigateur. Téléchargez et installez-y le lanceur, connectez-vous avec votre compte et laissez-le télécharger le jeu (environ 43 Go).",
"client.setup.haveHint": "Choisissez le dossier où le lanceur a installé le jeu, ou toute autre copie du client.",
"client.setup.hdHint": "Les graphismes standard ou HD se choisissent dans le lanceur : ouvrez ses Paramètres et basculez « HD graphics ». Le Manager ne peut pas le modifier.",
+1 -1
View File
@@ -741,7 +741,7 @@ const ru: Partial<Record<keyof typeof en, string>> = {
"client.setup.title": "Настройка клиента игры",
"client.setup.intro": "Чтобы играть, нужен клиент игры. Сообщество выдаёт его через свой официальный лаунчер.",
"client.setup.have": "У меня уже есть клиент",
"client.setup.getLauncher": "Скачать лаунчер (coa-development.org)",
"client.setup.getLauncher": "Скачать лаунчер (conquestofazerothcore.to)",
"client.setup.getLauncherHint": "Откроет сайт сообщества в браузере. Скачайте и установите лаунчер, войдите в свой аккаунт и дайте ему скачать игру (около 43 ГБ).",
"client.setup.haveHint": "Укажите папку, куда лаунчер установил игру, или любую другую копию клиента.",
"client.setup.hdHint": "Стандартная или HD-графика выбирается в лаунчере: откройте его «Настройки» и переключите «HD graphics». Менеджер этого изменить не может.",
+1 -1
View File
@@ -712,7 +712,7 @@ const zh = {
"client.setup.title": "配置游戏客户端",
"client.setup.intro": "进行游戏需要安装客户端。社区通过其官方启动器提供客户端。",
"client.setup.have": "已有游戏客户端",
"client.setup.getLauncher": "获取启动器(coa-development.org)",
"client.setup.getLauncher": "获取启动器(conquestofazerothcore.to)",
"client.setup.getLauncherHint": "在浏览器中打开社区网站。在那里下载并安装启动器,用你的账号登录,让它下载游戏(约 43 GB)。",
"client.setup.haveHint": "选择启动器安装游戏的文件夹,或任何其他客户端副本。",
"client.setup.hdHint": "标准或高清画质在启动器中选择:打开启动器的“设置”,切换“HD graphics”。Manager 无法更改。",
+5
View File
@@ -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 -1
View File
@@ -7,7 +7,7 @@ import { Card } from "@/components/ui/card";
import { useHuman, useT } from "@/i18n";
/** Where the community hands out its launcher, which downloads the game client. The Manager does not download it. */
export const CLIENT_SITE = "https://coa-development.org/";
export const CLIENT_SITE = "https://conquestofazerothcore.to/";
type Phase = "choose" | "done" | "failed";
+13 -8
View File
@@ -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);
+2 -6
View File
@@ -1,10 +1,6 @@
{
"version": "0.9.16",
"version": "0.9.17",
"notes": [
"The game client now comes from the community launcher, not from the Manager",
"Client setup says where to switch HD graphics; Custom Races patch card is translated",
"Clean server logs by hand or automatically when they grow too big",
"The startup limit for companions now creates the ones that are missing",
"Restart the world every week on a chosen day and time"
"The game client link points to the new community site, conquestofazerothcore.to"
]
}
+96
View File
@@ -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("&quot;", '"');
}
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/);
});