From 7c8f12e8f2656d239a029552bc042bf44efdcf41 Mon Sep 17 00:00:00 2001 From: Ogulcan Celik Date: Tue, 31 Mar 2026 14:23:14 +0300 Subject: feat: poll for updates and show toast notifications --- src/update.rs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/update.rs') diff --git a/src/update.rs b/src/update.rs index e3fb0d77..4250a007 100644 --- a/src/update.rs +++ b/src/update.rs @@ -12,6 +12,7 @@ use serde::Deserialize; const GITHUB_REPO: &str = "ogulcancelik/herdr"; const CURRENT_VERSION: &str = env!("CARGO_PKG_VERSION"); +const FAKE_UPDATE_VERSION_ENV: &str = "HERDR_FAKE_UPDATE_VERSION"; // --------------------------------------------------------------------------- // Version @@ -213,6 +214,21 @@ pub fn self_update() -> Result { /// Background auto-update: check, download, install, notify TUI. /// Runs in a background thread at startup. pub fn auto_update(events: tokio::sync::mpsc::Sender) { + if let Ok(version) = env::var(FAKE_UPDATE_VERSION_ENV) { + let version = version.trim(); + if !version.is_empty() { + tracing::info!( + env = FAKE_UPDATE_VERSION_ENV, + version, + "using fake update version for local testing" + ); + let _ = events.blocking_send(crate::events::AppEvent::UpdateReady { + version: version.to_string(), + }); + } + return; + } + let release = match check_latest() { Ok(Some(r)) => r, _ => return, // up to date or failed — silently do nothing -- cgit v1.2.3