|
|
|
@ -1,4 +1,4 @@ |
|
|
|
use crate::ConduitResult; |
|
|
|
use crate::{database::DatabaseGuard, ConduitResult}; |
|
|
|
use ruma::api::client::r0::voip::get_turn_server_info; |
|
|
|
use ruma::api::client::r0::voip::get_turn_server_info; |
|
|
|
use std::time::Duration; |
|
|
|
use std::time::Duration; |
|
|
|
|
|
|
|
|
|
|
|
@ -9,13 +9,13 @@ use rocket::get; |
|
|
|
///
|
|
|
|
///
|
|
|
|
/// TODO: Returns information about the recommended turn server.
|
|
|
|
/// TODO: Returns information about the recommended turn server.
|
|
|
|
#[cfg_attr(feature = "conduit_bin", get("/_matrix/client/r0/voip/turnServer"))] |
|
|
|
#[cfg_attr(feature = "conduit_bin", get("/_matrix/client/r0/voip/turnServer"))] |
|
|
|
#[tracing::instrument] |
|
|
|
#[tracing::instrument(skip(db))] |
|
|
|
pub async fn turn_server_route() -> ConduitResult<get_turn_server_info::Response> { |
|
|
|
pub async fn turn_server_route(db: DatabaseGuard) -> ConduitResult<get_turn_server_info::Response> { |
|
|
|
Ok(get_turn_server_info::Response { |
|
|
|
Ok(get_turn_server_info::Response { |
|
|
|
username: "".to_owned(), |
|
|
|
username: db.globals.turn_username().clone(), |
|
|
|
password: "".to_owned(), |
|
|
|
password: db.globals.turn_password().clone(), |
|
|
|
uris: Vec::new(), |
|
|
|
uris: db.globals.turn_uris().to_vec(), |
|
|
|
ttl: Duration::from_secs(60 * 60 * 24), |
|
|
|
ttl: Duration::from_secs(db.globals.turn_ttl()), |
|
|
|
} |
|
|
|
} |
|
|
|
.into()) |
|
|
|
.into()) |
|
|
|
} |
|
|
|
} |
|
|
|
|