Show current version on server index (#436)

This commit is contained in:
Ellie Huxtable 2022-06-06 09:58:19 +01:00 committed by GitHub
parent 706b1aff65
commit 06ac95876c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -6,8 +6,21 @@ use serde::{Deserialize, Serialize};
pub mod history;
pub mod user;
pub async fn index() -> &'static str {
"\"Through the fathomless deeps of space swims the star turtle Great A\u{2019}Tuin, bearing on its back the four giant elephants who carry on their shoulders the mass of the Discworld.\"\n\t-- Sir Terry Pratchett"
const VERSION: &str = env!("CARGO_PKG_VERSION");
#[derive(Debug, Serialize, Deserialize)]
pub struct IndexResponse {
pub homage: String,
pub version: String,
}
pub async fn index() -> Json<IndexResponse> {
let homage = r#""Through the fathomless deeps of space swims the star turtle Great A'Tuin, bearing on its back the four giant elephants who carry on their shoulders the mass of the Discworld." -- Sir Terry Pratchett"#;
Json(IndexResponse {
homage: homage.to_string(),
version: VERSION.to_string(),
})
}
#[derive(Debug, Serialize, Deserialize)]