mirror of
https://github.com/Corfirean/coa-server-manager.git
synced 2026-11-21 11:25:56 +00:00
feat: a wrong game data folder is diagnosed, and it can be changed from Settings
The world refusing to start with the standard Data set (no CoA DBC) is now reported as GameDataMismatch. A Settings card shows the folder in use and changes it while the server is stopped, using the install checks.
This commit is contained in:
1 parent
dfd8a50975
commit
0250b61c62
11 files changed
+151
-1
No files matched your search
@@ -92,6 +92,8 @@ export {};
|
||||
if(cmd==="open_link"){(window as any).__lastLink=args.url;return null;}
|
||||
if(cmd==="export_diagnostics") return "C:\\Users\\you\\Desktop\\CoA-Diagnostics-20261001-140000.zip";
|
||||
if(cmd==="list_crashes") return [];
|
||||
if(cmd==="game_data_folder") return new URLSearchParams(location.search).get("flavor")==="docker"?"/srv/coa/server-data":null;
|
||||
if(cmd==="set_game_data_folder") return args.path;
|
||||
if(cmd==="install_environment"){const docker=new URLSearchParams(location.search).get("flavor")==="docker";return docker?{flavor:"docker",default_dir:"/home/you/CoaServer",docker_problem:new URLSearchParams(location.search).has("nodocker")?"permission denied while trying to connect to the Docker daemon socket":null}:{flavor:"repack",default_dir:"C:\\Games\\CoA Server",docker_problem:null};}
|
||||
if(cmd==="install_preflight") return {ok:true,problems:[],free_bytes:210*2**30};
|
||||
if(cmd==="install_requirements") return {download_bytes:Math.round(5.9*2**30),unpacked_bytes:Math.round(11.4*2**30),version:"0.2.0"};
|
||||
|
||||
@@ -144,6 +144,8 @@ const en = {
|
||||
"err.operation_in_progress.message": "The server is busy starting or stopping. Wait a moment and try again.",
|
||||
"err.startup_failed.title": "Server could not start",
|
||||
"err.startup_failed.message": "A service stopped while starting. Check the details for the cause.",
|
||||
"err.game_data_mismatch.title": "The game data folder is not the CoA set",
|
||||
"err.game_data_mismatch.message": "The server stopped because the DBC files in the game data folder are not the ones of the Conquest of Azeroth client. Choose the folder that holds the CoA data (Settings > Game data folder), then start again.",
|
||||
"err.docker_unavailable.title": "Docker is not available",
|
||||
"err.docker_unavailable.message": "This server runs in Docker. Install Docker, start it, and make sure your user account may use it, then try again.",
|
||||
"err.hash_mismatch.title": "A downloaded file is damaged",
|
||||
@@ -191,6 +193,11 @@ const en = {
|
||||
"install.localPkg": "Install from a local package folder instead of downloading",
|
||||
"install.localPkgHint": "(leave empty to download)",
|
||||
"install.button": "Install",
|
||||
"gamedata.title": "Game data folder",
|
||||
"gamedata.text": "The folder with the game's dbc, maps, vmaps and mmaps that this server reads. It is used where it is and never changed. It must be the Conquest of Azeroth set, not the standard one. Stop the server before changing it.",
|
||||
"gamedata.change": "Change…",
|
||||
"gamedata.dialog": "Choose the game data folder",
|
||||
"gamedata.saved": "Saved. It is used the next time the server starts.",
|
||||
"install.docker.title": "Docker is needed",
|
||||
"install.docker.text": "On Linux the server runs in Docker. Install Docker and start it, or allow your user to use it, then check again.",
|
||||
"install.docker.retry": "Check again",
|
||||
|
||||
@@ -498,6 +498,9 @@ export const api = {
|
||||
restoreConfigs: (id: string, backupId: string) => invoke<RecoveryPoint>("restore_backup_configs", { id, backupId }),
|
||||
restoreDatabase: (id: string, backupId: string, database: string) => invoke<DbRestore>("restore_backup_database", { id, backupId, database }),
|
||||
installEnvironment: () => invoke<InstallEnvironment>("install_environment"),
|
||||
/** The game data folder of a Docker server; null for a repack. */
|
||||
gameDataFolder: (id: string) => invoke<string | null>("game_data_folder", { id }),
|
||||
setGameDataFolder: (id: string, path: string) => invoke<string>("set_game_data_folder", { id, path }),
|
||||
installPreflight: (dest: string, needed?: number, gameData?: string) => invoke<Preflight>("install_preflight", { dest, needed: needed ?? null, gameData: gameData ?? null }),
|
||||
installRequirements: (pkg?: string) => invoke<InstallRequirements>("install_requirements", { package: pkg ?? null }),
|
||||
realmlistProfiles: (id: string) => invoke<{ profiles: RealmProfile[]; active: string | null }>("realmlist_profiles", { id }),
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
import { useEffect, useState } from "react";
|
||||
import { open } from "@tauri-apps/plugin-dialog";
|
||||
import { api, asUiError } from "@/lib/api";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Card } from "@/components/ui/card";
|
||||
import { useT } from "@/i18n";
|
||||
|
||||
/** Where a Docker server reads the game data from. Not shown for a repack, which keeps its data in its own folder. */
|
||||
export function GameDataCard({ serverId }: { serverId: string }) {
|
||||
const t = useT();
|
||||
const [folder, setFolder] = useState<string | null>(null);
|
||||
const [message, setMessage] = useState<{ ok: boolean; text: string } | null>(null);
|
||||
|
||||
useEffect(() => {
|
||||
let alive = true;
|
||||
void api.gameDataFolder(serverId).then((f) => alive && setFolder(f)).catch(() => alive && setFolder(null));
|
||||
return () => { alive = false; };
|
||||
}, [serverId]);
|
||||
|
||||
if (folder === null) return null;
|
||||
|
||||
async function change() {
|
||||
const picked = await open({ directory: true, multiple: false, title: t("gamedata.dialog"), defaultPath: folder ?? undefined });
|
||||
if (typeof picked !== "string") return;
|
||||
try {
|
||||
setFolder(await api.setGameDataFolder(serverId, picked));
|
||||
setMessage({ ok: true, text: t("gamedata.saved") });
|
||||
} catch (e) {
|
||||
setMessage({ ok: false, text: asUiError(e).technical });
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<Card className="mt-6 p-6">
|
||||
<h2 className="font-semibold">{t("gamedata.title")}</h2>
|
||||
<p className="mt-1 text-sm text-muted">{t("gamedata.text")}</p>
|
||||
<div className="mt-3 flex items-center gap-3">
|
||||
<code className="selectable min-w-0 flex-1 truncate rounded-md border border-line bg-card px-3 py-2 text-sm" title={folder}>{folder}</code>
|
||||
<Button onClick={() => void change()}>{t("gamedata.change")}</Button>
|
||||
</div>
|
||||
{message && <p className={message.ok ? "mt-2 text-sm text-ok" : "mt-2 text-sm text-bad"} role="status">{message.text}</p>}
|
||||
</Card>
|
||||
);
|
||||
}
|
||||
@@ -7,6 +7,7 @@ import { api, asUiError, type UiError, type UpdatePreview, type UpdateTxn } from
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Card } from "@/components/ui/card";
|
||||
import { ClientCard } from "@/screens/ClientCard";
|
||||
import { GameDataCard } from "@/screens/GameDataCard";
|
||||
import { DiagnosticsCard } from "@/screens/DiagnosticsCard";
|
||||
import { AboutCard } from "@/screens/AboutCard";
|
||||
import { RemoveServerCard } from "@/screens/RemoveServerCard";
|
||||
@@ -174,6 +175,8 @@ export function SettingsHome({ serverId, path, onForget }: { serverId: string; p
|
||||
<RealmStartupSettings serverId={serverId} />
|
||||
<AutoRestartSettings serverId={serverId} />
|
||||
|
||||
<GameDataCard serverId={serverId} />
|
||||
|
||||
<DiagnosticsCard serverId={serverId} />
|
||||
<RepairCard key={serverId} serverId={serverId} />
|
||||
|
||||
|
||||
Reference in new issue
Block a user