Skip to content

Commit 221f249

Browse files
committed
Merge pull request #2525 from joaomoreno/fix2520
Understand update.channel set to none
2 parents 6e4933c + ccacb60 commit 221f249

File tree

2 files changed

+28
-6
lines changed

2 files changed

+28
-6
lines changed

src/vs/workbench/electron-browser/main.contribution.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,4 +63,20 @@ configurationRegistry.registerConfiguration({
6363
'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.")
6464
}
6565
}
66+
});
67+
68+
// Configuration: Update
69+
configurationRegistry.registerConfiguration({
70+
'id': 'update',
71+
'order': 10,
72+
'title': nls.localize('updateConfigurationTitle', "Update configuration"),
73+
'type': 'object',
74+
'properties': {
75+
'update.channel': {
76+
'type': 'string',
77+
'enum': ['none', 'default'],
78+
'default': 'default',
79+
'description': nls.localize('updateChannel', "Configure the update channel to receive updates from. Requires a restart after change.")
80+
}
81+
}
6682
});

src/vs/workbench/electron-main/update-manager.ts

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import events = require('events');
1111
import electron = require('electron');
1212
import platform = require('vs/base/common/platform');
1313
import env = require('vs/workbench/electron-main/env');
14-
import storage = require('vs/workbench/electron-main/storage');
1514
import settings = require('vs/workbench/electron-main/settings');
1615
import {Win32AutoUpdaterImpl} from 'vs/workbench/electron-main/win32/auto-updater.win32';
1716
import {manager as Lifecycle} from 'vs/workbench/electron-main/lifecycle';
@@ -45,8 +44,6 @@ interface IAutoUpdater extends NodeJS.EventEmitter {
4544

4645
export class UpdateManager extends events.EventEmitter {
4746

48-
private static DEFAULT_UPDATE_CHANNEL = 'stable';
49-
5047
private _state: State;
5148
private explicitState: ExplicitState;
5249
private _availableUpdate: IUpdate;
@@ -133,14 +130,14 @@ export class UpdateManager extends events.EventEmitter {
133130
return; // already initialized
134131
}
135132

136-
const quality = env.quality || 'stable';
137-
let feedUrl = UpdateManager.getUpdateFeedUrl(quality);
133+
const channel = UpdateManager.getUpdateChannel();
134+
const feedUrl = UpdateManager.getUpdateFeedUrl(channel);
138135

139136
if (!feedUrl) {
140137
return; // updates not available
141138
}
142139

143-
this._channel = quality;
140+
this._channel = channel;
144141
this._feedUrl = feedUrl;
145142

146143
this.raw.setFeedURL(feedUrl);
@@ -185,7 +182,16 @@ export class UpdateManager extends events.EventEmitter {
185182
this.emit('change');
186183
}
187184

185+
private static getUpdateChannel(): string {
186+
const channel = settings.manager.getValue('update.channel') || 'default';
187+
return channel === 'none' ? null : env.quality;
188+
}
189+
188190
private static getUpdateFeedUrl(channel: string): string {
191+
if (!channel) {
192+
return null;
193+
}
194+
189195
if (platform.isLinux) {
190196
return null;
191197
}

0 commit comments

Comments
 (0)