mirror of
https://github.com/Corfirean/coa-server-manager.git
synced 2026-11-22 03:25:56 +00:00
Merge master into feat/portable-characters
This commit is contained in:
commit
2b95553168
44 files changed
+2614
-108
No files matched your search
+48
-2
@@ -265,6 +265,16 @@ export interface ReportTarget {
|
||||
ours: boolean;
|
||||
}
|
||||
|
||||
/** The kind of server this computer installs: a repack (Windows) or Docker containers (Linux). */
|
||||
export type Flavor = "repack" | "docker";
|
||||
|
||||
export interface InstallEnvironment {
|
||||
flavor: Flavor;
|
||||
default_dir: string;
|
||||
/** Why Docker cannot be used, in its own words; null when it works. */
|
||||
docker_problem: string | null;
|
||||
}
|
||||
|
||||
export interface InstallRequirements {
|
||||
download_bytes: number;
|
||||
unpacked_bytes: number;
|
||||
@@ -379,6 +389,22 @@ export interface ClientDownloadCheck {
|
||||
dest: string;
|
||||
}
|
||||
|
||||
export type ClientPatchState = "not-installed" | "enabled" | "disabled" | "partially-installed";
|
||||
|
||||
export interface CustomRacesClientStatus {
|
||||
state: ClientPatchState;
|
||||
installedMpqs: number;
|
||||
totalMpqs: number;
|
||||
hasRootFiles: boolean;
|
||||
clientPath: string | null;
|
||||
}
|
||||
|
||||
export interface CustomRacesProgress {
|
||||
id: string;
|
||||
step: string;
|
||||
percent: number;
|
||||
}
|
||||
|
||||
export type FriendsMode = "local" | "lan" | "direct" | "private";
|
||||
|
||||
export interface LanAddress {
|
||||
@@ -421,6 +447,21 @@ export interface ConsoleLine {
|
||||
level: "info" | "warn" | "error";
|
||||
}
|
||||
|
||||
export interface CrashItem {
|
||||
id: string;
|
||||
timestamp_ms: number;
|
||||
date_str: string;
|
||||
title: string;
|
||||
explanation: string;
|
||||
category: "assertion" | "access_violation" | "stack_overflow" | "out_of_memory" | "database" | "network" | "exception" | "generic";
|
||||
exception_code?: string | null;
|
||||
location?: string | null;
|
||||
function?: string | null;
|
||||
condition?: string | null;
|
||||
preview: string;
|
||||
full_log: string;
|
||||
}
|
||||
|
||||
export const api = {
|
||||
remoteConnection: () => invoke<RemoteConnection>("remote_connection"),
|
||||
remoteConnect: (host: string) => invoke<RemoteConnection>("remote_connect", { host }),
|
||||
@@ -454,7 +495,8 @@ export const api = {
|
||||
deleteBackup: (id: string, backupId: string) => invoke<void>("delete_backup", { id, backupId }),
|
||||
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 }),
|
||||
installPreflight: (dest: string, needed?: number) => invoke<Preflight>("install_preflight", { dest, needed: needed ?? null }),
|
||||
installEnvironment: () => invoke<InstallEnvironment>("install_environment"),
|
||||
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 }),
|
||||
realmlistSave: (id: string, profileId: string | null, name: string, data: string) => invoke<RealmProfile>("realmlist_save", { id, profileId, name, data }),
|
||||
@@ -473,7 +515,7 @@ export const api = {
|
||||
accountSetAccess: (id: string, name: string, level: number) => invoke<void>("account_set_access", { id, name, level }),
|
||||
accountRename: (id: string, name: string, newName: string, password: string) => invoke<void>("account_rename", { id, name, newName, password }),
|
||||
accountDelete: (id: string, name: string) => invoke<void>("account_delete", { id, name }),
|
||||
installNew: (dest: string, pkg?: string) => invoke<ServerSummary>("install_new", { dest, package: pkg ?? null }),
|
||||
installNew: (dest: string, pkg?: string, gameData?: string) => invoke<ServerSummary>("install_new", { dest, package: pkg ?? null, gameData: gameData ?? null }),
|
||||
cancelInstall: () => invoke<void>("cancel_install"),
|
||||
createAccount: (id: string, username: string, password: string, administrator: boolean) =>
|
||||
invoke<void>("create_account", { id, username, password, administrator }),
|
||||
@@ -503,6 +545,9 @@ export const api = {
|
||||
clientSync: (id: string, keepModified: boolean) => invoke<void>("client_sync", { id, keepModified }),
|
||||
clientDownload: (id: string, parent: string) => invoke<ClientInfo>("client_download", { id, parent }),
|
||||
clientCancel: () => invoke<void>("client_cancel"),
|
||||
customRacesStatus: (id: string) => invoke<CustomRacesClientStatus | null>("custom_races_status", { id }),
|
||||
customRacesInstall: (id: string) => invoke<void>("custom_races_install", { id }),
|
||||
customRacesToggleClient: (id: string, enabled: boolean) => invoke<void>("custom_races_toggle_client", { id, enabled }),
|
||||
play: (id: string) => invoke<DriverOutcome>("play", { id }),
|
||||
friendsStatus: (id: string) => invoke<FriendsStatus>("friends_status", { id }),
|
||||
friendsCheckInternet: () => invoke<InternetCheck>("friends_check_internet"),
|
||||
@@ -512,6 +557,7 @@ export const api = {
|
||||
runDiagnostics: (id: string) => invoke<{ checks: DiagCheck[]; problems: number }>("run_diagnostics", { id }),
|
||||
verifyFiles: (id: string) => invoke<{ path: string; kind: "missing" | "changed" }[]>("verify_files", { id }),
|
||||
exportDiagnostics: (id: string) => invoke<string>("export_diagnostics", { id }),
|
||||
listCrashes: (id: string, limit?: number) => invoke<CrashItem[]>("list_crashes", { id, limit: limit ?? null }),
|
||||
consoleTail: (id: string, source: ConsoleSource, filter?: string, lines = 300) =>
|
||||
invoke<ConsoleLine[]>("console_tail", { id, source, filter: filter ?? null, lines }),
|
||||
consoleRisk: (command: string) => invoke<"normal" | "dangerous">("console_risk", { command }),
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
import { useState } from "react";
|
||||
|
||||
const key = (id: string) => `coa-auto-restart-on-crash:${id}`;
|
||||
const fallback = () => false;
|
||||
|
||||
export function autoRestartOnCrash(id: string): boolean {
|
||||
try {
|
||||
const value = localStorage.getItem(key(id));
|
||||
return value === null ? fallback() : value === "1";
|
||||
} catch {
|
||||
return fallback();
|
||||
}
|
||||
}
|
||||
|
||||
export function setAutoRestartOnCrash(id: string, on: boolean) {
|
||||
try {
|
||||
localStorage.setItem(key(id), on ? "1" : "0");
|
||||
} catch {
|
||||
/* storage unavailable */
|
||||
}
|
||||
}
|
||||
|
||||
export function useAutoRestart(id: string): [boolean, (on: boolean) => void] {
|
||||
const [on, setOn] = useState(() => autoRestartOnCrash(id));
|
||||
return [
|
||||
on,
|
||||
(next) => {
|
||||
setAutoRestartOnCrash(id, next);
|
||||
setOn(next);
|
||||
},
|
||||
];
|
||||
}
|
||||
@@ -85,6 +85,11 @@ for (const [key, title, desc] of [
|
||||
] as [string, string[], string[]][]) add(`Enchanter.${key}`, "int", title, desc, { min: 0, advanced: true });
|
||||
for (let n = 1; n <= 3; n++) add(`EC.P${n}`, "string", [`NPC phrase ${n}`, `Реплика НПС ${n}`, `NPC-Satz ${n}`, `Phrase du PNJ ${n}`, `Frase del PNJ ${n}`, `NPC台词 ${n}`], ["Text spoken by the NPC. Keep the enclosing quotes.", "Текст реплики НПС. Сохраните кавычки вокруг текста.", "Gesprochener Text. Anführungszeichen beibehalten.", "Texte prononcé. Conservez les guillemets.", "Texto hablado. Conserva las comillas.", "NPC发言内容,请保留外层引号。"], { advanced: true });
|
||||
|
||||
add("CoACustomRaces.BotsEnable", "bool",
|
||||
["Bots can be custom races", "Боты кастомных рас", "Bots benutzerdefinierter Völker", "Bots de races personnalisées", "Bots de razas personalizadas", "允许机器人为自定义种族"],
|
||||
["Allow Playerbots to spawn as custom races.", "Разрешает ботам-игрокам появляться кастомными расами.", "Erlaubt Spieler-Bots, benutzerdefinierte Völker zu nutzen.", "Autorise les bots joueurs à s’incarner avec des races personnalisées.", "Permite a los bots jugadores crearse con razas personalizadas.", "允许玩家机器人扮演自定义种族。"]
|
||||
);
|
||||
|
||||
const ah = "AuctionHouseBot.";
|
||||
add(ah + "GUIDs", "string", ["Auction characters", "Персонажи аукциона", "Auktionscharaktere", "Personnages d’enchères", "Personajes de subasta", "拍卖角色"], ["Leave 0 and the server creates and uses its own auction character. To use your own, enter GUIDs separated by commas, without spaces; use dedicated offline characters, not companion bots.", "Оставьте 0, и сервер сам создаст и будет использовать своего персонажа аукциона. Чтобы использовать своих, укажите GUID через запятую без пробелов; нужны отдельные офлайн-персонажи, не боты-компаньоны.", "Bei 0 legt der Server selbst einen Auktionscharakter an und nutzt ihn. Eigene Charaktere: GUIDs durch Kommas, ohne Leerzeichen; separate Offline-Charaktere verwenden, keine Begleiter-Bots.", "Laissez 0 : le serveur crée et utilise son propre personnage d’enchères. Pour les vôtres, indiquez des GUID séparés par des virgules sans espaces ; personnages dédiés hors ligne, pas des bots compagnons.", "Deja 0 y el servidor crea y usa su propio personaje de subastas. Para usar los tuyos, indica GUID separados por comas sin espacios; personajes dedicados desconectados, no bots acompañantes.", "保持0时由服务器自动创建并使用拍卖角色。要使用自己的角色,请以逗号分隔填写GUID,不加空格;使用专用离线角色,勿用伙伴机器人。"], { advanced: true });
|
||||
add(ah + "EnableSeller", "bool", ["Post auctions", "Выставлять лоты", "Auktionen einstellen", "Publier des enchères", "Publicar subastas", "发布拍卖"], ["Let the auction characters sell items. The module switch is also required.", "Разрешает персонажам продавать предметы. Нужен включённый модуль.", "Erlaubt Verkäufe. Der Modulschalter muss ebenfalls aktiv sein.", "Autorise les ventes. Le module doit aussi être activé.", "Permite vender. También requiere el módulo activado.", "允许拍卖角色出售物品,还需启用模块。"]);
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
export interface UnsavedChangesGuard {
|
||||
isDirty: () => boolean;
|
||||
save: () => Promise<boolean>;
|
||||
discard: () => void;
|
||||
}
|
||||
Reference in new issue
Block a user