From 8a254a33cc799434917e64151963a45d8878d1dd Mon Sep 17 00:00:00 2001 From: Niklas Wojtkowiak Date: Mon, 23 Feb 2026 14:15:32 -0500 Subject: [PATCH] fix(api): restore backwards compatibility for RTC foci config --- conduwuit-example.toml | 10 ++++++++++ src/api/client/well_known.rs | 19 ++++++++++++++----- src/api/router.rs | 9 +-------- src/core/config/mod.rs | 29 +++++++++++++++++++++++++++++ 4 files changed, 54 insertions(+), 13 deletions(-) diff --git a/conduwuit-example.toml b/conduwuit-example.toml index 58c0d95f..7070ef7c 100644 --- a/conduwuit-example.toml +++ b/conduwuit-example.toml @@ -1844,6 +1844,16 @@ # #support_mxid = +# **DEPRECATED**: Use `[global.matrix_rtc].foci` instead. +# +# A list of MatrixRTC foci URLs which will be served as part of the +# MSC4143 client endpoint at /.well-known/matrix/client. +# +# This option is deprecated and will be removed in a future release. +# Please migrate to the new `[global.matrix_rtc]` config section. +# +#rtc_focus_server_urls = [] + [global.blurhashing] # blurhashing x component, 4 is recommended by https://blurha.sh/ diff --git a/src/api/client/well_known.rs b/src/api/client/well_known.rs index adc9b89c..46fde4bf 100644 --- a/src/api/client/well_known.rs +++ b/src/api/client/well_known.rs @@ -27,7 +27,11 @@ pub(crate) async fn well_known_client( identity_server: None, sliding_sync_proxy: Some(SlidingSyncProxyInfo { url: client_url }), tile_server: None, - rtc_foci: vec![], + rtc_foci: services + .config + .matrix_rtc + .effective_foci(&services.config.well_known.rtc_focus_server_urls) + .to_vec(), }) } @@ -38,10 +42,15 @@ pub(crate) async fn well_known_client( /// homeserver, implementing MSC4143. pub(crate) async fn get_rtc_transports( State(services): State, -) -> Result { - Ok(Json(serde_json::json!({ - "rtc_foci": services.config.matrix_rtc.foci, - }))) + _body: Ruma, +) -> Result { + Ok(ruma::api::client::discovery::get_rtc_transports::Response::new( + services + .config + .matrix_rtc + .effective_foci(&services.config.well_known.rtc_focus_server_urls) + .to_vec(), + )) } /// # `GET /.well-known/matrix/support` diff --git a/src/api/router.rs b/src/api/router.rs index ed872b2f..3166c2af 100644 --- a/src/api/router.rs +++ b/src/api/router.rs @@ -184,14 +184,7 @@ pub fn build(router: Router, server: &Server) -> Router { .ruma_route(&client::put_suspended_status) .ruma_route(&client::well_known_support) .ruma_route(&client::well_known_client) - .route( - "/_matrix/client/v1/rtc/transports", - get(client::get_rtc_transports), - ) - .route( - "/_matrix/client/unstable/org.matrix.msc4143/rtc/transports", - get(client::get_rtc_transports), - ) + .ruma_route(&client::get_rtc_transports) .route("/_conduwuit/server_version", get(client::conduwuit_server_version)) .route("/_continuwuity/server_version", get(client::conduwuit_server_version)) .ruma_route(&client::room_initial_sync_route) diff --git a/src/core/config/mod.rs b/src/core/config/mod.rs index acde104d..e004a245 100644 --- a/src/core/config/mod.rs +++ b/src/core/config/mod.rs @@ -2150,6 +2150,18 @@ pub struct WellKnownConfig { /// If no email or mxid is specified, all of the server's admins will be /// listed. pub support_mxid: Option, + + /// **DEPRECATED**: Use `[global.matrix_rtc].foci` instead. + /// + /// A list of MatrixRTC foci URLs which will be served as part of the + /// MSC4143 client endpoint at /.well-known/matrix/client. + /// + /// This option is deprecated and will be removed in a future release. + /// Please migrate to the new `[global.matrix_rtc]` config section. + /// + /// default: [] + #[serde(default)] + pub rtc_focus_server_urls: Vec, } #[derive(Clone, Copy, Debug, Deserialize, Default)] @@ -2198,6 +2210,22 @@ pub struct MatrixRtcConfig { pub foci: Vec, } +impl MatrixRtcConfig { + /// Returns the effective foci, falling back to the deprecated + /// `rtc_focus_server_urls` if the new config is empty. + #[must_use] + pub fn effective_foci<'a>( + &'a self, + deprecated_foci: &'a [RtcFocusInfo], + ) -> &'a [RtcFocusInfo] { + if !self.foci.is_empty() { + &self.foci + } else { + deprecated_foci + } + } +} + #[derive(Clone, Debug, Default, Deserialize)] #[config_example_generator(filename = "conduwuit-example.toml", section = "global.ldap")] pub struct LdapConfig { @@ -2391,6 +2419,7 @@ const DEPRECATED_KEYS: &[&str] = &[ "well_known_support_email", "well_known_support_mxid", "registration_token_file", + "well_known.rtc_focus_server_urls", ]; impl Config {