Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(nsis): If window service needs to run installer for update, the installer must have admin previlege. #6786 #6787

Merged
merged 1 commit into from
Apr 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/poor-windows-heal.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"app-builder-lib": patch
---

If window service needs to run installer for update, the installer must have admin previlege. Electron-updater detects whether elevating or not using isAdminRightsRequired in update-info.json. And this isAdminRightsRequired true option should be added to latest.yml using nsis's packElevateHelper option
3 changes: 2 additions & 1 deletion packages/app-builder-lib/src/targets/nsis/NsisTarget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ export class NsisTarget extends Target {
.join(", "),
}
const isPerMachine = options.perMachine === true

if (!this.isPortable) {
logFields.oneClick = oneClick
logFields.perMachine = isPerMachine
Expand Down Expand Up @@ -319,7 +320,7 @@ export class NsisTarget extends Target {
updateInfo = await createBlockmap(installerPath, this, packager, safeArtifactName)
}

if (updateInfo != null && isPerMachine && oneClick) {
if (updateInfo != null && isPerMachine && (oneClick || options.packElevateHelper)) {
updateInfo.isAdminRightsRequired = true
}

Expand Down
26 changes: 26 additions & 0 deletions test/snapshots/windows/assistedInstallerTest.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -128,3 +128,29 @@ Object {
],
}
`;

exports[`assisted, only perMachine and elevated 1`] = `
Object {
"win": Array [
Object {
"arch": "x64",
"file": "Test App ßW Setup 1.1.0.exe",
"safeArtifactName": "TestApp-Setup-1.1.0.exe",
"updateInfo": Object {
"isAdminRightsRequired": true,
"sha512": "@sha512",
"size": "@size",
},
},
Object {
"file": "Test App ßW Setup 1.1.0.exe.blockmap",
"safeArtifactName": "TestApp-Setup-1.1.0.exe.blockmap",
"updateInfo": Object {
"isAdminRightsRequired": true,
"sha512": "@sha512",
"size": "@size",
},
},
],
}
`;
14 changes: 14 additions & 0 deletions test/src/windows/assistedInstallerTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,20 @@ test.ifNotCiMac(
})
)

test.ifNotCiMac(
"assisted, only perMachine and elevated",
app({
targets: nsisTarget,
config: {
nsis: {
oneClick: false,
perMachine: true,
packElevateHelper: true
},
},
})
)

// test release notes also
test.ifAll.ifNotCiMac(
"allowToChangeInstallationDirectory",
Expand Down