From 40b05df364891a3f035dfc08683b49f575f668ca Mon Sep 17 00:00:00 2001 From: spearzificial <342299391+spearzificial@users.noreply.github.com> Date: Wed, 21 Oct 2026 17:29:14 +0530 Subject: [PATCH] fix(updater): query every release source and keep the highest version check_for_updates returned on the first host that answered. Forgejo is listed first, so the updater was pinned to the Forgejo release feed and never looked at GitHub. A release published only on GitHub was invisible: a user running v0.2.17 was told that v0.2.18 was the newest release and was never offered the v0.2.19 onward releases. Both hosts are now queried and the release with the highest version wins, so a lagging mirror can no longer hide a newer release. --- src/updater.rs | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/updater.rs b/src/updater.rs index 6466b12..432c22b 100644 --- a/src/updater.rs +++ b/src/updater.rs @@ -61,6 +61,12 @@ pub fn check_for_updates() -> Option { format!("https://api.github.com/repos/{}/releases/latest", REPO_OWNER_NAME), ]; + // Every source is queried and the highest version wins. Returning on the + // first answer would pin the updater to whichever host happens to be + // listed first, so a release published on the other one would never be + // seen. + let mut best: Option = None; + for url in urls { let mut cmd = std::process::Command::new("curl"); cmd.args([ @@ -81,7 +87,7 @@ pub fn check_for_updates() -> Option { let clean_ver = release.tag_name.trim().trim_start_matches('v').to_string(); let has_update = is_newer(&clean_ver, CURRENT_VERSION); - return Some(ReleaseInfo { + let info = ReleaseInfo { tag_name: release.tag_name, version: clean_ver, name: release.name.unwrap_or_else(|| format!("v{}", CURRENT_VERSION)), @@ -89,10 +95,15 @@ pub fn check_for_updates() -> Option { release_notes: release.body.unwrap_or_default(), has_update, assets: release.assets, + }; + + best = Some(match best { + Some(current) if !is_newer(&info.version, ¤t.version) => current, + _ => info, }); } } - None + best } #[derive(Debug, Clone, PartialEq, Eq, Default)]