Repository navigation
fix(windows): 应用内更新时沿用已注册的安装范围 - #2486
Conversation
There was a problem hiding this comment.
AIUO CodePilot · Preliminary review
Diff-only preliminary review of the Windows NSIS install-scope reuse change. The assisted-installer macro and the NSIS regression harness look internally consistent with the stated single-scope update behavior. One defect is evidenced in the new test harness: `!define isUpdated '$updated == "1"'` makes `${isUpdated}` expand to an NSIS `If` comparison string rather than an existing `isUpdated` definition, so the test cannot faithfully exercise the macro the way the assisted installer defines it and may silently test a tautology or fail to compile as intended.
-
medium
apps/desktop/test/nsis\-update\-scope\.nsi:18: The test redefines `${isUpdated}` as the string `$updated == "1"`, which is not the assisted installer's existing `isUpdated` definition used by `installer.nsh`. As written, `${If} ${isUpdated}` expands to `${If} $updated == "1"`, so the test substitutes its own comparison for the real macro contract instead of providing the boolean condition the production hook expects. This can make the regression suite pass without exercising the actual `isUpdated` semantics and masks whether the hook works under electron-builder's real definitions.
Evidence:\!define isUpdated '$updated == "1"'
Head: 7d0f4ab
Base: 48a6558
CI: no-statuses; mergeable: true.
Validation: code/tests NOT EXECUTED. Diff-only preliminary analysis; not approval. Human review and repository gates remain required.
修复
Closes #2459
Windows 用户点击「退出并安装」后,如果只有一套已注册的安装,NSIS 直接沿用其范围和目录。所有用户安装继续走 electron-builder 自带的 UAC 提权流程。首次安装、手动重装和两种范围并存时仍显示范围选择页,显式传入的范围参数仍优先。
改动位于 assisted installer 的
customInstallMode钩子。安装器在初始化时已经读取 HKLM 和 HKCU,因此可以直接使用检测结果。验证
--updated --force-run启动安装包。基线版本在只有 HKLM 安装时仍弹出选择页。修复后,仅有 HKLM 或仅有 HKCU 安装时直接进入安装进度页。两者并存、两者皆无,以及手动重装时均显示选择页。pnpm docs:check和pnpm check:pr-base通过。验证基于
48a65582678e上的提交7d0f4ab62837。原生 Windows 上的非管理员 UAC 提示和完整桌面应用的下载、重启流程尚未实测。