From b66703082f15047055eb0b34166f104eaea4207f Mon Sep 17 00:00:00 2001 From: Sunil Thakare Date: Mon, 10 Aug 2026 17:46:49 +0530 Subject: [PATCH] Refactor responsive UI and build metadata --- build.rs | 18 + src/build_info.rs | 5 + src/lib.rs | 1 + src/web/admin/settings.rs | 8 +- src/web/system.rs | 4 +- templates/layout.html | 1314 +++++++++++++++++++++++++++++++++++-- templates/pages.html | 103 +-- templates/urls.html | 193 +++--- templates/user_pages.html | 144 ++-- templates/user_urls.html | 145 +++- 10 files changed, 1624 insertions(+), 311 deletions(-) create mode 100644 build.rs create mode 100644 src/build_info.rs diff --git a/build.rs b/build.rs new file mode 100644 index 0000000..64d5045 --- /dev/null +++ b/build.rs @@ -0,0 +1,18 @@ +use std::process::Command; + +fn main() { + println!("cargo:rerun-if-changed=.git/HEAD"); + println!("cargo:rerun-if-changed=.git/refs"); + + if let Ok(output) = Command::new("git") + .args(["rev-parse", "--short=12", "HEAD"]) + .output() + { + if output.status.success() { + let commit = String::from_utf8_lossy(&output.stdout).trim().to_string(); + if !commit.is_empty() { + println!("cargo:rustc-env=BZOD_GIT_COMMIT={commit}"); + } + } + } +} diff --git a/src/build_info.rs b/src/build_info.rs new file mode 100644 index 0000000..b5c30c9 --- /dev/null +++ b/src/build_info.rs @@ -0,0 +1,5 @@ +pub const APP_VERSION: &str = env!("CARGO_PKG_VERSION"); +pub const GIT_COMMIT: &str = match option_env!("BZOD_GIT_COMMIT") { + Some(commit) => commit, + None => "unknown", +}; diff --git a/src/lib.rs b/src/lib.rs index 973aaa6..b3a8af7 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,5 +1,6 @@ pub mod analytics; pub mod auth; +pub mod build_info; pub mod charts; pub mod cli; pub mod config; diff --git a/src/web/admin/settings.rs b/src/web/admin/settings.rs index 899085b..44e634a 100644 --- a/src/web/admin/settings.rs +++ b/src/web/admin/settings.rs @@ -773,8 +773,8 @@ pub async fn status_get(State(state): State, jar: CookieJar) -> Respon queue_size, memory_usage, uptime, - version: "0.1.0", - git_commit: "unknown", + version: crate::build_info::APP_VERSION, + git_commit: crate::build_info::GIT_COMMIT, urls, }; @@ -825,8 +825,8 @@ pub async fn user_status_get(State(state): State, jar: CookieJar) -> R queue_size, memory_usage, uptime, - version: "0.1.0", - git_commit: "unknown", + version: crate::build_info::APP_VERSION, + git_commit: crate::build_info::GIT_COMMIT, urls, }; diff --git a/src/web/system.rs b/src/web/system.rs index ba41624..0cb8b28 100644 --- a/src/web/system.rs +++ b/src/web/system.rs @@ -79,8 +79,8 @@ pub async fn status_endpoint( queue_size: 0, memory_usage: get_memory_usage(), uptime_seconds: uptime, - version: "0.1.0", - git_commit: "unknown", + version: crate::build_info::APP_VERSION, + git_commit: crate::build_info::GIT_COMMIT, }) .into_response() } diff --git a/templates/layout.html b/templates/layout.html index 18ec9d8..e65e806 100644 --- a/templates/layout.html +++ b/templates/layout.html @@ -1,22 +1,166 @@ - + {% block title %}BZOD Admin{% endblock %} + @@ -439,7 +1527,11 @@

{% block header_title %}{% endblock %}

-
+
+ {% block header_actions %}{% endblock %}
@@ -447,5 +1539,83 @@ {% block content %}{% endblock %}
+ diff --git a/templates/pages.html b/templates/pages.html index 68497d4..ffee1ec 100644 --- a/templates/pages.html +++ b/templates/pages.html @@ -13,8 +13,7 @@
{% endif %} -
- +

@@ -24,7 +23,7 @@
-
+
@@ -36,7 +35,7 @@
-
+
@@ -49,7 +48,7 @@
- @@ -59,16 +58,15 @@
- +
- -
-
+