From c31f86b10428a85cfcec1b5b17e00105e7e5c5a8 Mon Sep 17 00:00:00 2001 From: Ivan Bushchik Date: Sun, 4 Feb 2024 07:28:53 +0300 Subject: [PATCH] 0.3.2: display manifest hashsum on index Signed-off-by: Ivan Bushchik --- Cargo.toml | 2 +- src/main.rs | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index f735683..824e407 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,7 +2,7 @@ workspace = { members = [ "runner" ] } [package] name = "binhost" -version = "0.3.1" +version = "0.3.2" edition = "2021" license = "MIT" repository = "https://github.com/ivabus/binhost" diff --git a/src/main.rs b/src/main.rs index 31a67bc..5c359b5 100644 --- a/src/main.rs +++ b/src/main.rs @@ -21,7 +21,7 @@ mod structs; static mut BINS: Option<(HashMap, Instant)> = None; static mut MANIFEST: Option> = None; -static mut KEYPAIR: Option = None; +static mut KEYPAIR: Option = None; static WEB_SH: &str = include_str!("../web.sh"); static HASH_CALCULATION_SH: &str = ""; @@ -71,6 +71,13 @@ fn format_platform_list(bin: &Bin) -> String { async fn index() -> RawText { let args = Args::parse(); let mut ret = String::new(); + unsafe { + if let Some(manifest) = &MANIFEST { + let mut hasher = sha2::Sha256::new(); + hasher.update(manifest); + ret.push_str(&format!("Manifest hashsum: {:x}\n", hasher.finalize_fixed())); + } + } unsafe { if let Some((bins, time)) = &mut BINS { reload_bins((bins, time), &args);