fix #78: command-line option to disable updater

This commit is contained in:
Antelle 2016-02-06 14:40:40 +03:00
parent 08c61056b5
commit 8119c75412
4 changed files with 14 additions and 5 deletions

View File

@ -97,6 +97,9 @@ if (window.process && window.process.versions && window.process.versions.electro
},
canMinimize: function() {
return process.platform === 'win32';
},
updaterEnabled: function() {
return this.req('remote').process.argv.indexOf('--disable-updater') === -1;
}
};
Backbone.on('launcher-exit-request', function() {

View File

@ -18,9 +18,10 @@ var Updater = {
UpdateCheckFiles: ['index.html', 'app.js'],
nextCheckTimeout: null,
updateCheckDate: new Date(0),
enabled: Launcher && Launcher.updaterEnabled(),
getAutoUpdateType: function() {
if (!Launcher) {
if (!this.enabled) {
return false;
}
var autoUpdate = AppSettingsModel.instance.get('autoUpdate');
@ -68,7 +69,7 @@ var Updater = {
if (!startedByUser) {
return;
}
if (!Launcher || this.updateInProgress()) {
if (!this.enabled || this.updateInProgress()) {
return;
}
UpdateModel.instance.set('status', 'checking');
@ -160,7 +161,11 @@ var Updater = {
update: function(startedByUser, successCallback) {
var ver = UpdateModel.instance.get('lastVersion');
if (!Launcher || ver === RuntimeInfo.version) {
if (!this.enabled) {
logger.info('Updater is disabled');
return;
}
if (ver === RuntimeInfo.version) {
logger.info('You are using the latest version');
return;
}

View File

@ -57,7 +57,7 @@ var SettingsGeneralView = Backbone.View.extend({
idleMinutes: AppSettingsModel.instance.get('idleMinutes'),
minimizeOnClose: AppSettingsModel.instance.get('minimizeOnClose'),
devTools: Launcher && Launcher.devTools,
canAutoUpdate: !!Launcher,
canAutoUpdate: Updater.enabled,
canMinimize: Launcher && Launcher.canMinimize(),
lockOnMinimize: Launcher && AppSettingsModel.instance.get('lockOnMinimize'),
tableView: AppSettingsModel.instance.get('tableView'),
@ -66,7 +66,7 @@ var SettingsGeneralView = Backbone.View.extend({
updateInProgress: Updater.updateInProgress(),
updateInfo: this.getUpdateInfo(),
updateWaitingReload: updateReady && !Launcher,
showUpdateBlock: Launcher && !updateManual,
showUpdateBlock: Updater.enabled && !updateManual,
updateReady: updateReady,
updateFound: updateFound,
updateManual: updateManual,

View File

@ -4,6 +4,7 @@ Release notes
Performance, stability and quality improvements
`+` track changes in local files
`+` mobile layout made more convenient
`+` command-line option to disable updater
`-` #80: prevent data loss on group move
`-` issues with clipboard clear fixed