From 51ef88101e21773ab1735eea7a8184419e314de8 Mon Sep 17 00:00:00 2001 From: LarsSeverson Date: Sun, 11 Oct 2026 11:35:24 -0500 Subject: [PATCH] fix(friends): preserve local realm address --- changelog.d/20261010-local-host-while-sharing.md | 7 +++++++ crates/coa-core/src/friends.rs | 5 +++-- 2 files changed, 10 insertions(+), 2 deletions(-) create mode 100644 changelog.d/20261010-local-host-while-sharing.md diff --git a/changelog.d/20261010-local-host-while-sharing.md b/changelog.d/20261010-local-host-while-sharing.md new file mode 100644 index 0000000..80ad6f9 --- /dev/null +++ b/changelog.d/20261010-local-host-while-sharing.md @@ -0,0 +1,7 @@ +--- +area: manager +type: fixed +audience: admins +title: Local hosts can connect while sharing a server online +--- +The Manager no longer replaces the realm's local address with its public address when Friends mode is enabled. diff --git a/crates/coa-core/src/friends.rs b/crates/coa-core/src/friends.rs index 9b8a71a..afc8277 100644 --- a/crates/coa-core/src/friends.rs +++ b/crates/coa-core/src/friends.rs @@ -125,7 +125,8 @@ pub fn set_open(root: &Path, meta: &Path, open: bool) -> Result { Ok(true) } -/// Make the realm list advertise `host` (the launcher resets it to 127.0.0.1 at every start, so this runs after each start). +/// Make the realm list advertise `host` to remote clients (the launcher resets it to 127.0.0.1 at every start, so this +/// runs after each start). pub fn apply_realm_address(root: &Path, host: &str) -> Result<()> { if !host_ok(host) { return Err(Error::Invalid("That address is not valid.".into())); @@ -133,7 +134,7 @@ pub fn apply_realm_address(root: &Path, host: &str) -> Result<()> { let db = Db::from_repack(root, Account::Admin)?; let realm = crate::realms::state(root)?.active.realm_id(); let where_realms = if crate::realms::state(root)?.simultaneous { "id IN (1,2)".into() } else { format!("id={realm}") }; - db.query(&format!("UPDATE acore_auth.realmlist SET address='{host}', localAddress='{host}' WHERE {where_realms};"))?; + db.query(&format!("UPDATE acore_auth.realmlist SET address='{host}' WHERE {where_realms};"))?; Ok(()) }