diff options
author | Colin Reeder <colin@vpzom.click> | 2020-08-09 08:31:17 -0600 |
---|---|---|
committer | Colin Reeder <colin@vpzom.click> | 2020-08-09 08:31:17 -0600 |
commit | f1832eb5e889719ab9e39afcc911facc7a524b15 (patch) | |
tree | df1a8c58fdcbfd95ebaa5e7226f13fbf2c926706 | |
parent | c77c9ecc387f9a2d5294a38760e3939b344e1fa2 (diff) |
Show instance description on about page
-rw-r--r-- | src/resp_types.rs | 2 | ||||
-rw-r--r-- | src/routes/mod.rs | 29 |
2 files changed, 23 insertions, 8 deletions
diff --git a/src/resp_types.rs b/src/resp_types.rs index d2ec489..279c924 100644 --- a/src/resp_types.rs +++ b/src/resp_types.rs @@ -195,6 +195,8 @@ pub struct RespInstanceSoftwareInfo<'a> { #[derive(Deserialize, Debug)] pub struct RespInstanceInfo<'a> { + #[serde(default)] + pub description: Cow<'a, str>, pub software: RespInstanceSoftwareInfo<'a>, } diff --git a/src/routes/mod.rs b/src/routes/mod.rs index 3c10d31..d7684a7 100644 --- a/src/routes/mod.rs +++ b/src/routes/mod.rs @@ -146,15 +146,28 @@ async fn page_about( <HTPage base_data={&base_data} lang={&lang} title={&title}> <h1>{title.as_ref()}</h1> { - lang.tr( - "about_versions", - Some(&fluent::fluent_args![ - "hitide_version" => env!("CARGO_PKG_VERSION"), - "backend_name" => api_res.software.name, - "backend_version" => api_res.software.version - ]) - ) + if api_res.description == "" { + None + } else { + Some(render::rsx! { + <p> + {Some(api_res.description)} + </p> + }) + } } + <p> + { + lang.tr( + "about_versions", + Some(&fluent::fluent_args![ + "hitide_version" => env!("CARGO_PKG_VERSION"), + "backend_name" => api_res.software.name, + "backend_version" => api_res.software.version + ]) + ) + } + </p> <h2>{lang.tr("about_what_is", None)}</h2> <p> {lang.tr("about_text1", None)} |