mirror of
https://forgejo.ellis.link/continuwuation/continuwuity.git
synced 2026-05-26 20:49:55 +00:00
fix(api): restore backwards compatibility for RTC foci config
This commit is contained in:
@@ -1844,6 +1844,16 @@
|
|||||||
#
|
#
|
||||||
#support_mxid =
|
#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]
|
[global.blurhashing]
|
||||||
|
|
||||||
# blurhashing x component, 4 is recommended by https://blurha.sh/
|
# blurhashing x component, 4 is recommended by https://blurha.sh/
|
||||||
|
|||||||
@@ -27,7 +27,11 @@ pub(crate) async fn well_known_client(
|
|||||||
identity_server: None,
|
identity_server: None,
|
||||||
sliding_sync_proxy: Some(SlidingSyncProxyInfo { url: client_url }),
|
sliding_sync_proxy: Some(SlidingSyncProxyInfo { url: client_url }),
|
||||||
tile_server: None,
|
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.
|
/// homeserver, implementing MSC4143.
|
||||||
pub(crate) async fn get_rtc_transports(
|
pub(crate) async fn get_rtc_transports(
|
||||||
State(services): State<crate::State>,
|
State(services): State<crate::State>,
|
||||||
) -> Result<impl IntoResponse> {
|
_body: Ruma<ruma::api::client::discovery::get_rtc_transports::Request>,
|
||||||
Ok(Json(serde_json::json!({
|
) -> Result<ruma::api::client::discovery::get_rtc_transports::Response> {
|
||||||
"rtc_foci": services.config.matrix_rtc.foci,
|
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`
|
/// # `GET /.well-known/matrix/support`
|
||||||
|
|||||||
+1
-8
@@ -184,14 +184,7 @@ pub fn build(router: Router<State>, server: &Server) -> Router<State> {
|
|||||||
.ruma_route(&client::put_suspended_status)
|
.ruma_route(&client::put_suspended_status)
|
||||||
.ruma_route(&client::well_known_support)
|
.ruma_route(&client::well_known_support)
|
||||||
.ruma_route(&client::well_known_client)
|
.ruma_route(&client::well_known_client)
|
||||||
.route(
|
.ruma_route(&client::get_rtc_transports)
|
||||||
"/_matrix/client/v1/rtc/transports",
|
|
||||||
get(client::get_rtc_transports),
|
|
||||||
)
|
|
||||||
.route(
|
|
||||||
"/_matrix/client/unstable/org.matrix.msc4143/rtc/transports",
|
|
||||||
get(client::get_rtc_transports),
|
|
||||||
)
|
|
||||||
.route("/_conduwuit/server_version", get(client::conduwuit_server_version))
|
.route("/_conduwuit/server_version", get(client::conduwuit_server_version))
|
||||||
.route("/_continuwuity/server_version", get(client::conduwuit_server_version))
|
.route("/_continuwuity/server_version", get(client::conduwuit_server_version))
|
||||||
.ruma_route(&client::room_initial_sync_route)
|
.ruma_route(&client::room_initial_sync_route)
|
||||||
|
|||||||
@@ -2150,6 +2150,18 @@ pub struct WellKnownConfig {
|
|||||||
/// If no email or mxid is specified, all of the server's admins will be
|
/// If no email or mxid is specified, all of the server's admins will be
|
||||||
/// listed.
|
/// listed.
|
||||||
pub support_mxid: Option<OwnedUserId>,
|
pub support_mxid: Option<OwnedUserId>,
|
||||||
|
|
||||||
|
/// **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<RtcFocusInfo>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Copy, Debug, Deserialize, Default)]
|
#[derive(Clone, Copy, Debug, Deserialize, Default)]
|
||||||
@@ -2198,6 +2210,22 @@ pub struct MatrixRtcConfig {
|
|||||||
pub foci: Vec<RtcFocusInfo>,
|
pub foci: Vec<RtcFocusInfo>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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)]
|
#[derive(Clone, Debug, Default, Deserialize)]
|
||||||
#[config_example_generator(filename = "conduwuit-example.toml", section = "global.ldap")]
|
#[config_example_generator(filename = "conduwuit-example.toml", section = "global.ldap")]
|
||||||
pub struct LdapConfig {
|
pub struct LdapConfig {
|
||||||
@@ -2391,6 +2419,7 @@ const DEPRECATED_KEYS: &[&str] = &[
|
|||||||
"well_known_support_email",
|
"well_known_support_email",
|
||||||
"well_known_support_mxid",
|
"well_known_support_mxid",
|
||||||
"registration_token_file",
|
"registration_token_file",
|
||||||
|
"well_known.rtc_focus_server_urls",
|
||||||
];
|
];
|
||||||
|
|
||||||
impl Config {
|
impl Config {
|
||||||
|
|||||||
Reference in New Issue
Block a user