diff options
| author | Ogulcan Celik <ogulcancelik@gmail.com> | 2026-03-31 14:23:14 +0300 |
|---|---|---|
| committer | Ogulcan Celik <ogulcancelik@gmail.com> | 2026-03-31 14:23:14 +0300 |
| commit | 7c8f12e8f2656d239a029552bc042bf44efdcf41 (patch) | |
| tree | 3c6ac99c9304de1f30876b4d0c5f1645e91c8430 /src/update.rs | |
| parent | b2293687afa4ba268eac98bf885bf6e5a5133180 (diff) | |
feat: poll for updates and show toast notifications
Diffstat (limited to 'src/update.rs')
| -rw-r--r-- | src/update.rs | 16 |
1 files changed, 16 insertions, 0 deletions
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<Version, String> { /// Background auto-update: check, download, install, notify TUI. /// Runs in a background thread at startup. pub fn auto_update(events: tokio::sync::mpsc::Sender<crate::events::AppEvent>) { + 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 |
