Skip to main content

tuwunel_api/client/
versions.rs

1use std::iter::once;
2
3use ruma::api::client::discovery::get_supported_versions;
4use tuwunel_core::Result;
5
6use crate::Ruma;
7
8/// # `GET /_matrix/client/versions`
9///
10/// Get the versions of the specification and unstable features supported by
11/// this server.
12///
13/// - Versions take the form MAJOR.MINOR.PATCH
14/// - Only the latest PATCH release will be reported for each MAJOR.MINOR value
15/// - Unstable features are namespaced and may include version information in
16///   their name
17///
18/// Note: Unstable features are used while developing new features. Clients
19/// should avoid using unstable features in their stable releases
20pub(crate) async fn get_supported_versions_route(
21	_body: Ruma<get_supported_versions::Request>,
22) -> Result<get_supported_versions::Response> {
23	Ok(get_supported_versions::Response {
24		versions: VERSIONS.into_iter().map(Into::into).collect(),
25
26		unstable_features: UNSTABLE_FEATURES
27			.into_iter()
28			.map(Into::into)
29			.zip(once(true).cycle())
30			.collect(),
31
32		// MSC4383: client-side parity with /_matrix/federation/v1/version.
33		server: Some(get_supported_versions::Server {
34			name: Some(tuwunel_core::version::name().into()),
35			version: Some(tuwunel_core::version::version().into()),
36			compiler: tuwunel_core::info::rustc::version().map(Into::into),
37			..Default::default()
38		}),
39	})
40}
41
42static VERSIONS: [&str; 17] = [
43	"r0.0.1", /* Historical */
44	"r0.1.0", /* Historical */
45	"r0.2.0", /* Historical */
46	"r0.3.0", /* Historical */
47	"r0.4.0", /* Historical */
48	"r0.5.0", /* Historical */
49	"r0.6.0", /* Historical */
50	"r0.6.1", /* Historical */
51	"v1.1",   /* Stable; Tested */
52	"v1.2",   /* Stable; Tested */
53	"v1.3",   /* Stable; Tested */
54	"v1.4",   /* Stable; Tested */
55	"v1.5",   /* Stable; Tested */
56	"v1.10",  /* Tested; relations recursion */
57	"v1.11",  /* Tested; authenticated media */
58	"v1.12", "v1.15",
59];
60
61static UNSTABLE_FEATURES: [&str; 34] = [
62	"org.matrix.e2e_cross_signing",
63	// private read receipts (https://github.com/matrix-org/matrix-spec-proposals/pull/2285)
64	"org.matrix.msc2285.stable",
65	// appservice ping https://github.com/matrix-org/matrix-spec-proposals/pull/2659)
66	"fi.mau.msc2659.stable",
67	// query mutual rooms (https://github.com/matrix-org/matrix-spec-proposals/pull/2666)
68	"uk.half-shot.msc2666.query_mutual_rooms",
69	// threading/threads (https://github.com/matrix-org/matrix-spec-proposals/pull/2836)
70	"org.matrix.msc2836",
71	// jump to date (https://github.com/matrix-org/matrix-spec-proposals/pull/3030)
72	"org.matrix.msc3030",
73	// spaces/hierarchy summaries (https://github.com/matrix-org/matrix-spec-proposals/pull/2946)
74	"org.matrix.msc2946",
75	// busy presence status (https://github.com/matrix-org/matrix-spec-proposals/pull/3026)
76	"org.matrix.msc3026.busy_presence",
77	// sliding sync (https://github.com/matrix-org/matrix-spec-proposals/pull/3575/files#r1588877046)
78	"org.matrix.msc3575",
79	// dehydrated devices
80	"org.matrix.msc3814",
81	// filtering of /publicRooms by room type (https://github.com/matrix-org/matrix-spec-proposals/pull/3827)
82	"org.matrix.msc3827",
83	"org.matrix.msc3827.stable",
84	// authenticated media (https://github.com/matrix-org/matrix-spec-proposals/pull/3916)
85	"org.matrix.msc3916.stable",
86	// intentional mentions (https://github.com/matrix-org/matrix-spec-proposals/pull/3952)
87	"org.matrix.msc3952_intentional_mentions",
88	// MSC4133 (custom profile fields) and MSC4175 (m.tz) stabilized in
89	// Matrix 1.16; advertise the historical unstable prefixes alongside
90	// the post-merge `.stable` flags for clients that haven't migrated.
91	"uk.tcpip.msc4133",
92	"uk.tcpip.msc4133.stable",
93	"us.cloke.msc4175",
94	"us.cloke.msc4175.stable",
95	// stable flag for 3916 (https://github.com/matrix-org/matrix-spec-proposals/pull/4180)
96	"org.matrix.msc4180",
97	// Simplified Sliding sync (https://github.com/matrix-org/matrix-spec-proposals/pull/4186)
98	"org.matrix.simplified_msc3575",
99	// Allow room moderators to view redacted event content (https://github.com/matrix-org/matrix-spec-proposals/pull/2815)
100	"fi.mau.msc2815",
101	// OIDC-native auth: authorization code grant (https://github.com/matrix-org/matrix-spec-proposals/pull/2964)
102	"org.matrix.msc2964",
103	// OIDC-native auth: auth issuer discovery (https://github.com/matrix-org/matrix-spec-proposals/pull/2965)
104	"org.matrix.msc2965",
105	// OIDC-native auth: dynamic client registration (https://github.com/matrix-org/matrix-spec-proposals/pull/2966)
106	"org.matrix.msc2966",
107	// OIDC-native auth: API scopes (https://github.com/matrix-org/matrix-spec-proposals/pull/2967)
108	"org.matrix.msc2967",
109	// OIDC delegation aware
110	"org.matrix.msc3824",
111	// Backwards-compatible redaction sending via /send (https://github.com/matrix-org/matrix-spec-proposals/pull/4169)
112	"com.beeper.msc4169",
113	// Invite blocking via m.invite_permission_config (https://github.com/matrix-org/matrix-spec-proposals/pull/4380)
114	"org.matrix.msc4380",
115	"org.matrix.msc4380.stable",
116	// Client-server discovery of server version (https://github.com/matrix-org/matrix-spec-proposals/pull/4383)
117	"net.zemos.msc4383",
118	// Policy servers (https://github.com/matrix-org/matrix-spec-proposals/pull/4284)
119	"org.matrix.msc4284",
120	// Read receipts for threads (https://github.com/matrix-org/matrix-spec-proposals/pull/3771)
121	"org.matrix.msc3771",
122	// Notifications for threads (https://github.com/matrix-org/matrix-spec-proposals/pull/3773)
123	"org.matrix.msc3773",
124	// state_after on /sync (https://github.com/matrix-org/matrix-spec-proposals/pull/4222)
125	"org.matrix.msc4222",
126];