refactor: Fix errors in api/client/unversioned.rs

This commit is contained in:
Ginger
2026-04-28 09:16:52 -04:00
parent 4c831c3531
commit 698d959407
2 changed files with 46 additions and 43 deletions
+7 -8
View File
@@ -3,7 +3,7 @@ use std::collections::BTreeMap;
use axum::{Json, extract::State, response::IntoResponse};
use conduwuit::Result;
use futures::StreamExt;
use ruma::api::client::discovery::get_supported_versions;
use ruma::{api::client::discovery::get_supported_versions, assign};
use crate::Ruma;
@@ -22,8 +22,7 @@ use crate::Ruma;
pub(crate) async fn get_supported_versions_route(
_body: Ruma<get_supported_versions::Request>,
) -> Result<get_supported_versions::Response> {
let resp = get_supported_versions::Response {
versions: vec![
let versions = vec![
"r0.0.1".to_owned(),
"r0.1.0".to_owned(),
"r0.2.0".to_owned(),
@@ -42,8 +41,9 @@ pub(crate) async fn get_supported_versions_route(
"v1.12".to_owned(),
"v1.13".to_owned(),
"v1.14".to_owned(),
],
unstable_features: BTreeMap::from_iter([
];
let unstable_features = BTreeMap::from_iter([
("org.matrix.e2e_cross_signing".to_owned(), true),
("org.matrix.msc2285.stable".to_owned(), true), /* private read receipts (https://github.com/matrix-org/matrix-spec-proposals/pull/2285) */
("uk.half-shot.msc2666.query_mutual_rooms".to_owned(), true), /* query mutual rooms (https://github.com/matrix-org/matrix-spec-proposals/pull/2666) */
@@ -60,10 +60,9 @@ pub(crate) async fn get_supported_versions_route(
("org.matrix.simplified_msc3575".to_owned(), true), /* Simplified Sliding sync (https://github.com/matrix-org/matrix-spec-proposals/pull/4186) */
("uk.timedout.msc4323".to_owned(), true), /* agnostic suspend (https://github.com/matrix-org/matrix-spec-proposals/pull/4323) */
("org.matrix.msc4155".to_owned(), true), /* invite filtering (https://github.com/matrix-org/matrix-spec-proposals/pull/4155) */
]),
};
]);
Ok(resp)
Ok(assign!(get_supported_versions::Response::new(versions), { unstable_features }))
}
/// # `GET /_conduwuit/server_version`
+5 -1
View File
@@ -13,7 +13,11 @@ use conduwuit_core::{
};
use futures::{StreamExt, TryStreamExt, future, future::ready};
use ruma::{
CanonicalJsonObject, CanonicalJsonValue, OwnedEventId, OwnedRoomId, RoomId, RoomVersionId, UserId, events::{StateEventType, TimelineEventType, room::create::RoomCreateEventContent}, room_version_rules::RoomVersionRules, uint
CanonicalJsonObject, CanonicalJsonValue, OwnedEventId, OwnedRoomId, RoomId, RoomVersionId,
UserId,
events::{StateEventType, TimelineEventType, room::create::RoomCreateEventContent},
room_version_rules::RoomVersionRules,
uint,
};
use serde_json::value::{RawValue, to_raw_value};