add support for serving client+server well-known and /client/server.json
endpoints from conduwuit
the last endpoint is a non-standard health check endpoint used by at least Element Web as a weird way to determine if syncv3 is available there can also be some valid use-cases for serving well-knowns from the application itself Signed-off-by: strawberry <strawberry@puppygock.gay>
This commit is contained in:
parent
bb2f213ac3
commit
8586b15e1a
5 changed files with 49 additions and 17 deletions
|
@ -2060,6 +2060,18 @@ pub async fn claim_keys_route(
|
|||
})
|
||||
}
|
||||
|
||||
/// # `GET /.well-known/matrix/server`
|
||||
pub async fn well_known_server_route() -> Result<impl IntoResponse> {
|
||||
let server_url = match services().globals.well_known_server() {
|
||||
Some(url) => url.clone(),
|
||||
None => return Err(Error::BadRequest(ErrorKind::NotFound, "Not found.")),
|
||||
};
|
||||
|
||||
Ok(Json(serde_json::json!({
|
||||
"m.server": server_url
|
||||
})))
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::{add_port_to_hostname, get_ip_with_port, FedDest};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue