mirror of
https://github.com/Corfirean/coa-server-manager.git
synced 2026-11-19 03:25:56 +00:00
Merge pull request #70 from lostmind84/feat/linux-b4-parity
feat: Docker server parity on Linux (realm online, game data folder, settings, sharing)
This commit is contained in:
24 files changed
+692
-15
No files matched your search
@@ -170,7 +170,7 @@ export function FriendsPage({ serverId }: { serverId: string }) {
|
||||
<ul className="mt-2 divide-y divide-line">
|
||||
<Line ok={st.server_running}>{t("fr.st.running")}</Line>
|
||||
<Line ok={st.servers_open}>{t("fr.st.open")}</Line>
|
||||
<Line ok={st.firewall.auth && st.firewall.world}>{t("fr.st.firewall")}</Line>
|
||||
{st.firewall && <Line ok={st.firewall.auth && st.firewall.world}>{t("fr.st.firewall")}</Line>}
|
||||
<Line ok={st.exposure.filter((e) => e.what === "database" || e.what === "server console").every((e) => !e.reachable_from_network)}>
|
||||
{t("fr.st.private")}
|
||||
</Line>
|
||||
|
||||
@@ -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>
|
||||
);
|
||||
}
|
||||
@@ -46,21 +46,22 @@ function Row({ label, s }: { label: string; s: ServiceStatus }) {
|
||||
const t = useT();
|
||||
const running = s.state === "running";
|
||||
const starting = s.state === "starting";
|
||||
const crashed = s.state === "crashed";
|
||||
return (
|
||||
<div className="flex items-center justify-between py-2.5">
|
||||
<span>{label}</span>
|
||||
<span
|
||||
className={cn("flex items-center gap-2 text-sm", running ? "text-ok" : starting ? "text-warn" : "text-muted")}
|
||||
className={cn("flex items-center gap-2 text-sm", running ? "text-ok" : starting || crashed ? "text-warn" : "text-muted")}
|
||||
role="status"
|
||||
>
|
||||
<span
|
||||
aria-hidden
|
||||
className={cn(
|
||||
"h-2 w-2 rounded-full",
|
||||
running ? "bg-ok" : starting ? "animate-[pulse-dot_1.2s_ease-in-out_infinite] bg-warn" : "bg-muted/50",
|
||||
running ? "bg-ok" : starting ? "animate-[pulse-dot_1.2s_ease-in-out_infinite] bg-warn" : crashed ? "bg-warn" : "bg-muted/50",
|
||||
)}
|
||||
/>
|
||||
{running ? t("status.running") : starting ? t("status.starting") : t("status.stopped")}
|
||||
{running ? t("status.running") : starting ? t("status.starting") : crashed ? t("status.crashed") : t("status.stopped")}
|
||||
</span>
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -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