use CONDUIT_VERSION_EXTRA in endpoints
Signed-off-by: strawberry <strawberry@puppygock.gay>
This commit is contained in:
parent
87a7c8d9e8
commit
47889410eb
3 changed files with 24 additions and 4 deletions
|
@ -74,9 +74,14 @@ pub async fn syncv3_client_server_json() -> Result<impl IntoResponse> {
|
|||
},
|
||||
};
|
||||
|
||||
let version = match option_env!("CONDUIT_VERSION_EXTRA") {
|
||||
Some(extra) => format!("{} ({})", env!("CARGO_PKG_VERSION"), extra),
|
||||
None => env!("CARGO_PKG_VERSION").to_owned(),
|
||||
};
|
||||
|
||||
Ok(Json(serde_json::json!({
|
||||
"server": server_url,
|
||||
"version": format!("Conduwuit {}", env!("CARGO_PKG_VERSION"))
|
||||
"version": version,
|
||||
})))
|
||||
}
|
||||
|
||||
|
@ -85,8 +90,13 @@ pub async fn syncv3_client_server_json() -> Result<impl IntoResponse> {
|
|||
/// Conduwuit-specific API to get the server version, results akin to
|
||||
/// `/_matrix/federation/v1/version`
|
||||
pub async fn conduwuit_server_version() -> Result<impl IntoResponse> {
|
||||
let version = match option_env!("CONDUIT_VERSION_EXTRA") {
|
||||
Some(extra) => format!("{} ({})", env!("CARGO_PKG_VERSION"), extra),
|
||||
None => env!("CARGO_PKG_VERSION").to_owned(),
|
||||
};
|
||||
|
||||
Ok(Json(serde_json::json!({
|
||||
"name": "Conduwuit",
|
||||
"version": env!("CARGO_PKG_VERSION"),
|
||||
"version": version,
|
||||
})))
|
||||
}
|
||||
|
|
|
@ -623,10 +623,15 @@ pub async fn get_server_version_route(
|
|||
return Err(Error::bad_config("Federation is disabled."));
|
||||
}
|
||||
|
||||
let version = match option_env!("CONDUIT_VERSION_EXTRA") {
|
||||
Some(extra) => format!("{} ({})", env!("CARGO_PKG_VERSION"), extra),
|
||||
None => env!("CARGO_PKG_VERSION").to_owned(),
|
||||
};
|
||||
|
||||
Ok(get_server_version::v1::Response {
|
||||
server: Some(get_server_version::v1::Server {
|
||||
name: Some("Conduwuit".to_owned()),
|
||||
version: Some(env!("CARGO_PKG_VERSION").to_owned()),
|
||||
version: Some(version),
|
||||
}),
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue