fix(updater): disable in-app updater on non-AppImage Linux (#4874) (#4897)

Tauri's Linux updater can only self-update AppImage bundles, so deb/rpm/
pacman and Flatpak installs showed a "Software Update" prompt that could
never apply. READEST_DISABLE_UPDATER also had no effect: the variable
reached the process, but its value only flowed to the frontend through a
WebView init-script global (window.__READEST_UPDATER_DISABLED) that is
not reliably visible to page scripts on Linux/WebKitGTK.

Make the decision authoritative in Rust and read it over IPC:

- Add compute_updater_disabled (pure, unit-tested) plus the
  is_updater_disabled desktop command: an env opt-out, Flatpak, or a
  Linux non-AppImage install disables the updater. setup() reuses the
  same helper for the init-script global.
- NativeAppService.init() sets hasUpdater from the command for desktop
  apps instead of relying on the init-script global.

Non-AppImage Linux installs now defer to the system package manager and
fall back to the "What's New" release notes.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Huang Xin
2026-07-03 01:55:02 +09:00
committed by GitHub
parent bd415a8501
commit 77ea87c344
3 changed files with 221 additions and 11 deletions
@@ -592,6 +592,18 @@ export class NativeAppService extends BaseAppService {
override async init() {
const execDir = await invoke<string>('get_executable_dir');
this.execDir = execDir;
// Ask Rust whether the in-app updater must stay hidden (READEST_DISABLE_UPDATER,
// Flatpak, or a Linux deb/rpm/pacman install that Tauri can't self-update). The
// command is the reliable source of truth; the `__READEST_UPDATER_DISABLED`
// init-script global isn't dependable on every Linux/WebKitGTK setup (#4874).
if (this.isDesktopApp) {
try {
const updaterDisabled = await invoke<boolean>('is_updater_disabled');
this.hasUpdater = this.hasUpdater && !updaterDisabled;
} catch (err) {
console.warn('[nativeAppService] is_updater_disabled failed:', err);
}
}
if (
process.env['NEXT_PUBLIC_PORTABLE_APP'] ||
(await this.fs.exists(`${execDir}/${SETTINGS_FILENAME}`, 'None'))