From ab8dcbe7500a5cb5fc93184c296047eccfccc4fc Mon Sep 17 00:00:00 2001 From: EtienneLescot Date: Sun, 1 Nov 2026 18:41:21 +0100 Subject: [PATCH] fix(updater): bring the app back when a silent Windows update's UAC is declined A silent update of a per-machine NSIS install elevates in the install section, after the app has quit. Declining UAC (1223) made the stock installer just quit, leaving OpenScreen closed. Elevate in customInit instead and relaunch the installed app if elevation fails. Refs #1461 --- build/installer.nsh | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 build/installer.nsh diff --git a/build/installer.nsh b/build/installer.nsh new file mode 100644 index 0000000000..9a04aeea9e --- /dev/null +++ b/build/installer.nsh @@ -0,0 +1,19 @@ +; Picked up by electron-builder as `/installer.nsh` (the NSIS `include` option). + +; A silent update of a per-machine install (`/S`, see installsSilently in electron/auto-updater.ts) +; asks for UAC in the install section, by which time the app has already quit. Declining it +; (error 1223) makes electron-builder's installer.nsi just Quit, so OpenScreen stays closed (#1461). +; Elevate here instead, as the stock section would, and bring the app back if that fails. The +; downloaded update stays cached, so the user can retry it. +!macro customInit + ${if} ${Silent} + ${andIf} $hasPerMachineInstallation == "1" + ${andIfNot} ${UAC_IsAdmin} + !insertmacro UAC_RunElevated + ${if} $0 != 0 + ${andIf} ${isForceRun} + ExecShell "open" "$perMachineInstallationFolder\${APP_EXECUTABLE_FILENAME}" + ${endIf} + Quit + ${endIf} +!macroend