From 4593cf38b3f16fd39351bb490241ea02f04120dc Mon Sep 17 00:00:00 2001 From: Yuya Ochiai Date: Tue, 20 Nov 2018 00:20:52 +0900 Subject: [PATCH] Set notifyOnly:true on Windows builds --- package.json | 3 +-- resources/windows/app-updater-config.json | 3 --- src/main.js | 2 +- src/main/autoUpdater.js | 16 +++++++--------- 4 files changed, 9 insertions(+), 15 deletions(-) delete mode 100644 resources/windows/app-updater-config.json diff --git a/package.json b/package.json index 0315afb6..90913b54 100644 --- a/package.json +++ b/package.json @@ -28,10 +28,9 @@ "test": "npm-run-all test:* lint:*", "test:app": "cross-env NODE_ENV=production npm run build && mocha -r babel-register --reporter mocha-circleci-reporter --recursive test/specs", "package:all": "cross-env NODE_ENV=production npm-run-all check-build-config package:windows package:mac package:linux", - "package:windows": "cross-env NODE_ENV=production npm-run-all check-build-config build && build --win --x64 --ia32 --publish=never && npm run manipulate-windows-zip", + "package:windows": "cross-env NODE_ENV=production npm-run-all check-build-config build && build --win --x64 --ia32 --publish=never", "package:mac": "cross-env NODE_ENV=production npm-run-all check-build-config build && build --mac --publish=never", "package:linux": "cross-env NODE_ENV=production npm-run-all check-build-config build && build --linux --x64 --ia32 --publish=never", - "manipulate-windows-zip": "node scripts/manipulate_windows_zip.js", "lint:js": "eslint --ignore-path .gitignore --ignore-pattern node_modules --ext .js --ext .jsx .", "fix:js": "eslint --ignore-path .gitignore --ignore-pattern node_modules --quiet --ext .js --ext .jsx . --fix", "check-build-config": "node -r babel-register scripts/check_build_config.js" diff --git a/resources/windows/app-updater-config.json b/resources/windows/app-updater-config.json deleted file mode 100644 index 86f11aa6..00000000 --- a/resources/windows/app-updater-config.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "notifyOnly": true -} diff --git a/src/main.js b/src/main.js index 97f16d34..3da2b200 100644 --- a/src/main.js +++ b/src/main.js @@ -653,7 +653,7 @@ app.on('ready', () => { session.defaultSession.setPermissionRequestHandler(permissionRequestHandler(mainWindow, permissionManager)); if (buildConfig.enableAutoUpdater) { - const updaterConfig = autoUpdater.loadConfig(path.resolve(app.getAppPath(), '../app-updater-config.json')); + const updaterConfig = autoUpdater.loadConfig(); autoUpdater.initialize(appState, mainWindow, updaterConfig.isNotifyOnly()); ipcMain.on('check-for-updates', autoUpdater.checkForUpdates); mainWindow.once('show', () => { diff --git a/src/main/autoUpdater.js b/src/main/autoUpdater.js index 3bd9dba5..9f68030e 100644 --- a/src/main/autoUpdater.js +++ b/src/main/autoUpdater.js @@ -2,7 +2,6 @@ // Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. -import fs from 'fs'; import path from 'path'; import {app, BrowserWindow, dialog, ipcMain, shell} from 'electron'; @@ -167,15 +166,14 @@ function checkForUpdates(isManual = false) { } class AutoUpdaterConfig { - constructor(file) { - try { - this.data = JSON.parse(fs.readFileSync(file)); - } catch (err) { - this.data = {}; - } + constructor() { + this.data = {}; } isNotifyOnly() { + if (process.platform === 'win32') { + return true; + } if (this.data.notifyOnly === true) { return true; } @@ -183,8 +181,8 @@ class AutoUpdaterConfig { } } -function loadConfig(file) { - return new AutoUpdaterConfig(file); +function loadConfig() { + return new AutoUpdaterConfig(); } export default {