mirror of
https://github.com/Dangoware/confetti-box.git
synced 2025-04-19 07:12:58 -05:00
Added version display to bottom of pages
This commit is contained in:
parent
570ad5ce24
commit
aca4765b3d
4 changed files with 42 additions and 1 deletions
|
@ -5,6 +5,7 @@ repository = "https://github.com/Dangoware/confetti-box"
|
|||
license = "AGPL-3.0-or-later"
|
||||
authors.workspace = true
|
||||
edition = "2024"
|
||||
build = "build.rs"
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
@ -25,3 +26,7 @@ toml = "0.8"
|
|||
unidecode = "0.3"
|
||||
urlencoding = "2.1"
|
||||
uuid = { version = "1.11", features = ["serde", "v4"] }
|
||||
|
||||
|
||||
[build-dependencies]
|
||||
vergen-gix = { version = "1.0", features = ["build", "cargo", "rustc", "si"] }
|
||||
|
|
23
confetti-box/build.rs
Normal file
23
confetti-box/build.rs
Normal file
|
@ -0,0 +1,23 @@
|
|||
use vergen_gix::{BuildBuilder, CargoBuilder, Emitter, GixBuilder, RustcBuilder, SysinfoBuilder};
|
||||
|
||||
fn main() {
|
||||
let build = BuildBuilder::all_build().unwrap();
|
||||
let cargo = CargoBuilder::all_cargo().unwrap();
|
||||
let gitcl = GixBuilder::all_git().unwrap();
|
||||
let rustc = RustcBuilder::all_rustc().unwrap();
|
||||
let si = SysinfoBuilder::all_sysinfo().unwrap();
|
||||
|
||||
Emitter::default()
|
||||
.add_instructions(&build)
|
||||
.unwrap()
|
||||
.add_instructions(&cargo)
|
||||
.unwrap()
|
||||
.add_instructions(&gitcl)
|
||||
.unwrap()
|
||||
.add_instructions(&rustc)
|
||||
.unwrap()
|
||||
.add_instructions(&si)
|
||||
.unwrap()
|
||||
.emit()
|
||||
.unwrap();
|
||||
}
|
|
@ -17,6 +17,14 @@ pub fn head(page_title: &str) -> Markup {
|
|||
}
|
||||
|
||||
pub fn footer() -> Markup {
|
||||
let hash = match option_env!("VERGEN_GIT_SHA") {
|
||||
Some(hash) => &hash[0..7],
|
||||
None => "",
|
||||
};
|
||||
|
||||
let pkg_version = env!("CARGO_PKG_VERSION");
|
||||
let hash_link = "https://github.com/Dangoware/confetti-box/commit/".to_string() + hash;
|
||||
|
||||
html! {
|
||||
footer {
|
||||
div {
|
||||
|
@ -26,7 +34,11 @@ pub fn footer() -> Markup {
|
|||
p {a href="https://github.com/Dangoware/confetti-box" {"Source"}}
|
||||
p {a href="https://github.com/Dangoware/" {"Dangoware"}}
|
||||
}
|
||||
p.version { "Running Confetti-Box v" (env!("CARGO_PKG_VERSION")) }
|
||||
p.version { "Running Confetti-Box v" (pkg_version) " " }
|
||||
|
||||
@if !hash.is_empty() {
|
||||
p.version style="font-size: 0.8em" { "(" a style="font-family:'Fira Code'" href=(hash_link) {(hash)} " - " (env!("VERGEN_BUILD_DATE")) ")" }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,6 +40,7 @@ footer {
|
|||
|
||||
p.version {
|
||||
margin-top: 0;
|
||||
margin-bottom: 0;
|
||||
opacity: 45%;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue