feat: private livekit nodes

This commit is contained in:
Zomatree
2025-06-05 14:14:19 +01:00
parent 45df5724b3
commit 3dbf3bb7a0
2 changed files with 17 additions and 10 deletions

View File

@@ -188,7 +188,11 @@ pub struct LiveKitNode {
pub lat: f64, pub lat: f64,
pub lon: f64, pub lon: f64,
pub key: String, pub key: String,
pub secret: String pub secret: String,
// whether to hide the node in the nodes list
#[serde(default)]
pub private: bool,
} }
#[derive(Deserialize, Debug, Clone)] #[derive(Deserialize, Debug, Clone)]

View File

@@ -115,15 +115,18 @@ pub async fn root() -> Result<Json<RevoltConfig>> {
}, },
livekit: VoiceFeature { livekit: VoiceFeature {
enabled: !config.hosts.livekit.is_empty(), enabled: !config.hosts.livekit.is_empty(),
nodes: config.api.livekit.nodes.iter().map(|(name, value)| { nodes: config.api.livekit.nodes
VoiceNode { .iter()
name: name.clone(), .filter(|(_, node)| !node.private)
lat: value.lat, .map(|(name, value)| {
lon: value.lon, VoiceNode {
public_url: config.hosts.livekit.get(name).expect("Missing corresponding host for voice node").clone() name: name.clone(),
} lat: value.lat,
}) lon: value.lon,
.collect() public_url: config.hosts.livekit.get(name).expect("Missing corresponding host for voice node").clone()
}
})
.collect()
}, },
}, },
ws: config.hosts.events, ws: config.hosts.events,