mirror of
https://github.com/Corfirean/coa-server-manager.git
synced 2026-11-22 03:25:56 +00:00
Phase 11: public realm list and detail, Player Mode server browser
Registry: GET /registry/v2/realms (keyset cursors, bounded filters and sorts, indexes per sort,
ETag and a short server-side cache, per-address limit) and /realms/{id}; migrations 3 and 4.
Manager: Servers page (table, filters, sortable columns, detail drawer, module tooltips from the
local catalog, players and bots apart, ping unknown), compatibility of the chosen character with
an advertised realm through the Phase 7/8 rules.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
e39cecb333
commit
95ab5dd9ef
27 files changed
+1830
-10
No files matched your search
@@ -0,0 +1,80 @@
|
||||
import { invoke } from "@tauri-apps/api/core";
|
||||
|
||||
export interface Rates {
|
||||
xp_kill: number | null;
|
||||
xp_quest: number | null;
|
||||
xp_explore: number | null;
|
||||
loot: number | null;
|
||||
money: number | null;
|
||||
reputation: number | null;
|
||||
honor: number | null;
|
||||
}
|
||||
export interface ModuleEntry { id: string; version: string | null; enabled: boolean }
|
||||
export interface Population { players: number; bots: number; capacity: number | null }
|
||||
export interface AccountProvisioning { automatic: boolean; existing_only: boolean }
|
||||
export type Ruleset = "coa" | "wildcard";
|
||||
|
||||
export interface RealmSummary {
|
||||
realm_id: string;
|
||||
display_name: string;
|
||||
description: string;
|
||||
language: string;
|
||||
region: string | null;
|
||||
ruleset: Ruleset;
|
||||
level_cap: number | null;
|
||||
rates: Rates;
|
||||
modules: ModuleEntry[];
|
||||
population: Population;
|
||||
account_provisioning: AccountProvisioning;
|
||||
manager_version: string;
|
||||
capabilities_hash: string;
|
||||
listing_hash: string;
|
||||
metadata_revision: number;
|
||||
online: boolean;
|
||||
created_at: number;
|
||||
last_seen_at: number;
|
||||
}
|
||||
|
||||
export interface RealmPage { realms: RealmSummary[]; next_cursor: string | null }
|
||||
|
||||
export interface RealmDetail {
|
||||
realm_id: string;
|
||||
public_key: string;
|
||||
listing: { display_name: string; description: string; language: string; region: string | null; rates: Rates; modules: ModuleEntry[]; account_provisioning: AccountProvisioning; manager_version: string };
|
||||
ruleset: Ruleset;
|
||||
level_cap: number | null;
|
||||
population: Population;
|
||||
capabilities: unknown;
|
||||
metadata_revision: number;
|
||||
online: boolean;
|
||||
last_seen_at: number;
|
||||
}
|
||||
|
||||
export interface ModuleInfo { id: string; name: string; description: Record<string, string>; status: string; icon: string }
|
||||
|
||||
export type SortKey = "name" | "players" | "cap" | "created";
|
||||
|
||||
export interface BrowseParams {
|
||||
q?: string;
|
||||
ruleset?: Ruleset;
|
||||
cap_min?: number;
|
||||
cap_max?: number;
|
||||
module?: string;
|
||||
players_min?: number;
|
||||
status?: "online" | "offline" | "all";
|
||||
sort?: SortKey;
|
||||
order?: "asc" | "desc";
|
||||
cursor?: string;
|
||||
limit?: number;
|
||||
}
|
||||
|
||||
export const browse = {
|
||||
list: (params: BrowseParams) => invoke<RealmPage>("browse_list", { params }),
|
||||
detail: (realmId: string) => invoke<RealmDetail>("browse_detail", { realmId }),
|
||||
modules: () => invoke<ModuleInfo[]>("module_catalog"),
|
||||
};
|
||||
|
||||
/** `×2`, `×1.5`; unknown is a dash, never a guess. */
|
||||
export function rate(v: number | null): string {
|
||||
return v === null ? "—" : `×${Number.isInteger(v) ? v : Number(v.toFixed(2))}`;
|
||||
}
|
||||
@@ -102,6 +102,7 @@ export const portable = {
|
||||
addRealm: (path: string) => invoke<RealmView>("portable_add_realm", { path }),
|
||||
removeRealm: (realm: string) => invoke<void>("portable_remove_realm", { realm }),
|
||||
diagnostics: () => invoke<unknown>("portable_diagnostics"),
|
||||
preflightRemote: (character: string, capabilities: unknown) => invoke<PreflightView>("portable_preflight_remote", { character, capabilities }),
|
||||
launch: (realm: string) => invoke<void>("portable_launch", { realm }),
|
||||
};
|
||||
|
||||
|
||||
Reference in new issue
Block a user