diff options
| author | Ogulcan Celik <ogulcancelik@gmail.com> | 2026-04-01 02:26:03 +0300 |
|---|---|---|
| committer | Ogulcan Celik <ogulcancelik@gmail.com> | 2026-04-01 02:26:03 +0300 |
| commit | 063ffc2b7057b66b03b2d2d60232b235b123f3e4 (patch) | |
| tree | 2acba8850acbb58461964dfa4efac7021d9f6851 /src/update.rs | |
| parent | da99c089181b8a4dd276b4dfdb8dd2492adba0f2 (diff) | |
feat: show release notes after updates
Diffstat (limited to 'src/update.rs')
| -rw-r--r-- | src/update.rs | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/update.rs b/src/update.rs index 4250a007..d616ace8 100644 --- a/src/update.rs +++ b/src/update.rs @@ -58,6 +58,8 @@ impl std::fmt::Display for Version { #[derive(Deserialize)] struct GitHubRelease { tag_name: String, + #[serde(default)] + body: String, assets: Vec<GitHubAsset>, } @@ -75,6 +77,7 @@ struct GitHubAsset { struct ReleaseInfo { version: Version, download_url: String, + notes_body: String, } /// Check GitHub for the latest release. Returns release info if newer. @@ -124,6 +127,7 @@ fn check_latest() -> Result<Option<ReleaseInfo>, String> { Ok(Some(ReleaseInfo { version: latest, download_url, + notes_body: release.body.trim().to_string(), })) } @@ -205,6 +209,11 @@ pub fn self_update() -> Result<Version, String> { }; eprintln!("downloading v{}...", release.version); + if let Err(e) = + crate::release_notes::save_pending(&release.version.to_string(), &release.notes_body) + { + tracing::warn!("failed to save pending release notes: {e}"); + } download_and_install(&release)?; eprintln!("updated to v{}", release.version); @@ -240,6 +249,12 @@ pub fn auto_update(events: tokio::sync::mpsc::Sender<crate::events::AppEvent>) { release.download_url ); + if let Err(e) = + crate::release_notes::save_pending(&release.version.to_string(), &release.notes_body) + { + tracing::warn!("failed to save pending release notes: {e}"); + } + if let Err(e) = download_and_install(&release) { tracing::warn!("auto-update failed: {e}"); return; |
