fix(windows): confirm manual installer launches

This commit is contained in:
Kevin Yue committed 2026-11-17 21:33:28 +08:00
1 parent ce6c97a2f7
commit 2251afab00
4 files changed
+35 -1

No files matched your search

+7 -1
View File
@@ -19,7 +19,7 @@ vendor-signed `wintun.dll`, `licenses`, and `build-info.json`. The NSIS compiler
adds the generated uninstaller; it is not a separately built executable. adds the generated uninstaller; it is not a separately built executable.
The installer, extraction progress and uninstaller use the shared Windows icon The installer, extraction progress and uninstaller use the shared Windows icon
from `apps/gpauth/icons/windows/icon.ico`. The Finish page uses `sidebar.bmp`, from `apps/gpauth/icons/windows/icon.ico`. The confirmation and Finish pages use `sidebar.bmp`,
derived from that same icon. After regenerating application icons, run derived from that same icon. After regenerating application icons, run
`powershell -NoProfile -File scripts/generate-windows-installer-artwork.ps1` `powershell -NoProfile -File scripts/generate-windows-installer-artwork.ps1`
on Windows and retain the updated bitmap before building installers. on Windows and retain the updated bitmap before building installers.
@@ -54,6 +54,12 @@ from the Start menu after completion. User configuration and licensing state
are retained during upgrades and uninstall. Authenticode setup is separate; are retained during upgrades and uninstall. Authenticode setup is separate;
WinSparkle must still verify the installer payload signature before handoff. WinSparkle must still verify the installer payload signature before handoff.
Manual launches show an Install/Cancel confirmation page (Update/Cancel when
GP Connect is already installed). The update feed supplies `/UPDATE` through
WinSparkle's `sparkle:installerArguments` to skip that page after the user has
already confirmed the in-app update. This is not silent mode: elevation,
installation progress, errors, and the Finish page remain visible.
The service log rotates after 5 MiB and retains three numbered archives, keeping The service log rotates after 5 MiB and retains three numbered archives, keeping
each entry whole. The bundle includes `licenses/file-rotate.txt` for the Windows each entry whole. The bundle includes `licenses/file-rotate.txt` for the Windows
service's rotation library. service's rotation library.
+26
View File
@@ -2,6 +2,7 @@ Unicode true
RequestExecutionLevel admin RequestExecutionLevel admin
!include "MUI2.nsh" !include "MUI2.nsh"
!include "x64.nsh" !include "x64.nsh"
!include "FileFunc.nsh"
!ifndef PAYLOAD_DIR !ifndef PAYLOAD_DIR
!error "PAYLOAD_DIR is required" !error "PAYLOAD_DIR is required"
@@ -33,12 +34,18 @@ VIAddVersionKey "FileVersion" "${BUILD_VERSION}"
VIAddVersionKey "LegalCopyright" "GP Connect contributors" VIAddVersionKey "LegalCopyright" "GP Connect contributors"
ShowInstDetails show ShowInstDetails show
ShowUninstDetails show ShowUninstDetails show
Var InstallAction
!define MUI_ICON "${__FILEDIR__}\..\..\apps\gpauth\icons\windows\icon.ico" !define MUI_ICON "${__FILEDIR__}\..\..\apps\gpauth\icons\windows\icon.ico"
!define MUI_UNICON "${MUI_ICON}" !define MUI_UNICON "${MUI_ICON}"
!define MUI_WELCOMEFINISHPAGE_BITMAP "${__FILEDIR__}\sidebar.bmp" !define MUI_WELCOMEFINISHPAGE_BITMAP "${__FILEDIR__}\sidebar.bmp"
!define MUI_ABORTWARNING !define MUI_ABORTWARNING
!define MUI_FINISHPAGE_TITLE "GP Connect is ready" !define MUI_FINISHPAGE_TITLE "GP Connect is ready"
!define MUI_FINISHPAGE_TEXT "Open GP Connect from the Start menu." !define MUI_FINISHPAGE_TEXT "Open GP Connect from the Start menu."
!define MUI_WELCOMEPAGE_TITLE "$InstallAction GP Connect"
!define MUI_WELCOMEPAGE_TEXT "$InstallAction GP Connect for all users on this computer.$\r$\n$\r$\nClick $InstallAction to continue."
!define MUI_PAGE_CUSTOMFUNCTION_PRE ConfirmInstall
!define MUI_PAGE_CUSTOMFUNCTION_SHOW ShowInstallAction
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_INSTFILES !insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH !insertmacro MUI_PAGE_FINISH
!insertmacro MUI_UNPAGE_CONFIRM !insertmacro MUI_UNPAGE_CONFIRM
@@ -62,6 +69,25 @@ Function .onInit
!error "Unsupported TARGET_ARCH" !error "Unsupported TARGET_ARCH"
!endif !endif
SetRegView 64 SetRegView 64
StrCpy $InstallAction "Install"
ReadRegStr $0 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\GPConnect" "DisplayVersion"
${If} $0 != ""
StrCpy $InstallAction "Update"
${EndIf}
FunctionEnd
Function ConfirmInstall
${GetParameters} $0
ClearErrors
${GetOptions} $0 "/UPDATE" $1
${IfNot} ${Errors}
Abort
${EndIf}
FunctionEnd
Function ShowInstallAction
GetDlgItem $0 $HWNDPARENT 1
SendMessage $0 ${WM_SETTEXT} 0 "STR:$InstallAction"
FunctionEnd FunctionEnd
Section "Install" Section "Install"
@@ -64,6 +64,7 @@ class WindowsFeedTests(unittest.TestCase):
self.assertEqual(int(enclosure.get("length")), payload.installer.stat().st_size) self.assertEqual(int(enclosure.get("length")), payload.installer.stat().st_size)
self.assertEqual(enclosure.get(f"{{{feed.SPARKLE}}}edSignature"), payload.signature_file.read_text()) self.assertEqual(enclosure.get(f"{{{feed.SPARKLE}}}edSignature"), payload.signature_file.read_text())
self.assertEqual(enclosure.get(f"{{{feed.SPARKLE}}}os"), f"windows-{payload.architecture}") self.assertEqual(enclosure.get(f"{{{feed.SPARKLE}}}os"), f"windows-{payload.architecture}")
self.assertEqual(enclosure.get(f"{{{feed.SPARKLE}}}installerArguments"), "/UPDATE")
self.assertEqual(enclosure.get(f"{{{feed.SPARKLE}}}version"), "3.4.0") self.assertEqual(enclosure.get(f"{{{feed.SPARKLE}}}version"), "3.4.0")
minimum = "10.0.22000" if payload.architecture == "arm64" else "10.0.19041" minimum = "10.0.22000" if payload.architecture == "arm64" else "10.0.19041"
self.assertEqual(item.findtext(f"{{{feed.SPARKLE}}}minimumSystemVersion"), minimum) self.assertEqual(item.findtext(f"{{{feed.SPARKLE}}}minimumSystemVersion"), minimum)
+1
View File
@@ -102,6 +102,7 @@ def generate(args: argparse.Namespace) -> None:
"url": payload.installer_url, "length": str(length), "type": "application/octet-stream", "url": payload.installer_url, "length": str(length), "type": "application/octet-stream",
f"{{{SPARKLE}}}version": display_version, f"{{{SPARKLE}}}version": display_version,
f"{{{SPARKLE}}}shortVersionString": display_version, f"{{{SPARKLE}}}shortVersionString": display_version,
f"{{{SPARKLE}}}installerArguments": "/UPDATE",
f"{{{SPARKLE}}}os": f"windows-{payload.architecture}", f"{{{SPARKLE}}}edSignature": signature, f"{{{SPARKLE}}}os": f"windows-{payload.architecture}", f"{{{SPARKLE}}}edSignature": signature,
}) })
ET.indent(rss) ET.indent(rss)