2024-02-25 22:16:08 -05:00
use std ::collections ::BTreeMap ;
2022-01-13 12:06:20 +01:00
2024-11-24 00:19:55 +00:00
use ruma ::api ::client ::discovery ::get_supported_versions ;
2025-04-22 01:41:02 +00:00
use tuwunel_core ::Result ;
2022-04-06 21:31:29 +02:00
2025-04-04 03:30:13 +00:00
use crate ::Ruma ;
2020-07-30 18:14:47 +02:00
2020-07-31 14:40:28 +02:00
/// # `GET /_matrix/client/versions`
///
/// Get the versions of the specification and unstable features supported by
/// this server.
///
/// - Versions take the form MAJOR.MINOR.PATCH
/// - Only the latest PATCH release will be reported for each MAJOR.MINOR value
2021-08-31 19:14:37 +02:00
/// - Unstable features are namespaced and may include version information in
/// their name
2020-07-31 14:40:28 +02:00
///
/// Note: Unstable features are used while developing new features. Clients
/// should avoid using unstable features in their stable releases
2024-04-22 23:48:57 -04:00
pub ( crate ) async fn get_supported_versions_route (
2022-12-14 13:09:10 +01:00
_body : Ruma < get_supported_versions ::Request > ,
2022-01-22 16:58:32 +01:00
) -> Result < get_supported_versions ::Response > {
2022-01-13 11:48:18 +01:00
let resp = get_supported_versions ::Response {
2022-05-30 12:58:43 +02:00
versions : vec ! [
2024-01-07 17:20:44 -05:00
" r0.0.1 " . to_owned ( ) ,
" r0.1.0 " . to_owned ( ) ,
" r0.2.0 " . to_owned ( ) ,
" r0.3.0 " . to_owned ( ) ,
" r0.4.0 " . to_owned ( ) ,
2022-05-30 12:58:43 +02:00
" r0.5.0 " . to_owned ( ) ,
" r0.6.0 " . to_owned ( ) ,
2024-01-07 17:20:44 -05:00
" r0.6.1 " . to_owned ( ) ,
2022-05-30 12:58:43 +02:00
" v1.1 " . to_owned ( ) ,
" v1.2 " . to_owned ( ) ,
2023-06-25 19:31:40 +02:00
" v1.3 " . to_owned ( ) ,
" v1.4 " . to_owned ( ) ,
2024-01-07 17:20:44 -05:00
" v1.5 " . to_owned ( ) ,
2025-11-20 03:21:34 +00:00
" v1.10 " . to_owned ( ) , // relations recursion
" v1.11 " . to_owned ( ) , // authenticated media
2026-01-30 21:16:26 +00:00
" v1.12 " . to_owned ( ) , // m.tz
" v1.15 " . to_owned ( ) , // custom profile fields
2022-05-30 12:58:43 +02:00
] ,
2024-01-07 17:20:44 -05:00
unstable_features : BTreeMap ::from_iter ( [
( " org.matrix.e2e_cross_signing " . to_owned ( ) , true ) ,
2024-05-22 03:34:40 -04:00
( " org.matrix.msc2285.stable " . to_owned ( ) , true ) , /* private read receipts (https: / / github.com / matrix-org / matrix-spec-proposals / pull / 2285) */
2025-10-27 07:43:07 +00:00
( " fi.mau.msc2659.stable " . to_owned ( ) , true ) , /* appservice ping https: / / github.com / matrix-org / matrix-spec-proposals / pull / 2659) */
2024-05-22 03:34:40 -04:00
( " uk.half-shot.msc2666.query_mutual_rooms " . to_owned ( ) , true ) , /* query mutual rooms (https: / / github.com / matrix-org / matrix-spec-proposals / pull / 2666) */
( " org.matrix.msc2836 " . to_owned ( ) , true ) , /* threading / threads (https: / / github.com / matrix-org / matrix-spec-proposals / pull / 2836) */
( " org.matrix.msc2946 " . to_owned ( ) , true ) , /* spaces / hierarchy summaries (https: / / github.com / matrix-org / matrix-spec-proposals / pull / 2946) */
( " org.matrix.msc3026.busy_presence " . to_owned ( ) , true ) , /* busy presence status (https: / / github.com / matrix-org / matrix-spec-proposals / pull / 3026) */
( " org.matrix.msc3575 " . to_owned ( ) , true ) , /* sliding sync (https: / / github.com / matrix-org / matrix-spec-proposals / pull / 3575 / files#r1588877046) */
2025-10-27 07:20:23 +00:00
( " org.matrix.msc3814 " . to_owned ( ) , true ) , /* dehydrated devices */
2025-10-27 07:43:07 +00:00
( " org.matrix.msc3827 " . to_owned ( ) , true ) , /* filtering of / publicRooms by room type (https: / / github.com / matrix-org / matrix-spec-proposals / pull / 3827) */
2024-08-29 19:17:33 +00:00
( " org.matrix.msc3916.stable " . to_owned ( ) , true ) , /* authenticated media (https: / / github.com / matrix-org / matrix-spec-proposals / pull / 3916) */
2025-10-27 07:43:07 +00:00
( " org.matrix.msc3952_intentional_mentions " . to_owned ( ) , true ) , /* intentional mentions (https: / / github.com / matrix-org / matrix-spec-proposals / pull / 3952) */
2024-09-08 19:53:33 -04:00
( " uk.tcpip.msc4133 " . to_owned ( ) , true ) , /* Extending User Profile API with Key:Value Pairs (https: / / github.com / matrix-org / matrix-spec-proposals / pull / 4133) */
( " us.cloke.msc4175 " . to_owned ( ) , true ) , /* Profile field for user time zone (https: / / github.com / matrix-org / matrix-spec-proposals / pull / 4175) */
2025-10-27 07:43:07 +00:00
( " org.matrix.msc4180 " . to_owned ( ) , true ) , /* stable flag for 3916 (https: / / github.com / matrix-org / matrix-spec-proposals / pull / 4180) */
2025-01-03 08:32:54 +01:00
( " org.matrix.simplified_msc3575 " . to_owned ( ) , true ) , /* Simplified Sliding sync (https: / / github.com / matrix-org / matrix-spec-proposals / pull / 4186) */
2026-01-21 00:01:32 +05:00
( " fi.mau.msc2815 " . to_owned ( ) , true ) , /* Allow room moderators to view redacted event content (https: / / github.com / matrix-org / matrix-spec-proposals / pull / 2815) */
2024-01-07 17:20:44 -05:00
] ) ,
2022-01-13 11:48:18 +01:00
} ;
2020-07-30 18:14:47 +02:00
2022-01-22 16:58:32 +01:00
Ok ( resp )
2020-07-30 18:14:47 +02:00
}