From efad9075e77d034c8a21567dc01d1de90f8bc367 Mon Sep 17 00:00:00 2001 From: mlsmaycon Date: Sun, 12 Jul 2026 14:00:21 +0200 Subject: [PATCH] [client] Preserve user autostart setting across Windows NSIS upgrades The NSIS upgrade path runs the previous version's uninstaller before reinstalling, and that uninstaller deleted the per-user HKCU Run value that the UI's Wails autostart toggle owns. As a result every EXE-based auto-update silently wiped the user's launch-on-login choice. Stop deleting the HKCU value on uninstall; a leftover entry after a genuine uninstall is harmless since Windows ignores Run values whose target no longer exists. The legacy machine-wide HKLM entry is still cleaned up. --- client/installer.nsis | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/client/installer.nsis b/client/installer.nsis index 71699071b..4a595317f 100644 --- a/client/installer.nsis +++ b/client/installer.nsis @@ -299,14 +299,14 @@ ExecWait '"$INSTDIR\${MAIN_APP_EXE}" service uninstall' DetailPrint "Terminating Netbird UI process..." ExecWait `taskkill /im ${UI_APP_EXE}.exe /f` -; Remove autostart registry entries -DetailPrint "Removing autostart registry entries if they exist..." -; Legacy machine-wide entry written by older installers. +; Remove the legacy machine-wide autostart entry older installers wrote. +; The per-user HKCU\...\Run value is owned by the UI's Wails toggle and is +; left untouched here: the NSIS upgrade path runs this uninstaller before +; reinstalling, so deleting it would wipe the user's launch-on-login choice +; on every update. A leftover entry after a genuine uninstall is harmless -- +; Windows ignores Run values whose target executable no longer exists. +DetailPrint "Removing legacy machine-wide autostart entry if present..." DeleteRegValue HKLM "${AUTOSTART_REG_KEY}" "${APP_NAME}" -; Per-user entry the UI toggle writes via Wails (value name is the lowercase -; app-name slug). Uninstall removes the app, so drop it too. -DeleteRegValue HKCU "${AUTOSTART_REG_KEY}" "${APP_NAME}" -DeleteRegValue HKCU "${AUTOSTART_REG_KEY}" "netbird" ; Handle data deletion based on checkbox DetailPrint "Checking if user requested data deletion..."