aboutsummaryrefslogtreecommitdiffstats
path: root/src/api/dashboard
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2026-10-31 05:22:02 +0100
committertv <tv@krebsco.de>2026-10-31 05:22:02 +0100
commit204a38965c2c2e360ebdfeb357c6cfce50a3654d (patch)
tree6aa23e2f85d36b2b2b50f817a10301783f154041 /src/api/dashboard
parentba64c49fda6f2b4c9eb91eb3d311bdf9b9b98954 (diff)
unify hex builders
Diffstat (limited to 'src/api/dashboard')
-rw-r--r--src/api/dashboard/mod.rs8
1 files changed, 2 insertions, 6 deletions
diff --git a/src/api/dashboard/mod.rs b/src/api/dashboard/mod.rs
index 87f5aeb..c284f6f 100644
--- a/src/api/dashboard/mod.rs
+++ b/src/api/dashboard/mod.rs
@@ -31,7 +31,7 @@ use tokio::time::Instant;
use crate::locks::MutexExt;
use crate::state::AppState;
use crate::swarm::{links, members, topology};
-use crate::transport::Link;
+use crate::transport::{Hex, Link};
/// How often the snapshot is built and compared, while anyone looks.
const TICK: Duration = Duration::from_secs(2);
@@ -411,11 +411,7 @@ fn page() -> &'static (String, String) {
let growing = serde_json::to_string(GROWING).unwrap_or_else(|_| "[]".to_owned());
let page = PAGE.replace(GROWING_MARK, &growing);
// Of the page with its list: a new list is a new version too.
- let version: String = Sha256::digest(page.as_bytes())
- .iter()
- .take(8)
- .map(|byte| format!("{byte:02x}"))
- .collect();
+ let version = Hex(&Sha256::digest(page.as_bytes())[..8]).to_string();
let served = page.replace(PAGE_VERSION_MARK, &version);
(version, served)
})