From 32aaf1b7c1f4a9c879ea9994a855135c4d1332d3 Mon Sep 17 00:00:00 2001 From: Marcin Rataj Date: Wed, 7 Oct 2020 22:20:42 +0200 Subject: [PATCH 1/2] Revert "fix: windows auto-update feature when selecting install for all users (#1556)" This reverts commit c26525fb4c6b03353882618dbe8a8ed980ed2b19. Context: https://github.com/ipfs-shipyard/ipfs-desktop/issues/1570#issuecomment-705081315 --- src/auto-updater/index.js | 22 ++-------------------- 1 file changed, 2 insertions(+), 20 deletions(-) diff --git a/src/auto-updater/index.js b/src/auto-updater/index.js index 2f2058d11..f0a3b6f2e 100644 --- a/src/auto-updater/index.js +++ b/src/auto-updater/index.js @@ -1,4 +1,4 @@ -const { app, shell } = require('electron') +const { shell } = require('electron') const { autoUpdater } = require('electron-updater') const i18n = require('i18next') const logger = require('../common/logger') @@ -7,26 +7,10 @@ const { showDialog } = require('../dialogs') const quitAndInstall = require('./quit-and-install') let feedback = false -let installOnQuit = false function setup (ctx) { autoUpdater.autoDownload = false - autoUpdater.autoInstallOnAppQuit = false - - /** - * this replaces the autoInstallOnAppQuit feature of autoUpdater, which causes the app - * to uninstall itself if it is installed for all users on a windows system. - * - * More info: https://github.com/ipfs-shipyard/ipfs-desktop/issues/1514 - * Should be removed once https://github.com/electron-userland/electron-builder/issues/4815 is resolved. - */ - app.once('before-quit', ev => { - if (installOnQuit) { - ev.preventDefault() - installOnQuit = false - autoUpdater.quitAndInstall(false, false) - } - }) + autoUpdater.autoInstallOnAppQuit = true autoUpdater.on('error', err => { logger.error(`[updater] ${err.toString()}`) @@ -98,8 +82,6 @@ function setup (ctx) { autoUpdater.on('update-downloaded', ({ version }) => { logger.info('[updater] update downloaded') - installOnQuit = true - const doIt = () => { setImmediate(() => { quitAndInstall(ctx) From 0bf120da0895722c050d32cec046fea26756359d Mon Sep 17 00:00:00 2001 From: Marcin Rataj Date: Thu, 8 Oct 2020 17:28:55 +0200 Subject: [PATCH 2/2] fix(windows): global update process should use UAC This implements fix described in: https://github.com/ipfs-shipyard/ipfs-desktop/pull/1679#issuecomment-705630973 License: MIT Signed-off-by: Marcin Rataj --- assets/build/nsis.nsh | 11 +++++++++++ electron-builder.yml | 1 + 2 files changed, 12 insertions(+) diff --git a/assets/build/nsis.nsh b/assets/build/nsis.nsh index 90ee1b3df..8fb2f57ed 100644 --- a/assets/build/nsis.nsh +++ b/assets/build/nsis.nsh @@ -38,3 +38,14 @@ ManifestDPIAware true DeleteRegKey SHELL_CONTEXT "Software\Classes\ipfs" DeleteRegKey SHELL_CONTEXT "Software\Classes\dweb" !macroend + +!macro customInit + # https://github.com/ipfs-shipyard/ipfs-desktop/pull/1679#issuecomment-705630973 + ${if} $installMode == "all" + ${IfNot} ${UAC_IsAdmin} + ShowWindow $HWNDPARENT ${SW_HIDE} + !insertmacro UAC_RunElevated + Quit + ${endif} + ${endif} +!macroend diff --git a/electron-builder.yml b/electron-builder.yml index a7cae33c7..89847919b 100644 --- a/electron-builder.yml +++ b/electron-builder.yml @@ -43,6 +43,7 @@ nsis: oneClick: false warningsAsErrors: false perMachine: false + allowElevation: true allowToChangeInstallationDirectory: true linux: