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) <noreply@anthropic.com>
This commit is contained in:
Huang Xin
2026-06-09 23:46:09 +08:00
committed by GitHub
parent ad23fbba9f
commit 75dc2e4e81
+11 -1
View File
@@ -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;