From ab7489c964977c2cc19cdc303bd8f7142d5f5a2c Mon Sep 17 00:00:00 2001 From: Tony <68118705+Legend-Master@users.noreply.github.com> Date: Tue, 21 Jul 2026 18:25:16 +0800 Subject: [PATCH] feat(updater): option to not restart after install (#3299) * feat(updater): option to not restart after install * More platform cfg * Add the same function for `UpdaterBuilder` * Fix missing `#[cfg(windows)]` * Mark `current_exe_args` cfg(windows) * Mark `on_before_exit` cfg(windows) * Mark `installer_args` cfg(windows) * Note about `installer_arg` apply to both * Remove current args and restart together * Only build needed bundle on windows as well * Remove `/NS` since it breaks the msi updater * Add launch updater debug log * Add a folder to test updates * Remove unused `#[allow(unused)]` * Format * messed up git stage * Add change file * Clean up * Disable NSIS compression for API example * Bump wry for v1 test to pull in https://github.com/tauri-apps/wry/pull/1703 * format * Make typescript happy * Close new update on destroy --- .changes/updater-install-no-restart.md | 6 + examples/api/src-tauri/tauri.conf.json | 5 + examples/api/src/views/Updater.svelte | 30 +- examples/api/updater-test/.gitignore | 5 + examples/api/updater-test/README.md | 10 + examples/api/updater-test/updater.json | 11 + examples/api/vite.config.js | 2 +- plugins/updater/api-iife.js | 2 +- plugins/updater/guest-js/index.ts | 15 +- plugins/updater/src/commands.rs | 17 +- plugins/updater/src/config.rs | 19 +- plugins/updater/src/lib.rs | 6 +- plugins/updater/src/updater.rs | 360 +++++++++++------- .../updater/tests/app-updater/tauri.conf.json | 3 +- .../updater/tests/app-updater/tests/update.rs | 19 +- .../tests/updater-migration/v1-app/Cargo.lock | 6 +- 16 files changed, 328 insertions(+), 188 deletions(-) create mode 100644 .changes/updater-install-no-restart.md create mode 100644 examples/api/updater-test/.gitignore create mode 100644 examples/api/updater-test/README.md create mode 100644 examples/api/updater-test/updater.json diff --git a/.changes/updater-install-no-restart.md b/.changes/updater-install-no-restart.md new file mode 100644 index 000000000..9a9c1165c --- /dev/null +++ b/.changes/updater-install-no-restart.md @@ -0,0 +1,6 @@ +--- +"updater": minor +"updater-js": minor +--- + +On Windows, add a new option `restartAfterInstall`/`restart_after_install` to install an update without the installer re-launching the app diff --git a/examples/api/src-tauri/tauri.conf.json b/examples/api/src-tauri/tauri.conf.json index 00b095be8..be4918de3 100644 --- a/examples/api/src-tauri/tauri.conf.json +++ b/examples/api/src-tauri/tauri.conf.json @@ -77,7 +77,9 @@ }, "updater": { "pubkey": "dW50cnVzdGVkIGNvbW1lbnQ6IG1pbmlzaWduIHB1YmxpYyBrZXk6IDE5QzMxNjYwNTM5OEUwNTgKUldSWTRKaFRZQmJER1h4d1ZMYVA3dnluSjdpN2RmMldJR09hUFFlZDY0SlFqckkvRUJhZDJVZXAK", + "dangerousInsecureTransportProtocol": true, "endpoints": [ + "http://localhost:5173/updater-test/updater.json", "https://tauri-update-server.vercel.app/update/{{target}}/{{current_version}}" ] } @@ -99,6 +101,9 @@ "localePath": "locales/pt-BR.wxl" } } + }, + "nsis": { + "compression": "none" } }, "iOS": { diff --git a/examples/api/src/views/Updater.svelte b/examples/api/src/views/Updater.svelte index 26d074a6b..5fdc77509 100644 --- a/examples/api/src/views/Updater.svelte +++ b/examples/api/src/views/Updater.svelte @@ -1,12 +1,18 @@ -