From ccacb6020844553c6e45ba91601b664f5f95128f Mon Sep 17 00:00:00 2001 From: Joao Moreno Date: Fri, 29 Jan 2016 10:35:34 +0100 Subject: [PATCH] understand update.channel set to none fixes #2520 --- .../electron-browser/main.contribution.ts | 16 ++++++++++++++++ .../workbench/electron-main/update-manager.ts | 18 ++++++++++++------ 2 files changed, 28 insertions(+), 6 deletions(-) diff --git a/src/vs/workbench/electron-browser/main.contribution.ts b/src/vs/workbench/electron-browser/main.contribution.ts index 74af7e60e04..a6bf003cbe9 100644 --- a/src/vs/workbench/electron-browser/main.contribution.ts +++ b/src/vs/workbench/electron-browser/main.contribution.ts @@ -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.") + } + } }); \ No newline at end of file diff --git a/src/vs/workbench/electron-main/update-manager.ts b/src/vs/workbench/electron-main/update-manager.ts index d01d4d4aea4..5f6bc39e106 100644 --- a/src/vs/workbench/electron-main/update-manager.ts +++ b/src/vs/workbench/electron-main/update-manager.ts @@ -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; } -- GitLab