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:
ДмитрийandClaude Sonnet 5.5 committed 2026-10-07 21:56:09 +05:00
1 parent e39cecb333
commit 95ab5dd9ef
27 files changed
+1830 -10

No files matched your search

+55
View File
@@ -1750,6 +1750,10 @@ pub fn run() {
portable_diagnostics,
portable_launch,
registry_status,
portable_preflight_remote,
browse_list,
browse_detail,
module_catalog,
registry_set_url,
registry_publish,
registry_unpublish,
@@ -1776,6 +1780,57 @@ fn realm_registry(state: &State<'_, AppState>) -> std::result::Result<Arc<coa_co
state.realm_registry.clone().ok_or_else(|| Error::Invalid("the publishing service did not start".into()).into())
}
#[tauri::command]
async fn portable_preflight_remote(state: State<'_, AppState>, character: String, capabilities: serde_json::Value) -> std::result::Result<portable_service::PreflightView, ServiceError> {
portable_call(&state, move |s| s.preflight_advert(&character, &capabilities)).await
}
fn browse_client() -> std::result::Result<coa_core::realm_registry::BrowseClient, UiError> {
let settings = coa_core::realm_registry::settings::load(&data_dir().join("registry"))?;
let url = std::env::var("COA_REGISTRY_URL").ok().filter(|u| !u.is_empty()).or(settings.url).ok_or_else(|| Error::Invalid("Enter the Registry address first.".into()))?;
Ok(coa_core::realm_registry::BrowseClient::new(&url)?)
}
fn browse_error(e: coa_core::realm_registry::ClientError) -> UiError {
Error::Invalid(e.to_string()).into()
}
/// One page of the public realm list (a plain read of the Registry; nothing about the player is sent).
#[tauri::command]
async fn browse_list(params: coa_core::realm_registry::BrowseParams) -> std::result::Result<coa_registry_proto::RealmPage, UiError> {
tauri::async_runtime::spawn_blocking(move || {
let query = params.to_query()?;
browse_client()?.list(&query).map_err(browse_error)
})
.await
.map_err(|e| Error::Invalid(e.to_string()))?
}
#[tauri::command]
async fn browse_detail(realm_id: String) -> std::result::Result<coa_registry_proto::RealmDetail, UiError> {
tauri::async_runtime::spawn_blocking(move || {
let id = coa_registry_proto::RealmId::parse(&realm_id).map_err(|e| Error::Invalid(e.to_string()))?;
browse_client()?.detail(&id).map_err(browse_error)
})
.await
.map_err(|e| Error::Invalid(e.to_string()))?
}
#[derive(serde::Serialize)]
struct ModuleInfo {
id: String,
name: String,
description: std::collections::BTreeMap<String, String>,
status: String,
icon: String,
}
/// The Manager's own module catalog: names and descriptions of the modules a realm's advertisement lists by id.
#[tauri::command]
fn module_catalog() -> Vec<ModuleInfo> {
coa_core::modules::catalog().into_iter().map(|e| ModuleInfo { id: e.id, name: e.name, description: e.description, status: e.status, icon: e.icon }).collect()
}
#[tauri::command]
fn registry_status(state: State<'_, AppState>) -> coa_core::realm_registry::RegistryStatus {
state.realm_registry.as_ref().map(|r| r.status()).unwrap_or_default()