From 26ee36458d6ca402e73338da5cdafd2a137cc1a9 Mon Sep 17 00:00:00 2001 From: Eugene Pankov Date: Wed, 5 Feb 2020 14:16:15 +0300 Subject: [PATCH] don't even think about updating if not enabled (fixes #2088) --- terminus-core/src/services/updater.service.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/terminus-core/src/services/updater.service.ts b/terminus-core/src/services/updater.service.ts index f0781f07..ab6cc149 100644 --- a/terminus-core/src/services/updater.service.ts +++ b/terminus-core/src/services/updater.service.ts @@ -23,7 +23,7 @@ export class UpdaterService { constructor ( log: LogService, private electron: ElectronService, - config: ConfigService, + private config: ConfigService, ) { this.logger = log.create('updater') @@ -48,9 +48,8 @@ export class UpdaterService { this.autoUpdater.once('update-downloaded', () => resolve(true)) }) - this.logger.debug('Checking for updates') - - if (this.electronUpdaterAvailable && !process.env.TERMINUS_DEV) { + if (config.store.enableAutomaticUpdates && this.electronUpdaterAvailable && !process.env.TERMINUS_DEV) { + this.logger.debug('Checking for updates') try { this.autoUpdater.checkForUpdates() } catch (e) { @@ -61,6 +60,9 @@ export class UpdaterService { } async check (): Promise { + if (!this.config.store.enableAutomaticUpdates) { + return false + } if (!this.electronUpdaterAvailable) { this.logger.debug('Checking for updates through fallback method.') const response = await axios.get(UPDATES_URL)