Skip to content
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
11 changes: 11 additions & 0 deletions assets/build/nsis.nsh
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 1 addition & 0 deletions electron-builder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ nsis:
oneClick: false
warningsAsErrors: false
perMachine: false
allowElevation: true
allowToChangeInstallationDirectory: true

linux:
Expand Down
22 changes: 2 additions & 20 deletions src/auto-updater/index.js
Original file line number Diff line number Diff line change
@@ -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')
Expand All @@ -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()}`)
Expand Down Expand Up @@ -98,8 +82,6 @@ function setup (ctx) {
autoUpdater.on('update-downloaded', ({ version }) => {
logger.info('[updater] update downloaded')

installOnQuit = true

const doIt = () => {
setImmediate(() => {
quitAndInstall(ctx)
Expand Down