From 75dc2e4e811942b9e51ceacfad39263b9cf8c4b0 Mon Sep 17 00:00:00 2001 From: Huang Xin Date: Tue, 9 Jun 2026 23:46:09 +0800 Subject: [PATCH] fix(updater): disable in-app updater inside Flatpak sandbox, closes #4440 (#4507) Flatpak mounts the app directory read-only, so the bundled Tauri updater can download a new version but never apply it, leaving the user stuck on the old build with no working install path. Update management belongs to the Flatpak runtime / system package manager. Detect the sandbox via FLATPAK_ID or /.flatpak-info and fold it into the existing `updater_disabled` flag, which propagates to `hasUpdater` and suppresses the in-app updater window. Release notes still surface as an informational-only path. Co-authored-by: Claude Opus 4.8 (1M context) --- apps/readest-app/src-tauri/src/lib.rs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/apps/readest-app/src-tauri/src/lib.rs b/apps/readest-app/src-tauri/src/lib.rs index 1e0c798b..08128b49 100644 --- a/apps/readest-app/src-tauri/src/lib.rs +++ b/apps/readest-app/src-tauri/src/lib.rs @@ -415,8 +415,18 @@ pub fn run() { #[cfg(not(target_os = "linux"))] let is_appimage = false; + // Flatpak mounts the app directory read-only, so the bundled updater can + // download but never apply an update. Disable it and leave updates to the + // Flatpak runtime. Detect via FLATPAK_ID or the /.flatpak-info sandbox file. #[cfg(desktop)] - let updater_disabled = std::env::var("READEST_DISABLE_UPDATER").is_ok(); + let updater_disabled = { + #[cfg(target_os = "linux")] + let is_flatpak = std::env::var("FLATPAK_ID").is_ok() + || std::path::Path::new("/.flatpak-info").exists(); + #[cfg(not(target_os = "linux"))] + let is_flatpak = false; + std::env::var("READEST_DISABLE_UPDATER").is_ok() || is_flatpak + }; #[cfg(not(desktop))] let updater_disabled = false;