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", "ping-async",
"pulldown-cmark", "pulldown-cmark",
"reqwest 0.12.28", "reqwest 0.12.28",
"semver",
"serde", "serde",
"serde_json", "serde_json",
"tauri", "tauri",
+1
View File
@@ -34,6 +34,7 @@ open = "5.4.4"
reqwest = { version = "0.12", features = ["json"] } reqwest = { version = "0.12", features = ["json"] }
libc = "0.2.189" libc = "0.2.189"
pulldown-cmark = { version = "0.13.4", features = ["html"] } pulldown-cmark = { version = "0.13.4", features = ["html"] }
semver = "1.0.28"
[target.'cfg(windows)'.dependencies] [target.'cfg(windows)'.dependencies]
is_elevated = "0.1" is_elevated = "0.1"
+10 -7
View File
@@ -1,7 +1,8 @@
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use tauri::AppHandle; 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)] #[derive(Debug, Clone, Serialize, Deserialize)]
pub struct UpdateInfo { pub struct UpdateInfo {
@@ -29,10 +30,7 @@ pub async fn check_for_update(app: AppHandle) -> Result<Option<UpdateInfo>, Stri
.as_str() .as_str()
.ok_or_else(|| "No tag_name in response".to_string())?; .ok_or_else(|| "No tag_name in response".to_string())?;
let html_url = body["html_url"] let html_url = body["html_url"].as_str().unwrap_or("").to_string();
.as_str()
.unwrap_or("")
.to_string();
let notes = body["body"] let notes = body["body"]
.as_str() .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 remote_version = tag.strip_prefix('v').unwrap_or(tag);
let current = app.package_info().version.to_string(); 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 { Ok(Some(UpdateInfo {
version: remote_version.to_string(), version: remote_version.to_string(),
url: html_url, url: html_url,
@@ -51,4 +54,4 @@ pub async fn check_for_update(app: AppHandle) -> Result<Option<UpdateInfo>, Stri
} else { } else {
Ok(None) Ok(None)
} }
} }
-1
View File
@@ -1097,7 +1097,6 @@ var updater = (() => {
var msg = document.getElementById('update-message'); var msg = document.getElementById('update-message');
var link = document.getElementById('update-link'); var link = document.getElementById('update-link');
var text = 'Argus v' + info.version + ' is available.'; var text = 'Argus v' + info.version + ' is available.';
if (info.notes) text += ' ' + info.notes;
msg.textContent = text; msg.textContent = text;
link.href = info.url; link.href = info.url;
link.addEventListener('click', function (e) { link.addEventListener('click', function (e) {