tuwunel_api/server/
well_known.rs1use axum::extract::State;
2use ruma::api::{error::ErrorKind, federation::discovery::discover_homeserver};
3use tuwunel_core::{Error, Result};
4
5use crate::Ruma;
6
7pub(crate) async fn well_known_server(
11 State(services): State<crate::State>,
12 _body: Ruma<discover_homeserver::Request>,
13) -> Result<discover_homeserver::Response> {
14 Ok(discover_homeserver::Response {
15 server: match services.server.config.well_known.server.as_ref() {
16 | Some(server_name) => server_name.to_owned(),
17 | None => return Err(Error::BadRequest(ErrorKind::NotFound, "Not found.")),
18 },
19 })
20}