understand update.channel set to none

fixes #2520
This commit is contained in:
Joao Moreno 2016-01-29 10:35:34 +01:00
parent 043a4e7601
commit ccacb60208
2 changed files with 28 additions and 6 deletions

View file

@ -63,4 +63,20 @@ configurationRegistry.registerConfiguration({
'description': nls.localize('zoomLevel', "Adjust the zoom level of the window. The original size is 0 and each increment above or below represents zooming 20% larger or smaller.")
}
}
});
// Configuration: Update
configurationRegistry.registerConfiguration({
'id': 'update',
'order': 10,
'title': nls.localize('updateConfigurationTitle', "Update configuration"),
'type': 'object',
'properties': {
'update.channel': {
'type': 'string',
'enum': ['none', 'default'],
'default': 'default',
'description': nls.localize('updateChannel', "Configure the update channel to receive updates from. Requires a restart after change.")
}
}
});

View file

@ -11,7 +11,6 @@ import events = require('events');
import electron = require('electron');
import platform = require('vs/base/common/platform');
import env = require('vs/workbench/electron-main/env');
import storage = require('vs/workbench/electron-main/storage');
import settings = require('vs/workbench/electron-main/settings');
import {Win32AutoUpdaterImpl} from 'vs/workbench/electron-main/win32/auto-updater.win32';
import {manager as Lifecycle} from 'vs/workbench/electron-main/lifecycle';
@ -45,8 +44,6 @@ interface IAutoUpdater extends NodeJS.EventEmitter {
export class UpdateManager extends events.EventEmitter {
private static DEFAULT_UPDATE_CHANNEL = 'stable';
private _state: State;
private explicitState: ExplicitState;
private _availableUpdate: IUpdate;
@ -133,14 +130,14 @@ export class UpdateManager extends events.EventEmitter {
return; // already initialized
}
const quality = env.quality || 'stable';
let feedUrl = UpdateManager.getUpdateFeedUrl(quality);
const channel = UpdateManager.getUpdateChannel();
const feedUrl = UpdateManager.getUpdateFeedUrl(channel);
if (!feedUrl) {
return; // updates not available
}
this._channel = quality;
this._channel = channel;
this._feedUrl = feedUrl;
this.raw.setFeedURL(feedUrl);
@ -185,7 +182,16 @@ export class UpdateManager extends events.EventEmitter {
this.emit('change');
}
private static getUpdateChannel(): string {
const channel = settings.manager.getValue('update.channel') || 'default';
return channel === 'none' ? null : env.quality;
}
private static getUpdateFeedUrl(channel: string): string {
if (!channel) {
return null;
}
if (platform.isLinux) {
return null;
}