2020-07-30 17:14:47 +01:00
|
|
|
use crate::ConduitResult;
|
|
|
|
use ruma::api::client::unversioned::get_supported_versions;
|
|
|
|
|
|
|
|
#[cfg(feature = "conduit_bin")]
|
|
|
|
use rocket::get;
|
|
|
|
|
2020-07-31 13:40:28 +01: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
|
|
|
|
/// - Unstable features should be namespaced and may include version information in their name
|
|
|
|
///
|
|
|
|
/// Note: Unstable features are used while developing new features. Clients should avoid using
|
|
|
|
/// unstable features in their stable releases
|
2020-07-30 17:14:47 +01:00
|
|
|
#[cfg_attr(feature = "conduit_bin", get("/_matrix/client/versions"))]
|
2020-10-21 20:28:02 +01:00
|
|
|
pub async fn get_supported_versions_route() -> ConduitResult<get_supported_versions::Response> {
|
2020-08-06 13:29:59 +01:00
|
|
|
let mut resp =
|
|
|
|
get_supported_versions::Response::new(vec!["r0.5.0".to_owned(), "r0.6.0".to_owned()]);
|
2020-07-30 17:14:47 +01:00
|
|
|
|
2020-08-06 13:29:59 +01:00
|
|
|
resp.unstable_features
|
|
|
|
.insert("org.matrix.e2e_cross_signing".to_owned(), true);
|
2020-07-30 17:14:47 +01:00
|
|
|
|
2020-08-06 13:29:59 +01:00
|
|
|
Ok(resp.into())
|
2020-07-30 17:14:47 +01:00
|
|
|
}
|