diff options
author | GeckoEidechse <gecko.eidechse+git@pm.me> | 2022-09-06 00:43:23 +0200 |
---|---|---|
committer | GeckoEidechse <gecko.eidechse+git@pm.me> | 2022-09-06 00:43:23 +0200 |
commit | 0317faf09e4afcf32ec325cfeaf122db009e63da (patch) | |
tree | 107c408e793de644fb5a6e6538ecf8527e4064f9 /src-tauri/src/main.rs | |
parent | 2c206af1247514fbed4400c855b92e9e6ef428e4 (diff) | |
download | FlightCore-0317faf09e4afcf32ec325cfeaf122db009e63da.tar.gz FlightCore-0317faf09e4afcf32ec325cfeaf122db009e63da.zip |
Implement update check for found Northstar install
Also includes initial add of libthermite as dependency
Diffstat (limited to 'src-tauri/src/main.rs')
-rw-r--r-- | src-tauri/src/main.rs | 33 |
1 files changed, 30 insertions, 3 deletions
diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs index 34dcc39c..9dd15b55 100644 --- a/src-tauri/src/main.rs +++ b/src-tauri/src/main.rs @@ -104,9 +104,36 @@ fn get_northstar_version_number_caller() -> String { } #[tauri::command] -fn check_is_northstar_outdated() -> bool { - // TODO implement check - false +/// Checks if installed Northstar version is up-to-date +/// false -> Northstar install is up-to-date +/// true -> Northstar install is outdated +async fn check_is_northstar_outdated() -> bool { + let index = thermite::api::get_package_index().await.unwrap().to_vec(); + let nmod = index + .iter() + .find(|f| f.name.to_lowercase() == "northstar") + .unwrap(); + // .ok_or_else(|| anyhow!("Couldn't find Northstar on thunderstore???"))?; + + dbg!(nmod); + + let version_number = match get_northstar_version_number() { + Ok(version_number) => version_number, + Err(err) => { + println!("{}",err); + // If we fail to get new version just assume we are up-to-date + return false; + } + }; + + if version_number != nmod.version { + println!("Installed Northstar version outdated"); + true + } + else { + println!("Installed Northstar version up-to-date"); + false + } } #[tauri::command] |