feat: support hosting .well-known from Conduit

Co-authored-by: Matthias Ahouansou <matthias@ahouansou.cz>
This commit is contained in:
Jakub Kubík 2024-05-02 09:26:43 +01:00 committed by Matthias Ahouansou
parent b4a60c3f9a
commit c1f695653b
No known key found for this signature in database
10 changed files with 101 additions and 23 deletions

View file

@ -17,7 +17,10 @@ use ruma::{
backfill::get_backfill,
device::get_devices::{self, v1::UserDevice},
directory::{get_public_rooms, get_public_rooms_filtered},
discovery::{get_server_keys, get_server_version, ServerSigningKeys, VerifyKey},
discovery::{
discover_homeserver, get_server_keys, get_server_version, ServerSigningKeys,
VerifyKey,
},
event::{get_event, get_missing_events, get_room_state, get_room_state_ids},
keys::{claim_keys, get_keys},
membership::{create_invite, create_join_event, prepare_join_event},
@ -1910,6 +1913,17 @@ pub async fn claim_keys_route(
})
}
/// # `GET /.well-known/matrix/server`
///
/// Returns the federation server discovery information.
pub async fn well_known_server(
_body: Ruma<discover_homeserver::Request>,
) -> Result<discover_homeserver::Response> {
Ok(discover_homeserver::Response {
server: services().globals.well_known_server(),
})
}
#[cfg(test)]
mod tests {
use super::{add_port_to_hostname, get_ip_with_port, FedDest};