Skip to content

Commit 3981d39

Browse files
committed
Add preference for release channel
1 parent 0ecc79b commit 3981d39

File tree

3 files changed

+18
-9
lines changed

3 files changed

+18
-9
lines changed

src/vs/platform/update/common/update.config.contribution.ts

+13
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,19 @@ configurationRegistry.registerConfiguration({
4949
description: localize('updateMode', "Configure whether you receive automatic updates. Requires a restart after change to take effect."),
5050
deprecationMessage: localize('deprecated', "This setting is deprecated, please use '{0}' instead.", 'update.mode')
5151
},
52+
'update.positron.channel': {
53+
type: 'string',
54+
default: 'prereleases',
55+
enum: ['dailies', 'prereleases'],
56+
enumDescriptions: [
57+
localize('dailies', "The latest daily build. This is the most up-to-date version of Positron."),
58+
localize('prereleases', "Receive pre-release updates.")
59+
],
60+
scope: ConfigurationScope.APPLICATION,
61+
description: localize('update.positron.channel', "Configure the release stream for receiving updates. Requires a restart after change to take effect."),
62+
tags: ['usesOnlineServices'],
63+
included: !isWeb
64+
},
5265
'update.primaryLanguageReporting': {
5366
type: 'boolean',
5467
default: true,

src/vs/platform/update/electron-main/abstractUpdateService.ts

+1-8
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,6 @@ import { IUpdate } from '../common/update.js';
2222
import { hasUpdate } from '../electron-main/positronVersion.js';
2323
import { INativeHostMainService } from '../../native/electron-main/nativeHostMainService.js';
2424

25-
export const enum UpdateChannel {
26-
Releases = 'releases',
27-
Prereleases = 'prereleases',
28-
Dailies = 'dailies',
29-
Staging = 'staging',
30-
}
31-
3225
export function createUpdateURL(platform: string, channel: string, productService: IProductService): string {
3326
return `${productService.updateUrl}/${channel}/${platform}`;
3427
//--- End Positron ---
@@ -93,7 +86,7 @@ export abstract class AbstractUpdateService implements IUpdateService {
9386
*/
9487
protected async initialize(): Promise<void> {
9588
// --- Start Positron ---
96-
const updateChannel = process.env.POSITRON_UPDATE_CHANNEL ?? UpdateChannel.Prereleases;
89+
const updateChannel = process.env.POSITRON_UPDATE_CHANNEL ?? this.configurationService.getValue<string>('update.positron.channel');
9790
this.enableAutoUpdate = this.configurationService.getValue<boolean>('update.autoUpdate');
9891

9992
if (this.environmentMainService.disableUpdates) {

src/vs/workbench/contrib/relauncher/browser/relauncher.contribution.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import { ChatConfiguration } from '../../chat/common/constants.js';
2626

2727
interface IConfiguration extends IWindowsConfiguration {
2828
// --- Start Positron ---
29-
update?: { mode?: string; autoUpdate?: boolean };
29+
update?: { mode?: string; autoUpdate?: boolean; positron: { channel?: string } };
3030
// --- End Positron ---
3131
debug?: { console?: { wordWrap?: boolean } };
3232
editor?: { accessibilitySupport?: 'on' | 'off' | 'auto' };
@@ -55,6 +55,7 @@ export class SettingsChangeRelauncher extends Disposable implements IWorkbenchCo
5555
'security.restrictUNCAccess',
5656
// --- Start Positron ---
5757
'update.autoUpdate',
58+
'update.positron.channel',
5859
// --- End Positron ---
5960
'accessibility.verbosity.debug',
6061
ChatConfiguration.UnifiedChatView,
@@ -80,6 +81,7 @@ export class SettingsChangeRelauncher extends Disposable implements IWorkbenchCo
8081

8182
// --- Start Positron ---
8283
private readonly autoUpdate = new ChangeObserver('boolean');
84+
private readonly updateChannel = new ChangeObserver('string');
8385
// --- End Positron ---
8486

8587
constructor(
@@ -145,6 +147,7 @@ export class SettingsChangeRelauncher extends Disposable implements IWorkbenchCo
145147

146148
// --- Start Positron ---
147149
processChanged(this.autoUpdate.handleChange(config.update?.autoUpdate));
150+
processChanged(this.updateChannel.handleChange(config.update?.positron.channel));
148151
// --- End Positron ---
149152

150153
// On linux turning on accessibility support will also pass this flag to the chrome renderer, thus a restart is required

0 commit comments

Comments
 (0)