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: autoupdate only on supported platforms #1698

Merged
merged 1 commit into from
Jan 25, 2021
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
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