From 5b3aa3bf372599fc1c7fb0e78dcc3e49059540fe Mon Sep 17 00:00:00 2001 From: mysticmomba Date: Thu, 24 Sep 2026 10:07:13 -0400 Subject: [PATCH] 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. --- src-tauri/Cargo.lock | 1 + src-tauri/Cargo.toml | 1 + src-tauri/src/commands/updater.rs | 17 ++++++++++------- src/main.js | 1 - 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock index 74f7df9..ee13966 100644 --- a/src-tauri/Cargo.lock +++ b/src-tauri/Cargo.lock @@ -60,6 +60,7 @@ dependencies = [ "ping-async", "pulldown-cmark", "reqwest 0.12.28", + "semver", "serde", "serde_json", "tauri", diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index 8d3971b..07a3276 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -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" diff --git a/src-tauri/src/commands/updater.rs b/src-tauri/src/commands/updater.rs index ef9c8ac..c5a522f 100644 --- a/src-tauri/src/commands/updater.rs +++ b/src-tauri/src/commands/updater.rs @@ -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, 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, 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(¤t) + .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, Stri } else { Ok(None) } -} \ No newline at end of file +} diff --git a/src/main.js b/src/main.js index 979b8a2..dd89320 100644 --- a/src/main.js +++ b/src/main.js @@ -1097,7 +1097,6 @@ var updater = (() => { var msg = document.getElementById('update-message'); var link = document.getElementById('update-link'); var text = 'Argus v' + info.version + ' is available.'; - if (info.notes) text += ' ' + info.notes; msg.textContent = text; link.href = info.url; link.addEventListener('click', function (e) {