add "unstable" endpoint legacy Element Android/iOS seems to call

Signed-off-by: strawberry <strawberry@puppygock.gay>
This commit is contained in:
strawberry 2024-07-05 16:39:57 -04:00 committed by June 🍓🦴
parent 1c453b1b55
commit 83e853e7a3
2 changed files with 13 additions and 1 deletions

View file

@ -2,7 +2,7 @@ use std::collections::BTreeMap;
use ruma::api::client::thirdparty::get_protocols;
use crate::{Result, Ruma};
use crate::{Result, Ruma, RumaResponse};
/// # `GET /_matrix/client/r0/thirdparty/protocols`
///
@ -15,3 +15,13 @@ pub(crate) async fn get_protocols_route(
protocols: BTreeMap::new(),
})
}
/// # `GET /_matrix/client/unstable/thirdparty/protocols`
///
/// Same as `get_protocols_route`, except for some reason Element Android legacy
/// calls this
pub(crate) async fn get_protocols_route_unstable(
body: Ruma<get_protocols::v3::Request>,
) -> Result<RumaResponse<get_protocols::v3::Response>> {
get_protocols_route(body).await.map(RumaResponse)
}

View file

@ -94,6 +94,8 @@ pub fn build(router: Router, server: &Server) -> Router {
.ruma_route(client::search_users_route)
.ruma_route(client::get_member_events_route)
.ruma_route(client::get_protocols_route)
.route("/_matrix/client/unstable/thirdparty/protocols",
get(client::get_protocols_route_unstable))
.ruma_route(client::send_message_event_route)
.ruma_route(client::send_state_event_for_key_route)
.ruma_route(client::get_state_events_route)