0.3.2: display manifest hashsum on index

Signed-off-by: Ivan Bushchik <ivabus@ivabus.dev>
This commit is contained in:
Ivan Bushchik 2024-02-04 07:28:53 +03:00
parent bcb4fed2f4
commit c31f86b104
No known key found for this signature in database
GPG key ID: 2F16FBF3262E090C
2 changed files with 9 additions and 2 deletions

View file

@ -2,7 +2,7 @@ workspace = { members = [ "runner" ] }
[package] [package]
name = "binhost" name = "binhost"
version = "0.3.1" version = "0.3.2"
edition = "2021" edition = "2021"
license = "MIT" license = "MIT"
repository = "https://github.com/ivabus/binhost" repository = "https://github.com/ivabus/binhost"

View file

@ -21,7 +21,7 @@ mod structs;
static mut BINS: Option<(HashMap<String, Bin>, Instant)> = None; static mut BINS: Option<(HashMap<String, Bin>, Instant)> = None;
static mut MANIFEST: Option<Vec<u8>> = None; static mut MANIFEST: Option<Vec<u8>> = None;
static mut KEYPAIR: Option<ed25519_compact::KeyPair> = None; static mut KEYPAIR: Option<KeyPair> = None;
static WEB_SH: &str = include_str!("../web.sh"); static WEB_SH: &str = include_str!("../web.sh");
static HASH_CALCULATION_SH: &str = ""; static HASH_CALCULATION_SH: &str = "";
@ -71,6 +71,13 @@ fn format_platform_list(bin: &Bin) -> String {
async fn index() -> RawText<String> { async fn index() -> RawText<String> {
let args = Args::parse(); let args = Args::parse();
let mut ret = String::new(); 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 { unsafe {
if let Some((bins, time)) = &mut BINS { if let Some((bins, time)) = &mut BINS {
reload_bins((bins, time), &args); reload_bins((bins, time), &args);