add /_conduwuit/server_version route

Signed-off-by: strawberry <strawberry@puppygock.gay>
This commit is contained in:
strawberry 2024-03-27 10:17:11 -04:00 committed by June
parent 4f1f6fa56f
commit 567b24e410
2 changed files with 13 additions and 1 deletions

View file

@ -76,6 +76,17 @@ pub async fn syncv3_client_server_json() -> Result<impl IntoResponse> {
Ok(Json(serde_json::json!({
"server": server_url,
"version": format!("{} {}", env!("CARGO_PKG_NAME"), env!("CARGO_PKG_VERSION"))
"version": format!("Conduwuit {}", env!("CARGO_PKG_VERSION"))
})))
}
/// # `GET /_conduwuit/server_version`
///
/// Conduwuit-specific API to get the server version, results akin to
/// `/_matrix/federation/v1/version`
pub async fn conduwuit_server_version() -> Result<impl IntoResponse> {
Ok(Json(serde_json::json!({
"name": "Conduwuit",
"version": env!("CARGO_PKG_VERSION"),
})))
}

View file

@ -779,6 +779,7 @@ fn routes() -> Router {
.ruma_route(server_server::get_keys_route)
.ruma_route(server_server::claim_keys_route)
.ruma_route(server_server::get_hierarchy_route)
.route("/_conduwuit/server_version", get(client_server::conduwuit_server_version))
.route("/_matrix/client/r0/rooms/:room_id/initialSync", get(initial_sync))
.route("/_matrix/client/v3/rooms/:room_id/initialSync", get(initial_sync))
.route("/client/server.json", get(client_server::syncv3_client_server_json))