Skip to content

Commit

Permalink
fix: ipfs-desktop config can disable autoUpdate (#2651)
Browse files Browse the repository at this point in the history
Co-authored-by: Marcin Rataj <[email protected]>
  • Loading branch information
SgtPooki and lidel authored Oct 10, 2023
1 parent 99bfd29 commit 5cb5fa3
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
9 changes: 8 additions & 1 deletion src/auto-updater/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,14 @@ const { showDialog } = require('../dialogs')
const { IS_MAC, IS_WIN, IS_APPIMAGE } = require('../common/consts')
const ipcMainEvents = require('../common/ipc-main-events')
const getCtx = require('../context')
const store = require('../common/store')
const CONFIG_KEYS = require('../common/config-keys')

function isAutoUpdateSupported () {
if (store.get(CONFIG_KEYS.DISABLE_AUTO_UPDATE, false)) {
logger.info('[updater] auto update explicitly disabled, not checking for updates automatically')
return false
}
// 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
Expand Down Expand Up @@ -160,6 +166,7 @@ function setup () {
}

async function checkForUpdates () {
logger.info('[updater] checking for updates')
ipcMain.emit(ipcMainEvents.UPDATING)
try {
await autoUpdater.checkForUpdates()
Expand All @@ -182,7 +189,7 @@ module.exports = async function () {
}
if (!isAutoUpdateSupported()) {
getCtx().setProp('manualCheckForUpdates', () => {
shell.openExternal('https://github.com/ipfs-shipyard/ipfs-desktop/releases/latest')
shell.openExternal('https://github.com/ipfs/ipfs-desktop/releases/latest')
})
return
}
Expand Down
1 change: 1 addition & 0 deletions src/common/config-keys.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
const CONFIG_KEYS = {
AUTO_LAUNCH: 'autoLaunch',
AUTO_GARBAGE_COLLECTOR: 'automaticGC',
DISABLE_AUTO_UPDATE: 'disableAutoUpdate',
SCREENSHOT_SHORTCUT: 'screenshotShortcut',
OPEN_WEBUI_LAUNCH: 'openWebUIAtLaunch',
MONOCHROME_TRAY_ICON: 'monochromeTrayIcon',
Expand Down
10 changes: 9 additions & 1 deletion src/types.ts
Original file line number Diff line number Diff line change
@@ -1 +1,9 @@
export type CONFIG_KEYS = 'AUTO_LAUNCH' | 'AUTO_GARBAGE_COLLECTOR' | 'SCREENSHOT_SHORTCUT' | 'OPEN_WEBUI_LAUNCH' | 'MONOCHROME_TRAY_ICON' | 'EXPERIMENT_PUBSUB' | 'EXPERIMENT_PUBSUB_NAMESYS'
export type CONFIG_KEYS = 'AUTO_LAUNCH'
| 'AUTO_GARBAGE_COLLECTOR'
| 'AUTO_UPDATE'
| 'SCREENSHOT_SHORTCUT'
| 'OPEN_WEBUI_LAUNCH'
| 'MONOCHROME_TRAY_ICON'
| 'EXPERIMENT_PUBSUB'
| 'EXPERIMENT_PUBSUB_NAMESYS'
| 'AUTO_UPDATE'

0 comments on commit 5cb5fa3

Please sign in to comment.