diff --git a/.github/scripts/test_update_manifest.py b/.github/scripts/test_update_manifest.py index 6d6aab0..6b1e499 100644 --- a/.github/scripts/test_update_manifest.py +++ b/.github/scripts/test_update_manifest.py @@ -18,10 +18,15 @@ def test_linux_downloads_stay_in_their_format(self): } for filename in filenames.values(): (assets / filename).touch() - (assets / f"{filenames['appimage']}.sig").write_text("signature") + for signed_format in ["appimage", "deb", "rpm"]: + (assets / f"{filenames[signed_format]}.sig").write_text("signature") doc = build_manifest("0.2.7", "LowBloat/LowNotes", assets, "Notes") - self.assertEqual(list(doc["platforms"]), ["linux-x86_64-appimage"]) + self.assertEqual(sorted(doc["platforms"]), + ["linux-x86_64-appimage", "linux-x86_64-deb", "linux-x86_64-rpm"]) self.assertNotIn("linux-x86_64", doc["platforms"]) + for signed_format in ["appimage", "deb", "rpm"]: + self.assertEqual(doc["platforms"][f"linux-x86_64-{signed_format}"]["url"], + f"https://github.com/LowBloat/LowNotes/releases/download/v0.2.7/{filenames[signed_format]}") for package_format, filename in filenames.items(): self.assertEqual(doc["downloads"][f"linux-x86_64-{package_format}"], f"https://github.com/LowBloat/LowNotes/releases/download/v0.2.7/{filename}") diff --git a/.github/scripts/update_manifest.py b/.github/scripts/update_manifest.py index baac02b..fb77cdc 100644 --- a/.github/scripts/update_manifest.py +++ b/.github/scripts/update_manifest.py @@ -20,8 +20,11 @@ def signed(key, asset): signed("windows-x86_64", f"LowNotes-{version}-windows-x64-setup.exe") signed("darwin-aarch64", f"LowNotes-{version}-macos-universal.app.tar.gz") signed("darwin-x86_64", f"LowNotes-{version}-macos-universal.app.tar.gz") - # Never publish a generic Linux target: native packages must not receive AppImages. + # One key per Linux format, never a generic one: a .deb install must get a + # .deb, an .rpm install an .rpm, and the Arch package nothing (pacman owns it). signed("linux-x86_64-appimage", f"LowNotes-{version}-linux-x64.AppImage") + signed("linux-x86_64-deb", f"LowNotes-{version}-linux-x64.deb") + signed("linux-x86_64-rpm", f"LowNotes-{version}-linux-x64.rpm") for package_format, asset in { "appimage": f"LowNotes-{version}-linux-x64.AppImage", "deb": f"LowNotes-{version}-linux-x64.deb", diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 0afa9d7..09e1d8a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -184,6 +184,8 @@ jobs: dest_deb="LowNotes-${VERSION}-linux-x64.deb" cp "$deb_file" "dist/$dest_deb" (cd dist && sha256sum "$dest_deb" > "$dest_deb.sha256") + # Updater signature: .deb installs update themselves through dpkg. + cp "$deb_file.sig" "dist/$dest_deb.sig" fi # Coletar .rpm @@ -192,6 +194,8 @@ jobs: dest_rpm="LowNotes-${VERSION}-linux-x64.rpm" cp "$rpm_file" "dist/$dest_rpm" (cd dist && sha256sum "$dest_rpm" > "$dest_rpm.sha256") + # Updater signature: .rpm installs update themselves through rpm. + cp "$rpm_file.sig" "dist/$dest_rpm.sig" fi # Coletar .AppImage diff --git a/CHANGELOG.md b/CHANGELOG.md index a828c2d..a9ded47 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,12 @@ Releases up to 0.3.5 are described on the [GitHub releases page](https://github. ## [Unreleased] +## [0.5.2] - 2026-11-11 + +### Fixed +- **Automatic updates on Linux `.deb` and `.rpm` installs.** They were only told a new version existed: the release published no updater signature or manifest entry for them, and the app treated them as owned by the package manager. Now, when dpkg or rpm really owns the binary and it was built as that package, the update installs the new package itself (pkexec asks for the administrator password), like Windows, macOS and the AppImage. The Arch package, Flatpak, Snap and portable copies keep the download link. +- **Updates show up much sooner.** The app checked every six hours; it now checks every 10 minutes and when the window regains focus, downloads the update in the background and only then shows the dialog, whose **Restart now** installs it right away. Each version is announced once instead of at every check. + ## [0.5.1] - 2026-11-10 ### Changed @@ -97,7 +103,8 @@ Releases up to 0.3.5 are described on the [GitHub releases page](https://github. - Dependency updates: Tauri plugins, iroh 1.3, rusqlite 0.40, base64 0.23, html-escape 0.3 and GitHub Actions. - Community, security and design documentation ([#32](https://github.com/LowBloat/LowNotes/issues/32), [#33](https://github.com/LowBloat/LowNotes/issues/33)). -[Unreleased]: https://github.com/LowBloat/LowNotes/compare/v0.5.1...HEAD +[Unreleased]: https://github.com/LowBloat/LowNotes/compare/v0.5.2...HEAD +[0.5.2]: https://github.com/LowBloat/LowNotes/compare/v0.5.1...v0.5.2 [0.5.1]: https://github.com/LowBloat/LowNotes/compare/v0.5.0...v0.5.1 [0.5.0]: https://github.com/LowBloat/LowNotes/compare/v0.4.2...v0.5.0 [0.4.2]: https://github.com/LowBloat/LowNotes/compare/v0.4.1...v0.4.2 diff --git a/README.md b/README.md index 07f389b..3a42e62 100644 --- a/README.md +++ b/README.md @@ -85,7 +85,7 @@ In-app updates are signed separately and verified before installation. When you close the window, the app stays in the system tray by default. Opening LowNotes again shows and focuses the existing window, restoring it if minimized. Only one instance runs at a time. You can change the close-to-tray behavior in **Settings → General**; the tray menu also lets you quit completely. -On Linux, updates follow the installation format. Arch, DEB and RPM packages show a new-version notice with a download for the matching package; install it through pacman, APT or your RPM package manager. Repository, AUR, Flatpak and Snap installations should be updated through their original source when the new version becomes available there. Portable `.tar.gz` installations require replacing the application files manually. Only unmanaged AppImages in a writable folder update inside LowNotes. Native packages never replace their executable with an AppImage. +LowNotes checks for a new version every few minutes and when its window regains focus, downloads it in the background and then asks to restart. On Linux, updates follow the installation format. DEB and RPM packages installed from the release files update inside LowNotes with a package of the same format (dpkg or rpm installs it after the administrator password prompt), and unmanaged AppImages in a writable folder replace themselves. The Arch package shows a new-version notice with a download for the matching package; install it with pacman. Repository, AUR, Flatpak and Snap installations should be updated through their original source when the new version becomes available there. Portable `.tar.gz` installations require replacing the application files manually. Native packages never replace their executable with an AppImage. ## What the app offers diff --git a/package.json b/package.json index f53b5cd..e14e67a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "lownotes", - "version": "0.5.1", + "version": "0.5.2", "description": "Local-first Markdown note-taking app with encrypted P2P sync, real-time collaboration and optional AI for Windows, Linux and macOS.", "homepage": "https://lowbloat.app/en/produtos/lownotes/", "repository": { diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock index 1c8895c..5f11260 100644 --- a/src-tauri/Cargo.lock +++ b/src-tauri/Cargo.lock @@ -3066,7 +3066,7 @@ dependencies = [ [[package]] name = "lownotes" -version = "0.5.1" +version = "0.5.2" dependencies = [ "anyhow", "base64 0.23.1", diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index f13c95b..1225023 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "lownotes" -version = "0.5.1" +version = "0.5.2" description = "Local-first Markdown notes with serverless P2P sync and real-time collaboration" authors = ["LowBloat"] license = "AGPL-3.0-only" diff --git a/src-tauri/src/updates.rs b/src-tauri/src/updates.rs index 694128a..3b4642c 100644 --- a/src-tauri/src/updates.rs +++ b/src-tauri/src/updates.rs @@ -28,14 +28,25 @@ pub struct UpdatePolicy { } impl UpdatePolicy { - fn new(channel: UpdateChannel, appimage_writable: bool, arch: &str) -> Self { - let can_install = channel == UpdateChannel::Internal - || (channel == UpdateChannel::Appimage && appimage_writable); + /// `installable`: a writable AppImage, or a .deb/.rpm that dpkg/rpm really + /// owns and that was built as that package. Those install the signed update + /// themselves (the updater hands .deb/.rpm to dpkg/rpm through pkexec, which + /// asks for the administrator password). Arch, Flatpak, Snap and portable + /// copies are only told a new version exists. + fn new(channel: UpdateChannel, installable: bool, arch: &str) -> Self { + let format = match channel { + UpdateChannel::Appimage => Some("appimage"), + UpdateChannel::Deb => Some("deb"), + UpdateChannel::Rpm => Some("rpm"), + _ => None, + }; + let can_install = channel == UpdateChannel::Internal || (format.is_some() && installable); Self { channel, can_install, - updater_target: (channel == UpdateChannel::Appimage && can_install) - .then(|| format!("linux-{arch}-appimage")), + updater_target: format + .filter(|_| can_install) + .map(|format| format!("linux-{arch}-{format}")), } } @@ -123,11 +134,12 @@ fn detect_linux_policy() -> UpdatePolicy { } } } + let bundle = tauri::utils::platform::bundle_type(); let channel = linux_channel(&LinuxInstallation { flatpak, snap, owner, - bundle: tauri::utils::platform::bundle_type(), + bundle: bundle.clone(), appimage: appimage.is_some(), system_path: executable.as_ref().is_some_and(|path| { ["/usr", "/opt", "/nix", "/app", "/snap", "/var/lib/flatpak"] @@ -135,10 +147,10 @@ fn detect_linux_policy() -> UpdatePolicy { .any(|prefix| path.starts_with(prefix)) }), }); - // Replacing an AppImage requires creating a backup in its parent directory. - // Probe this only for genuine unmanaged AppImages, never for native packages. - let writable = channel == UpdateChannel::Appimage - && executable + let installable = match channel { + // Replacing an AppImage requires creating a backup in its parent directory. + // Probe this only for genuine unmanaged AppImages, never for native packages. + UpdateChannel::Appimage => executable .as_ref() .and_then(|path| path.parent()) .is_some_and(|parent| { @@ -146,8 +158,32 @@ fn detect_linux_policy() -> UpdatePolicy { .prefix(".lownotes-update-check-") .tempfile_in(parent) .is_ok() - }); - UpdatePolicy::new(channel, writable, std::env::consts::ARCH) + }), + // The updater picks dpkg or rpm from the bundle type built into the + // binary, so it must agree with the package manager that owns it. + UpdateChannel::Deb | UpdateChannel::Rpm => { + native_package_updates_itself(channel, owner, bundle) + } + _ => false, + }; + UpdatePolicy::new(channel, installable, std::env::consts::ARCH) +} + +/// A .deb or .rpm install updates itself only when dpkg/rpm owns the binary and +/// it was built as that same package (a binary copied elsewhere keeps its marker). +#[cfg(any(target_os = "linux", test))] +fn native_package_updates_itself( + channel: UpdateChannel, + owner: Option, + bundle: Option, +) -> bool { + use tauri::utils::config::BundleType; + owner == Some(channel) + && matches!( + (channel, bundle), + (UpdateChannel::Deb, Some(BundleType::Deb)) + | (UpdateChannel::Rpm, Some(BundleType::Rpm)) + ) } #[derive(Debug, Deserialize)] @@ -234,11 +270,50 @@ mod tests { use tauri::utils::config::BundleType; #[test] - fn native_packages_and_sandboxes_never_install_internally() { - for channel in [ - UpdateChannel::Arch, + fn deb_and_rpm_install_their_own_format_when_installable() { + for (channel, format) in [(UpdateChannel::Deb, "deb"), (UpdateChannel::Rpm, "rpm")] { + let policy = UpdatePolicy::new(channel, true, "x86_64"); + assert!(policy.can_install); + assert_eq!( + policy.updater_target.as_deref(), + Some(format!("linux-x86_64-{format}").as_str()) + ); + let unowned = UpdatePolicy::new(channel, false, "x86_64"); + assert!(!unowned.can_install); + assert!(unowned.updater_target.is_none()); + } + assert!(native_package_updates_itself( + UpdateChannel::Deb, + Some(UpdateChannel::Deb), + Some(BundleType::Deb) + )); + assert!(native_package_updates_itself( + UpdateChannel::Rpm, + Some(UpdateChannel::Rpm), + Some(BundleType::Rpm) + )); + // Not owned by the package manager, or built as another format. + assert!(!native_package_updates_itself( UpdateChannel::Deb, + None, + Some(BundleType::Deb) + )); + assert!(!native_package_updates_itself( + UpdateChannel::Deb, + Some(UpdateChannel::Deb), + Some(BundleType::Rpm) + )); + assert!(!native_package_updates_itself( UpdateChannel::Rpm, + Some(UpdateChannel::Rpm), + None + )); + } + + #[test] + fn other_packages_and_sandboxes_never_install_internally() { + for channel in [ + UpdateChannel::Arch, UpdateChannel::Flatpak, UpdateChannel::Snap, UpdateChannel::Portable, diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index 98d94f1..e9f4bf2 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -1,7 +1,7 @@ { "$schema": "https://schema.tauri.app/config/2", "productName": "LowNotes", - "version": "0.5.1", + "version": "0.5.2", "identifier": "dev.lowbloat.lownotes", "build": { "beforeDevCommand": "bun run icons && bun run dev", diff --git a/src/lib/components/UpdateModal.svelte b/src/lib/components/UpdateModal.svelte index e1cf24a..c383452 100644 --- a/src/lib/components/UpdateModal.svelte +++ b/src/lib/components/UpdateModal.svelte @@ -101,6 +101,13 @@ let received = 0; const total = installer.contentLength ?? 0; try { + if (update.downloaded) { + // Already downloaded and verified in the background. + phase = 'installing'; + await installer.install(); + await relaunch(); + return; + } await installer.downloadAndInstall((event: DownloadEvent) => { if (event.event === 'Progress') { received += event.data.chunkLength; @@ -149,6 +156,10 @@

{$t(updateInstructionKey(policy))}

+ {:else if update.downloaded && phase === 'idle'} +
+

{$t('update.readyHint')}

+
{/if} {#if phase === 'downloading' || phase === 'installing' || phase === 'error'} @@ -212,7 +223,7 @@ disabled={phase === 'downloading' || phase === 'installing'} class="px-4 py-1.5 bg-[var(--accent)] hover:bg-[var(--accent-hover)] disabled:opacity-50 text-[var(--accent-contrast)] text-xs font-semibold rounded-lg shadow-md transition" > - {$t('update.installNow')} + {$t(update.downloaded ? 'update.restartNow' : 'update.installNow')} {:else if update.download_url}