fix: Fixed updater to only check for newer version using proper semver checking. Before it only checked if the current in use version was different than what was available.

This commit is contained in:
2026-09-24 10:07:13 -04:00
parent f3dd13d831
commit 5b3aa3bf37
4 changed files with 12 additions and 8 deletions
+1
View File
@@ -60,6 +60,7 @@ dependencies = [
"ping-async",
"pulldown-cmark",
"reqwest 0.12.28",
"semver",
"serde",
"serde_json",
"tauri",
+1
View File
@@ -34,6 +34,7 @@ open = "5.4.4"
reqwest = { version = "0.12", features = ["json"] }
libc = "0.2.189"
pulldown-cmark = { version = "0.13.4", features = ["html"] }
semver = "1.0.28"
[target.'cfg(windows)'.dependencies]
is_elevated = "0.1"
+10 -7
View File
@@ -1,7 +1,8 @@
use serde::{Deserialize, Serialize};
use tauri::AppHandle;
const UPDATE_URL: &str = "https://git.racooncity.org/api/v1/repos/mysticmomba/argus/releases/latest";
const UPDATE_URL: &str =
"https://git.racooncity.org/api/v1/repos/mysticmomba/argus/releases/latest";
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct UpdateInfo {
@@ -29,10 +30,7 @@ pub async fn check_for_update(app: AppHandle) -> Result<Option<UpdateInfo>, Stri
.as_str()
.ok_or_else(|| "No tag_name in response".to_string())?;
let html_url = body["html_url"]
.as_str()
.unwrap_or("")
.to_string();
let html_url = body["html_url"].as_str().unwrap_or("").to_string();
let notes = body["body"]
.as_str()
@@ -42,7 +40,12 @@ pub async fn check_for_update(app: AppHandle) -> Result<Option<UpdateInfo>, Stri
let remote_version = tag.strip_prefix('v').unwrap_or(tag);
let current = app.package_info().version.to_string();
if remote_version != current {
let remote_semver = semver::Version::parse(remote_version)
.map_err(|e| format!("Invalid remote version '{}': {}", remote_version, e))?;
let current_semver = semver::Version::parse(&current)
.map_err(|e| format!("Invalid current version '{}': {}", current, e))?;
if remote_semver > current_semver {
Ok(Some(UpdateInfo {
version: remote_version.to_string(),
url: html_url,
@@ -51,4 +54,4 @@ pub async fn check_for_update(app: AppHandle) -> Result<Option<UpdateInfo>, Stri
} else {
Ok(None)
}
}
}