mirror of
https://github.com/Corfirean/coa-server-manager.git
synced 2026-11-19 19:25:56 +00:00
Integrate isolated rulesets, portable admission, and compatible relay authentication
This commit is contained in:
commit
d5f1e9cc83
112 files changed
+5892
-965
No files matched your search
@@ -172,6 +172,7 @@ pub(crate) async fn registry_set_access(
|
||||
state: State<'_, AppState>,
|
||||
local_id: String,
|
||||
existing_only: bool,
|
||||
allow_portable: bool,
|
||||
route: Option<String>,
|
||||
) -> Result<(), ServiceError> {
|
||||
let rt = state
|
||||
@@ -179,7 +180,7 @@ pub(crate) async fn registry_set_access(
|
||||
.clone()
|
||||
.ok_or_else(|| fail("stopped", "the publishing service did not start"))?;
|
||||
tauri::async_runtime::spawn_blocking(move || {
|
||||
rt.set_access(&local_id, existing_only, route.as_deref())
|
||||
rt.set_access(&local_id, existing_only, allow_portable, route.as_deref())
|
||||
.map_err(|e| fail("invalid", e.to_string()))
|
||||
})
|
||||
.await
|
||||
@@ -285,11 +286,23 @@ pub(crate) async fn join_realm(
|
||||
let char_id_str = character.clone();
|
||||
let bundle =
|
||||
portable.call(move |s| s.export_for_remote_transfer(&char_id_str))??;
|
||||
if bundle.ruleset.as_str() != detail.ruleset.as_str() {
|
||||
ch.close();
|
||||
return Err(fail(
|
||||
"incompatible",
|
||||
format!(
|
||||
"Character ruleset ({}) does not match target realm ruleset ({})",
|
||||
bundle.ruleset,
|
||||
detail.ruleset.as_str()
|
||||
),
|
||||
));
|
||||
}
|
||||
let cuuid = bundle.character_id.as_uuid();
|
||||
let _outcome = pc_bg
|
||||
.transfer_character(
|
||||
&mut ch,
|
||||
cuuid,
|
||||
bundle.ruleset.as_str(),
|
||||
1,
|
||||
&bundle.payload,
|
||||
bundle.content_hash,
|
||||
@@ -518,6 +531,10 @@ pub(crate) async fn join_claim(
|
||||
.map(|c| c.token)
|
||||
.unwrap_or(0);
|
||||
let claimed = pc.claim(&mut ch, token).map_err(from_control)?;
|
||||
let claimed_ruleset: coa_core::portable::Ruleset = claimed
|
||||
.ruleset
|
||||
.parse()
|
||||
.map_err(|e| fail("incompatible", format!("Invalid ruleset: {e}")))?;
|
||||
let server_id = format!("rr-{rid}");
|
||||
let cid = coa_core::portable::ids::CharacterId::from_uuid(claimed.character_id)
|
||||
.map_err(|e| fail("other", e.to_string()))?;
|
||||
@@ -526,6 +543,25 @@ pub(crate) async fn join_claim(
|
||||
claimed.sha256,
|
||||
claimed.collections.clone(),
|
||||
);
|
||||
let decoded = coa_core::portable::snapshot::decode(&payload, Some(&hash))
|
||||
.map_err(|e| fail("invalid", format!("Corrupt claim snapshot: {e}")))?;
|
||||
if decoded.ruleset != claimed_ruleset {
|
||||
return Err(fail(
|
||||
"incompatible",
|
||||
format!(
|
||||
"Claimed ruleset mismatch: envelope={}, snapshot={}",
|
||||
claimed.ruleset, decoded.ruleset
|
||||
),
|
||||
));
|
||||
}
|
||||
for kind in claimed.collections.keys() {
|
||||
if !coa_core::portable::session::protocol::carried_kind_for(kind, claimed_ruleset) {
|
||||
return Err(fail(
|
||||
"incompatible",
|
||||
format!("Foreign collection kind {kind:?} in {claimed_ruleset} claim"),
|
||||
));
|
||||
}
|
||||
}
|
||||
let view = portable
|
||||
.call(move |s| s.adopt_claim(&server_id, cid, &payload, &hash, &collections))??;
|
||||
pc.acknowledge(&mut ch, claimed.character_id, &rid, &view.name)
|
||||
|
||||
Reference in new issue
Block a user