feat(mesh): show federated Archipelago nodes on the Mesh Map
Peers that opt in via a new "Share Location" toggle in Settings (server.set-location RPC) get plotted on other trusted peers' Mesh Map with a distinct Archy-logo marker, separate from raw LoRa radio peers. Location is persisted locally, carried in NodeStateSnapshot, and propagated through federation sync/delta like other node state. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5
parent
e3baaa5de3
commit
177b8a4338
@@ -48,6 +48,12 @@ pub struct StateDelta {
|
||||
/// Tor active flag (only if changed).
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub tor: Option<bool>,
|
||||
/// Shared location (only if changed) — same "None means unchanged"
|
||||
/// convention as the other scalar fields here.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub lat: Option<f64>,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub lon: Option<f64>,
|
||||
}
|
||||
|
||||
/// Compute the delta between two state snapshots.
|
||||
@@ -114,6 +120,12 @@ pub fn compute_delta(prev: &NodeStateSnapshot, curr: &NodeStateSnapshot) -> Stat
|
||||
if curr.tor_active != prev.tor_active {
|
||||
delta.tor = curr.tor_active;
|
||||
}
|
||||
if curr.lat != prev.lat {
|
||||
delta.lat = curr.lat;
|
||||
}
|
||||
if curr.lon != prev.lon {
|
||||
delta.lon = curr.lon;
|
||||
}
|
||||
|
||||
delta
|
||||
}
|
||||
@@ -162,6 +174,12 @@ pub fn apply_delta(base: &NodeStateSnapshot, delta: &StateDelta) -> NodeStateSna
|
||||
if let Some(tor) = delta.tor {
|
||||
result.tor_active = Some(tor);
|
||||
}
|
||||
if let Some(lat) = delta.lat {
|
||||
result.lat = Some(lat);
|
||||
}
|
||||
if let Some(lon) = delta.lon {
|
||||
result.lon = Some(lon);
|
||||
}
|
||||
|
||||
result
|
||||
}
|
||||
@@ -225,6 +243,8 @@ mod tests {
|
||||
nostr_npub: None,
|
||||
own_fips_npub: None,
|
||||
federated_peers: Vec::new(),
|
||||
lat: None,
|
||||
lon: None,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -259,6 +279,8 @@ mod tests {
|
||||
nostr_npub: None,
|
||||
own_fips_npub: None,
|
||||
federated_peers: Vec::new(),
|
||||
lat: None,
|
||||
lon: None,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user