1
0
Fork 0
mirror of https://forgejo.ellis.link/continuwuation/continuwuity.git synced 2025-07-30 03:38:31 +00:00
continuwuity/src/api/server/well_known.rs
Jason Volk 3af153f5ae split s2s into units
Signed-off-by: Jason Volk <jason@zemos.net>
2024-06-06 04:41:27 -04:00

17 lines
609 B
Rust

use ruma::api::{client::error::ErrorKind, federation::discovery::discover_homeserver};
use crate::{services, Error, Result, Ruma};
/// # `GET /.well-known/matrix/server`
///
/// Returns the .well-known URL if it is configured, otherwise returns 404.
pub(crate) async fn well_known_server(
_body: Ruma<discover_homeserver::Request>,
) -> Result<discover_homeserver::Response> {
Ok(discover_homeserver::Response {
server: match services().globals.well_known_server() {
Some(server_name) => server_name.to_owned(),
None => return Err(Error::BadRequest(ErrorKind::NotFound, "Not found.")),
},
})
}