From 75d745e960bdbf05783922ec320419395332f446 Mon Sep 17 00:00:00 2001 From: Lukas Kalbertodt Date: Tue, 19 Sep 2023 18:08:02 +0200 Subject: [PATCH] Add target to version information and show it on "About" page --- backend/src/http/assets.rs | 1 + backend/src/version.rs | 7 ++++++- frontend/src/config.ts | 1 + frontend/src/routes/About.tsx | 5 +++++ 4 files changed, 13 insertions(+), 1 deletion(-) diff --git a/backend/src/http/assets.rs b/backend/src/http/assets.rs index 1c4f0b121..a75aa6ffd 100644 --- a/backend/src/http/assets.rs +++ b/backend/src/http/assets.rs @@ -94,6 +94,7 @@ impl Assets { "buildDateUtc": crate::version::build_time_utc(), "gitCommitHash": crate::version::git_commit_hash(), "gitWasDirty": crate::version::git_was_dirty(), + "target": crate::version::target(), }).to_string()); variables.insert("global-style".into(), config.theme.to_css()); variables.insert("auth".into(), json!({ diff --git a/backend/src/version.rs b/backend/src/version.rs index c60282d0a..f07cf115a 100644 --- a/backend/src/version.rs +++ b/backend/src/version.rs @@ -28,13 +28,18 @@ pub(crate) fn git_was_dirty() -> bool { build_info::GIT_DIRTY == Some(true) } +pub(crate) fn target() -> &'static str { + build_info::TARGET +} + /// Returns a string containing all version-related information. pub(crate) fn full() -> String { format!( - "{} ({}{}), built {}", + "{} ({}{}), built {} ({})", identifier(), git_commit_hash(), if git_was_dirty() { ", dirty" } else { "" }, build_time_utc(), + target(), ) } diff --git a/frontend/src/config.ts b/frontend/src/config.ts index ea999dfb9..5badd5f1a 100644 --- a/frontend/src/config.ts +++ b/frontend/src/config.ts @@ -76,6 +76,7 @@ type VersionInfo = { buildDateUtc: string; gitCommitHash: string; gitWasDirty: boolean; + target: string; }; type UploadConfig = { diff --git a/frontend/src/routes/About.tsx b/frontend/src/routes/About.tsx index de5fc3635..47bb722c8 100644 --- a/frontend/src/routes/About.tsx +++ b/frontend/src/routes/About.tsx @@ -11,6 +11,7 @@ import { ABOUT_PATH } from "./paths"; import { makeRoute } from "../rauta"; import { PageTitle } from "../layout/header/ui"; import { Breadcrumbs } from "../ui/Breadcrumbs"; +import { COLORS } from "../color"; export const AboutRoute = makeRoute(url => { @@ -56,6 +57,10 @@ const About: React.FC = () => { Tobira {version.identifier} + {" "} + + ({version.target}) +
{"Git info: "}