web: clean up version string and reload on mismatch
This commit is contained in:
parent
1f393f1c7f
commit
a8c5a164ff
@ -39,7 +39,7 @@ pub fn build_version(bi:fn()->&'static BuildInfo) -> String {
|
||||
let Some(VersionControl::Git(git)) = git else {
|
||||
return String::new();
|
||||
};
|
||||
let mut s = vec![git.commit_short_id.clone()];
|
||||
let mut s = vec!["-".to_string(), git.commit_short_id.clone()];
|
||||
if git.dirty {
|
||||
s.push(".+".to_string());
|
||||
}
|
||||
@ -51,5 +51,5 @@ pub fn build_version(bi:fn()->&'static BuildInfo) -> String {
|
||||
}
|
||||
let bi = bi();
|
||||
|
||||
format!("{}-{}", bi.crate_info.version, commit(&bi.version_control)).to_string()
|
||||
format!("v{}{}", bi.crate_info.version, commit(&bi.version_control)).to_string()
|
||||
}
|
||||
|
||||
@ -519,9 +519,10 @@ pub fn update(msg: Msg, model: &mut Model, orders: &mut impl Orders<Msg>) {
|
||||
Msg::UpdateServerVersion(version) => {
|
||||
if version != model.versions.client {
|
||||
warn!(
|
||||
"Server ({}) and client ({}) version mismatch",
|
||||
"Server ({}) and client ({}) version mismatch, reloading",
|
||||
version, model.versions.client
|
||||
);
|
||||
orders.send_msg(Msg::Reload);
|
||||
}
|
||||
model.versions.server = Some(version);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user