Skip to content

Commit

Permalink
fix: autoupdate only on supported platforms
Browse files Browse the repository at this point in the history
Closes #1671

License: MIT
Signed-off-by: Marcin Rataj <lidel@lidel.org>
  • Loading branch information
lidel committed Oct 13, 2020
1 parent 42bab7c commit d90c057
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/auto-updater/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,13 @@ const logger = require('../common/logger')
const { notify } = require('../common/notify')
const { showDialog } = require('../dialogs')
const macQuitAndInstall = require('./macos-quit-and-install')
const { IS_MAC } = require('../common/consts')
const { IS_MAC, IS_WIN, IS_APPIMAGE } = require('../common/consts')

function isAutoUpdateSupported () {
// atm only macOS, windows and AppImage builds support autoupdate mechanism,
// everything else needs to be updated manually or via a third-party package manager
return IS_MAC || IS_WIN || IS_APPIMAGE
}

let feedback = false

Expand Down Expand Up @@ -137,13 +143,20 @@ module.exports = async function (ctx) {
}
return
}
if (!isAutoUpdateSupported()) {
ctx.manualCheckForUpdates = () => {
shell.openExternal('https://github.com/ipfs-shipyard/ipfs-desktop/releases/latest')
}
return
}

setup(ctx)

checkForUpdates() // background check

setInterval(checkForUpdates, 43200000) // every 12 hours

// enable on-demand check via About submenu
ctx.manualCheckForUpdates = () => {
feedback = true
checkForUpdates()
Expand Down
1 change: 1 addition & 0 deletions src/common/consts.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ const packageJson = require('../../package.json')
module.exports = Object.freeze({
IS_MAC: os.platform() === 'darwin',
IS_WIN: os.platform() === 'win32',
IS_APPIMAGE: typeof process.env.APPIMAGE !== 'undefined',
VERSION: packageJson.version,
ELECTRON_VERSION: packageJson.dependencies.electron,
GO_IPFS_VERSION: packageJson.dependencies['go-ipfs'],
Expand Down

0 comments on commit d90c057

Please sign in to comment.