Skip to content

Commit

Permalink
fix: expose list of nodes
Browse files Browse the repository at this point in the history
  • Loading branch information
Zomatree committed Feb 17, 2025
1 parent 367ac88 commit 9511280
Showing 1 changed file with 25 additions and 5 deletions.
30 changes: 25 additions & 5 deletions crates/delta/src/routes/root.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,22 @@ pub struct Feature {
pub url: String,
}

/// # Information about a livekit node
#[derive(Serialize, JsonSchema, Debug)]
pub struct VoiceNode {
pub name: String,
pub lat: f64,
pub lon: f64,
pub public_url: String
}

/// # Voice Server Configuration
#[derive(Serialize, JsonSchema, Debug)]
pub struct VoiceFeature {
/// Whether voice is enabled
pub enabled: bool
pub enabled: bool,
/// All livekit nodes
pub nodes: Vec<VoiceNode>,
}

/// # Feature Configuration
Expand Down Expand Up @@ -90,20 +101,29 @@ pub async fn root() -> Result<Json<RevoltConfig>> {
features: RevoltFeatures {
captcha: CaptchaFeature {
enabled: !config.api.security.captcha.hcaptcha_key.is_empty(),
key: config.api.security.captcha.hcaptcha_sitekey,
key: config.api.security.captcha.hcaptcha_sitekey.clone(),
},
email: !config.api.smtp.host.is_empty(),
invite_only: config.api.registration.invite_only,
autumn: Feature {
enabled: !config.hosts.autumn.is_empty(),
url: config.hosts.autumn,
url: config.hosts.autumn.clone(),
},
january: Feature {
enabled: !config.hosts.january.is_empty(),
url: config.hosts.january,
url: config.hosts.january.clone(),
},
livekit: VoiceFeature {
enabled: !config.hosts.livekit.is_empty()
enabled: !config.hosts.livekit.is_empty(),
nodes: config.api.livekit.nodes.iter().map(|(name, value)| {
VoiceNode {
name: name.clone(),
lat: value.lat,
lon: value.lon,
public_url: config.hosts.livekit.get(name).expect("Missing corresponding host for voice node").clone()
}
})
.collect()
},
},
ws: config.hosts.events,
Expand Down

0 comments on commit 9511280

Please sign in to comment.