Merge master (0.6.6) into feat/portable-characters

Conflicts were additive only: the rusqlite and if-addrs dependencies sit side by side, and the
portable.* and fr.lan.* translation blocks are both kept in en and ru.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
ДмитрийandClaude Sonnet 5.5 committed 2026-10-07 17:54:17 +05:00
commit d05bfe8b09
89 files changed
+3444 -233

No files matched your search

+27 -3
View File
@@ -193,6 +193,7 @@ export interface RealmProfile {
export interface ModuleView {
id: string;
name: string;
version?: string | null;
description: Record<string, string>;
repo: string;
/** the module is part of this server build (its configuration exists) */
@@ -216,6 +217,7 @@ export interface ModuleSetting {
value: string;
default: string | null;
doc: string;
field?: { key: string; type: string; title: string; description: string; group: string; group_title?: string | null; min?: number | null; max?: number | null } | null;
}
export interface AllSetting {
@@ -232,6 +234,19 @@ export interface ReportContext {
windows: string;
install_kind: "new" | "imported";
server_version: string | null;
/** where the form starts: the bot system that is switched on, else the Manager */
suggested_target: ReportTargetId;
/** the release of the bot system that is on */
bots_version: string | null;
}
export type ReportTargetId = "manager" | "companions" | "squid";
/** A place a problem report can go: its GitHub repository as `owner/name`. */
export interface ReportTarget {
id: ReportTargetId;
repo: string;
ours: boolean;
}
export interface InstallRequirements {
@@ -268,6 +283,7 @@ export interface UpdatePreview {
items: UpdatePlanItem[];
conflicts: string[];
migrations: number;
pending_migrations?: number;
download_bytes: number;
}
@@ -345,9 +361,16 @@ export interface ClientDownloadCheck {
export type FriendsMode = "local" | "lan" | "direct" | "private";
export interface LanAddress {
interface: string;
address: string;
is_default: boolean;
}
export interface FriendsStatus {
settings: { mode: FriendsMode; host: string | null };
settings: { mode: FriendsMode; host: string | null; lan_address_override: string | null };
lan_ip: string | null;
lan_addresses: LanAddress[];
exposure: { port: number; what: string; reachable_from_network: boolean; listening: boolean }[];
servers_open: boolean;
firewall: { auth: boolean; world: boolean };
@@ -416,6 +439,7 @@ export const api = {
allSettings: (id: string) => invoke<AllSetting[]>("all_settings", { id }),
allSettingsSave: (id: string, changes: Record<string, string>) => invoke<string[]>("all_settings_save", { id, changes }),
reportContext: (id: string) => invoke<ReportContext>("report_context", { id }),
reportTargets: () => invoke<ReportTarget[]>("report_targets"),
listAccounts: (id: string) => invoke<AccountInfo[]>("list_accounts", { id }),
accountSetPassword: (id: string, name: string, password: string) => invoke<void>("account_set_password", { id, name, password }),
accountSetAccess: (id: string, name: string, level: number) => invoke<void>("account_set_access", { id, name, level }),
@@ -453,8 +477,8 @@ export const api = {
play: (id: string) => invoke<DriverOutcome>("play", { id }),
friendsStatus: (id: string) => invoke<FriendsStatus>("friends_status", { id }),
friendsCheckInternet: () => invoke<InternetCheck>("friends_check_internet"),
friendsEnable: (id: string, mode: FriendsMode, host?: string, useUpnp = false) =>
invoke<{ host: string; restart_required: boolean; note: string | null }>("friends_enable", { id, mode, host: host ?? null, useUpnp }),
friendsEnable: (id: string, mode: FriendsMode, host?: string, useUpnp = false, lanAddressOverride: string | null = null) =>
invoke<{ host: string; restart_required: boolean; note: string | null }>("friends_enable", { id, mode, host: host ?? null, useUpnp, lanAddressOverride }),
friendsPackage: (id: string) => invoke<string>("friends_package", { id }),
runDiagnostics: (id: string) => invoke<{ checks: DiagCheck[]; problems: number }>("run_diagnostics", { id }),
verifyFiles: (id: string) => invoke<{ path: string; kind: "missing" | "changed" }[]>("verify_files", { id }),
+6 -4
View File
@@ -86,8 +86,8 @@ for (const [key, title, desc] of [
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 });
const ah = "AuctionHouseBot.";
add(ah + "GUIDs", "string", ["Auction characters", "Персонажи аукциона", "Auktionscharaktere", "Personnages d’enchères", "Personajes de subasta", "拍卖角色"], ["Character GUIDs separated by commas, without spaces. Use dedicated offline characters, not companion bots. 0 selects nobody.", "GUID персонажей через запятую без пробелов. Используйте отдельных офлайн-персонажей, не ботов-компаньонов. 0 — никто.", "Charakter-GUIDs durch Kommas, ohne Leerzeichen. Separate Offline-Charaktere verwenden, keine Begleiter-Bots. 0 wählt niemanden.", "GUID séparés par des virgules sans espaces. Utilisez des personnages dédiés hors ligne, pas des bots compagnons. 0 ne sélectionne personne.", "GUID separados por comas sin espacios. Usa personajes dedicados desconectados, no bots acompañantes. 0 no selecciona a nadie.", "角色GUID以逗号分隔,不加空格。使用专用离线角色,勿用伙伴机器人。0不选择任何角色。"]);
add(ah + "EnableSeller", "bool", ["Post auctions", "Выставлять лоты", "Auktionen einstellen", "Publier des enchères", "Publicar subastas", "发布拍卖"], ["Let the auction characters sell items. The module switch and valid character GUIDs are also required.", "Разрешает персонажам продавать предметы. Нужны включённый модуль и действительные GUID персонажей.", "Erlaubt Verkäufe. Modulschalter und gültige Charakter-GUIDs sind ebenfalls erforderlich.", "Autorise les ventes. Le module doit être activé et les GUID valides.", "Permite vender. También requiere el módulo activado y GUID válidos.", "允许拍卖角色出售物品,还需启用模块并填写有效角色GUID。"]);
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.", "允许拍卖角色出售物品,还需启用模块。"]);
add(ah + "CoA.ObtainableItemsOnly", "bool", ["Only obtainable items", "Только доступные в игре предметы", "Nur erhältliche Gegenstände", "Objets accessibles uniquement", "Solo objetos obtenibles", "仅可获取物品"], ["List items from world loot, vendors and professions. Other item filters still apply.", "Выставляет предметы из добычи, торговцев и профессий. Остальные фильтры продолжают действовать.", "Listet Gegenstände aus Beute, Händlern und Berufen. Weitere Filter gelten weiterhin.", "Publie les objets de butin, vendeurs et métiers. Les autres filtres s’appliquent.", "Publica objetos de botín, vendedores y profesiones. Los demás filtros siguen activos.", "发布来自掉落、商人和专业的物品,其他筛选仍生效。"]);
add(ah + "ItemsPerCycle", "int", ["Listings per cycle", "Лотов за цикл", "Angebote pro Durchlauf", "Annonces par cycle", "Anuncios por ciclo", "每轮上架数量"], ["Maximum items posted during one auction update.", "Максимум предметов за одно обновление аукциона.", "Maximale Angebote pro Auktionsaktualisierung.", "Nombre maximal d’objets par mise à jour.", "Máximo de objetos por actualización.", "每轮拍卖更新最多上架的物品数量。"], { min: 0 });
for (const [kind, titles] of [
@@ -104,7 +104,7 @@ for (const [faction, names] of [
`${names[0]}: ${maximum ? "maximum" : "minimum"} listings`, `${names[1]}: ${maximum ? "максимум" : "минимум"} лотов`, `${names[2]}: ${maximum ? "maximale" : "minimale"} Angebote`, `${names[3]} : annonces ${maximum ? "maximales" : "minimales"}`, `${names[4]}: anuncios ${maximum ? "máximos" : "mínimos"}`, `${names[5]}:${maximum ? "最多" : "最少"}上架数量`,
], ["Target listing count for this auction house. Keep the minimum no higher than the maximum.", "Целевое число лотов этого аукциона. Минимум не должен превышать максимум.", "Zielanzahl für dieses Auktionshaus. Minimum nicht höher als Maximum einstellen.", "Nombre cible pour cet hôtel des ventes. Le minimum ne doit pas dépasser le maximum.", "Cantidad objetivo para esta casa de subastas. El mínimo no debe superar el máximo.", "此拍卖行的目标上架数量,最小值不得超过最大值。"], { min: 0 });
}
add(ah + "Buyer.Enabled", "bool", ["Buy player auctions", "Покупать лоты игроков", "Spielerauktionen kaufen", "Acheter les enchères des joueurs", "Comprar subastas de jugadores", "购买玩家拍卖"], ["Enable the auction buyer. It spends the auction characters’ money.", "Включает покупателя. Он тратит деньги персонажей аукциона.", "Aktiviert Käufe mit dem Geld der Auktionscharaktere.", "Active les achats avec l’argent des personnages d’enchères.", "Activa las compras con el dinero de los personajes de subasta.", "启用拍卖买家,会花费拍卖角色的金币。"]);
add(ah + "Buyer.Enabled", "bool", ["Buy player auctions", "Покупать лоты игроков", "Spielerauktionen kaufen", "Acheter les enchères des joueurs", "Comprar subastas de jugadores", "购买玩家拍卖"], ["The auctioneer bot buys listings.", "Бот-аукционист покупает лоты.", "Der Auktionator-Bot kauft Angebote.", "Le bot commissaire-priseur achète des annonces.", "El bot subastador compra anuncios.", "拍卖机器人会购买拍卖品。"]);
add(ah + "Buyer.BuyCandidatesPerBuyCycle", "int", ["Purchase candidates per cycle", "Кандидатов на покупку за цикл", "Kaufkandidaten pro Durchlauf", "Achats potentiels par cycle", "Candidatos de compra por ciclo", "每轮购买候选数量"], ["How many auctions the buyer considers per cycle.", "Сколько лотов покупатель рассматривает за цикл.", "Anzahl geprüfter Auktionen pro Durchlauf.", "Nombre d’enchères examinées par cycle.", "Subastas examinadas por ciclo.", "买家每轮考虑的拍卖数量。"], { min: 0 });
add(ah + "Buyer.AcceptablePriceModifier", "float", ["Buyer price multiplier", "Множитель цены покупателя", "Kaufpreisfaktor", "Multiplicateur du prix d’achat", "Multiplicador del precio de compra", "买家价格倍率"], ["1 uses the calculated price. Higher values allow more expensive purchases.", "1 — расчётная цена. Большие значения допускают более дорогие покупки.", "1 nutzt den berechneten Preis. Höhere Werte erlauben teurere Käufe.", "1 utilise le prix calculé. Une valeur supérieure autorise des achats plus chers.", "1 usa el precio calculado. Valores mayores permiten compras más caras.", "1使用计算价格,增大后允许更高价购买。"], { min: 0 });
add(ah + "MaxBuyoutPriceInCopper", "int", ["Maximum buyout (copper)", "Максимальная цена выкупа (медь)", "Maximaler Sofortkauf (Kupfer)", "Rachat maximal (cuivre)", "Compra máxima (cobre)", "最高一口价(铜币)"], ["Upper price limit. 10,000 copper = 1 gold.", "Верхний предел цены. 10 000 меди = 1 золото.", "Preisobergrenze. 10.000 Kupfer = 1 Gold.", "Prix maximal. 10 000 cuivre = 1 or.", "Precio máximo. 10 000 cobre = 1 oro.", "价格上限,10000铜币=1金币。"], { min: 0 });
@@ -173,7 +173,9 @@ for (const [category, categoryNames] of Object.entries(auctionCategories)) {
{ min: 0, max: 1000, advanced: true },
);
}
export function moduleField(key: string, locale: Locale): ModuleField | undefined {
export function moduleField(key: string, locale: Locale, metadata?: ModuleSetting["field"]): ModuleField | undefined {
const translated = locale !== "en" ? fields.find(f => f.key === key) : undefined;
if (metadata) return { title: translated ? text(translated.title, locale) : metadata.title, description: translated ? text(translated.description, locale) : metadata.description, type: metadata.type, category: metadata.group, advanced: false, min: metadata.min ?? undefined, max: metadata.max ?? undefined };
const field = fields.find(f => f.key === key);
if (field) return { ...field, title: text(field.title, locale), description: text(field.description, locale), category: "general", advanced: field.advanced ?? false, step: field.type === "range" ? 0.05 : undefined, options: field.options?.map(o => ({ value: o.value, label: text(o.label, locale) })) };
const existing = [...bots.settings, ...server.settings].find(s => s.key === key);
+13 -4
View File
@@ -1,9 +1,14 @@
import type { ReportTarget, ReportTargetId } from "./api";
/** The text of a problem report, always in English so whoever reads it on GitHub can follow it; the person's own words go in as typed. */
export interface ReportInput {
managerVersion: string;
windows: string;
installKind: "new" | "imported";
serverVersion: string | null;
/** where the report goes; a bot repository is told which Manager and bot release it came from */
target: ReportTargetId;
botsVersion: string | null;
what: string;
expected: string;
steps: string;
@@ -11,7 +16,10 @@ export interface ReportInput {
diagnostics: boolean;
}
export const NEW_ISSUE_URL = "https://github.com/Corfirean/coa-server-manager/issues/new";
/** The "new issue" page of a repository given as `owner/name`. */
export function newIssueUrl(repo: string): string {
return `https://github.com/${repo}/issues/new`;
}
const PRIVACY = "> Please remove passwords, tokens, private IP information or other sensitive data before posting logs.";
export function reportBody(r: ReportInput): string {
@@ -23,6 +31,7 @@ export function reportBody(r: ReportInput): string {
`**Windows version:** ${r.windows || "unknown"} `,
`**Fresh install or imported server:** ${r.installKind === "new" ? "Fresh install" : "Imported server"} `,
...(r.serverVersion ? [`**Server version:** ${r.serverVersion} `] : []),
...(r.target !== "manager" ? [`**Bot system:** ${r.target === "squid" ? "SQUID Playerbots" : "CoA Companions"}${r.botsVersion ? ` ${r.botsVersion}` : ""} `] : []),
"",
"**What happened?** ",
text(r.what, "Describe the problem."),
@@ -54,9 +63,9 @@ export function encodeQuery(s: string): string {
.join("");
}
/** A link that opens GitHub's "new issue" page with the title and text filled in. */
export function issueUrl(title: string, body: string): string {
return `${NEW_ISSUE_URL}?labels=bug&title=${encodeQuery(title)}&body=${encodeQuery(body)}`;
/** A link that opens GitHub's "new issue" page of `target` with the title and text filled in. The bug label is only asked for in our own repositories. */
export function issueUrl(target: Pick<ReportTarget, "repo" | "ours">, title: string, body: string): string {
return `${newIssueUrl(target.repo)}?${target.ours ? "labels=bug&" : ""}title=${encodeQuery(title)}&body=${encodeQuery(body)}`;
}
/** Links longer than this are not reliable in every browser; the full text is then copied to the clipboard instead. */
+26 -5
View File
@@ -1,6 +1,7 @@
import { useSyncExternalStore } from "react";
import { listen } from "@tauri-apps/api/event";
import { api, asUiError, type UiError, type UpdatePreview, type UpdateTxn } from "@/lib/api";
import { isUpdateCurrent } from "./serverUpdateStatus";
/**
* Server update status for the main screen and the navigation: checked when the app starts and every five minutes,
@@ -16,11 +17,13 @@ export interface ServerUpdateState {
error: string | null;
/** The full error of the last update attempt, for the Settings card. */
uiError: UiError | null;
stateError: UiError | null;
stateRevision: number;
/** How the last update ended; kept here so the Settings card can show it after the user left and came back. */
result: { committed: string } | { pending: UpdateTxn } | null;
}
const EMPTY: ServerUpdateState = { preview: null, available: false, checking: false, applying: false, step: null, percent: 0, error: null, uiError: null, result: null };
const EMPTY: ServerUpdateState = { preview: null, available: false, checking: false, applying: false, step: null, percent: 0, error: null, uiError: null, stateError: null, stateRevision: 0, result: null };
const states = new Map<string, ServerUpdateState>();
const listeners = new Set<() => void>();
export const CHECK_EVERY_MS = 5 * 60 * 1000;
@@ -37,10 +40,10 @@ export async function checkServerUpdate(id: string): Promise<void> {
set(id, { checking: true });
try {
const p = await api.checkUpdate(id);
set(id, { preview: p, available: p.to_version !== (p.from_version ?? ""), error: null });
set(id, { preview: p, available: !isUpdateCurrent(p), error: null });
} catch (e) {
// offline or no package published: keep what we knew and stay quiet
set(id, { error: asUiError(e).human.code });
// A cached offer is no longer safe after an update or failed recheck.
set(id, { preview: null, available: false, error: asUiError(e).human.code });
} finally {
set(id, { checking: false });
}
@@ -57,6 +60,20 @@ export function clearServerUpdateResult(id: string) {
set(id, { result: null, uiError: null });
}
export async function refreshServerUpdateState(id: string): Promise<UpdateTxn | null> {
try {
const pending = await api.pendingUpdate(id);
const current = get(id).result;
set(id, { stateError: null, stateRevision: get(id).stateRevision + 1,
...(pending ? { available: false, preview: null } : {}),
result: pending ? { pending } : current && "committed" in current ? current : null });
return pending;
} catch (e) {
set(id, { stateError: asUiError(e), stateRevision: get(id).stateRevision + 1, available: false, preview: null });
throw e;
}
}
/**
* Apply an update. Without options this is the main-screen button: the pending update, only when no file needs a
* decision. With options (the Settings card) the owner has already chosen what to do with each changed file and may
@@ -65,7 +82,8 @@ export function clearServerUpdateResult(id: string) {
*/
export async function applyServerUpdate(id: string, opts?: { choices: Record<string, "keep" | "replace">; source?: string }): Promise<boolean> {
const p = get(id).preview;
if (get(id).applying) return false;
const current = get(id);
if (current.applying || current.stateError || (current.result && "pending" in current.result)) return false;
if (!opts && (!p || p.conflicts.length > 0)) return false;
set(id, { applying: true, step: null, percent: 0, error: null, uiError: null, result: null });
let un: (() => void) | undefined;
@@ -84,6 +102,9 @@ export async function applyServerUpdate(id: string, opts?: { choices: Record<str
return false;
} finally {
un?.();
try {
await refreshServerUpdateState(id);
} catch { /* The state error remains visible and prevents another apply. */ }
set(id, { applying: false });
void checkServerUpdate(id);
}
+7
View File
@@ -0,0 +1,7 @@
import type { UpdatePreview } from "./api";
export function isUpdateCurrent(preview: UpdatePreview): boolean {
return preview.from_version === preview.to_version
&& preview.items.every((item) => item.action === "skip")
&& (preview.pending_migrations ?? (preview.migrations === 0 ? 0 : undefined)) === 0;
}
+5 -3
View File
@@ -24,7 +24,7 @@ function group(key: string, curated: boolean) {
/** Use the same settings screen as Companions, backed only by shipped SQUID options. */
export function squidSettingsView(items: ModuleSetting[], locale: Locale): SettingsView {
const settings: SettingView[] = items.filter(s => s.key !== "AiPlayerbot.Enabled" && !s.key.startsWith("PlayerbotsDatabase") && !s.key.startsWith("Playerbots.Updates.")).map(s => {
const field = moduleField(s.key, locale);
const field = moduleField(s.key, locale, s.field);
const type = field?.type === "bool" || field?.type === "int" || field?.type === "float" || field?.type === "enum" ? field.type : "string";
const decode = (raw: string): JsonValue => {
const value = raw.trim().replace(/^"|"$/g, "");
@@ -35,11 +35,13 @@ export function squidSettingsView(items: ModuleSetting[], locale: Locale): Setti
const value = decode(s.value), defaultValue = decode(s.default ?? s.value);
return {
key: s.key, type, title: field?.title ?? s.key, description: field?.description ?? s.doc,
category: group(s.key, !!field), advanced: !field || !!field.advanced,
category: s.field?.group ? "squid." + s.field.group : group(s.key, !!field), advanced: !field || !!field.advanced,
min: field?.min, max: field?.max, options: field?.options ?? [],
value, default: defaultValue, is_default: value === defaultValue, present: true, problem: null,
drift: false, restartRequired: "world", dangerous: false,
};
});
return { scope: "bots", categories: groups.map(g => ({ id: g.id, title: g.titles[languages.indexOf(locale)] })), settings, unknown_keys: 0, drift_keys: [], files: ["Core/configs/modules/playerbots.conf"] };
const categories = new Map(groups.map(g => [g.id, g.titles[languages.indexOf(locale)]]));
for (const item of items) if (item.field?.group) categories.set("squid." + item.field.group, categories.get("squid." + item.field.group) ?? item.field.group_title ?? item.field.group);
return { scope: "bots", categories: [...categories].map(([id, title]) => ({ id, title })), settings, unknown_keys: 0, drift_keys: [], files: ["Core/configs/modules/playerbots.conf"] };
}