diff --git a/src/common/config/buildConfig.js b/src/common/config/buildConfig.js index 9962508c..a8980b59 100644 --- a/src/common/config/buildConfig.js +++ b/src/common/config/buildConfig.js @@ -24,6 +24,7 @@ const buildConfig = { ], helpLink: 'https://about.mattermost.com/default-desktop-app-documentation/', enableServerManagement: true, + enableAutoUpdater: true, }; export default buildConfig; diff --git a/src/main.js b/src/main.js index 35b55512..d943b2c8 100644 --- a/src/main.js +++ b/src/main.js @@ -26,6 +26,7 @@ import {protocols} from '../electron-builder.json'; import CriticalErrorHandler from './main/CriticalErrorHandler'; import {upgradeAutoLaunch} from './main/autoLaunch'; +import buildConfig from './common/config/buildConfig'; const criticalErrorHandler = new CriticalErrorHandler(); @@ -636,18 +637,20 @@ app.on('ready', () => { permissionManager = new PermissionManager(permissionFile, trustedURLs); session.defaultSession.setPermissionRequestHandler(permissionRequestHandler(mainWindow, permissionManager)); - const updaterConfig = autoUpdater.loadConfig(path.resolve(app.getAppPath(), '../app-updater-config.json')); - autoUpdater.initialize(appState, mainWindow, updaterConfig.isNotifyOnly()); - ipcMain.on('check-for-updates', autoUpdater.checkForUpdates); - mainWindow.once('show', () => { - if (autoUpdater.shouldCheckForUpdatesOnStart(appState.updateCheckedDate)) { - ipcMain.emit('check-for-updates'); - } else { - setTimeout(() => { + if (buildConfig.enableAutoUpdater) { + const updaterConfig = autoUpdater.loadConfig(path.resolve(app.getAppPath(), '../app-updater-config.json')); + autoUpdater.initialize(appState, mainWindow, updaterConfig.isNotifyOnly()); + ipcMain.on('check-for-updates', autoUpdater.checkForUpdates); + mainWindow.once('show', () => { + if (autoUpdater.shouldCheckForUpdatesOnStart(appState.updateCheckedDate)) { ipcMain.emit('check-for-updates'); - }, autoUpdater.INTERVAL_48_HOURS_IN_MS); - } - }); + } else { + setTimeout(() => { + ipcMain.emit('check-for-updates'); + }, autoUpdater.INTERVAL_48_HOURS_IN_MS); + } + }); + } // Open the DevTools. // mainWindow.openDevTools(); diff --git a/src/main/menus/app.js b/src/main/menus/app.js index 296038e3..a665e762 100644 --- a/src/main/menus/app.js +++ b/src/main/menus/app.js @@ -230,12 +230,15 @@ function createTemplate(mainWindow, config, isDev) { submenu.push({ label: `Version ${app.getVersion()}`, enabled: false, - }, { - label: 'Check for Updates...', - click() { - ipcMain.emit('check-for-updates', true); - }, }); + if (buildConfig.enableAutoUpdater) { + submenu.push({ + label: 'Check for Updates...', + click() { + ipcMain.emit('check-for-updates', true); + }, + }); + } template.push({label: '&Help', submenu}); return template; }