From d90c0572f3b2f9b1eb0154d1588f1318eaa0b13e Mon Sep 17 00:00:00 2001 From: Marcin Rataj Date: Tue, 13 Oct 2020 22:47:46 +0200 Subject: [PATCH] fix: autoupdate only on supported platforms Closes #1671 License: MIT Signed-off-by: Marcin Rataj --- src/auto-updater/index.js | 15 ++++++++++++++- src/common/consts.js | 1 + 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/auto-updater/index.js b/src/auto-updater/index.js index cbdf8c808..1d61b30cf 100644 --- a/src/auto-updater/index.js +++ b/src/auto-updater/index.js @@ -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 @@ -137,6 +143,12 @@ module.exports = async function (ctx) { } return } + if (!isAutoUpdateSupported()) { + ctx.manualCheckForUpdates = () => { + shell.openExternal('https://github.com/ipfs-shipyard/ipfs-desktop/releases/latest') + } + return + } setup(ctx) @@ -144,6 +156,7 @@ module.exports = async function (ctx) { setInterval(checkForUpdates, 43200000) // every 12 hours + // enable on-demand check via About submenu ctx.manualCheckForUpdates = () => { feedback = true checkForUpdates() diff --git a/src/common/consts.js b/src/common/consts.js index 30b86d8a1..7dcad3a1e 100644 --- a/src/common/consts.js +++ b/src/common/consts.js @@ -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'],