diff --git a/src/vs/platform/update/common/update.config.contribution.ts b/src/vs/platform/update/common/update.config.contribution.ts index 9412f48aee6..740e04bde95 100644 --- a/src/vs/platform/update/common/update.config.contribution.ts +++ b/src/vs/platform/update/common/update.config.contribution.ts @@ -49,6 +49,19 @@ configurationRegistry.registerConfiguration({ description: localize('updateMode', "Configure whether you receive automatic updates. Requires a restart after change to take effect."), deprecationMessage: localize('deprecated', "This setting is deprecated, please use '{0}' instead.", 'update.mode') }, + 'update.positron.channel': { + type: 'string', + default: 'prereleases', + enum: ['dailies', 'prereleases'], + enumDescriptions: [ + localize('dailies', "The latest daily build. This is the most up-to-date version of Positron."), + localize('prereleases', "Receive pre-release updates.") + ], + scope: ConfigurationScope.APPLICATION, + description: localize('update.positron.channel', "Configure the release stream for receiving updates. Requires a restart after change to take effect."), + tags: ['usesOnlineServices'], + included: !isWeb + }, 'update.primaryLanguageReporting': { type: 'boolean', default: true, diff --git a/src/vs/platform/update/electron-main/abstractUpdateService.ts b/src/vs/platform/update/electron-main/abstractUpdateService.ts index 205a88e7768..d798a7981d0 100644 --- a/src/vs/platform/update/electron-main/abstractUpdateService.ts +++ b/src/vs/platform/update/electron-main/abstractUpdateService.ts @@ -22,13 +22,6 @@ import { IUpdate } from '../common/update.js'; import { hasUpdate } from '../electron-main/positronVersion.js'; import { INativeHostMainService } from '../../native/electron-main/nativeHostMainService.js'; -export const enum UpdateChannel { - Releases = 'releases', - Prereleases = 'prereleases', - Dailies = 'dailies', - Staging = 'staging', -} - export function createUpdateURL(platform: string, channel: string, productService: IProductService): string { return `${productService.updateUrl}/${channel}/${platform}`; //--- End Positron --- @@ -93,7 +86,10 @@ export abstract class AbstractUpdateService implements IUpdateService { */ protected async initialize(): Promise { // --- Start Positron --- - const updateChannel = process.env.POSITRON_UPDATE_CHANNEL ?? UpdateChannel.Prereleases; + const updateChannel = process.env.POSITRON_UPDATE_CHANNEL ?? this.configurationService.getValue('update.positron.channel'); + if (process.env.POSITRON_UPDATE_CHANNEL) { + this.logService.info('update#ctor - using update channel from environment variable', process.env.POSITRON_UPDATE_CHANNEL); + } this.enableAutoUpdate = this.configurationService.getValue('update.autoUpdate'); if (this.environmentMainService.disableUpdates) { diff --git a/src/vs/workbench/contrib/relauncher/browser/relauncher.contribution.ts b/src/vs/workbench/contrib/relauncher/browser/relauncher.contribution.ts index 5568cf4abfd..80ded3d87b3 100644 --- a/src/vs/workbench/contrib/relauncher/browser/relauncher.contribution.ts +++ b/src/vs/workbench/contrib/relauncher/browser/relauncher.contribution.ts @@ -26,7 +26,7 @@ import { ChatConfiguration } from '../../chat/common/constants.js'; interface IConfiguration extends IWindowsConfiguration { // --- Start Positron --- - update?: { mode?: string; autoUpdate?: boolean }; + update?: { mode?: string; autoUpdate?: boolean; positron: { channel?: string } }; // --- End Positron --- debug?: { console?: { wordWrap?: boolean } }; editor?: { accessibilitySupport?: 'on' | 'off' | 'auto' }; @@ -55,6 +55,7 @@ export class SettingsChangeRelauncher extends Disposable implements IWorkbenchCo 'security.restrictUNCAccess', // --- Start Positron --- 'update.autoUpdate', + 'update.positron.channel', // --- End Positron --- 'accessibility.verbosity.debug', ChatConfiguration.UnifiedChatView, @@ -80,6 +81,7 @@ export class SettingsChangeRelauncher extends Disposable implements IWorkbenchCo // --- Start Positron --- private readonly autoUpdate = new ChangeObserver('boolean'); + private readonly updateChannel = new ChangeObserver('string'); // --- End Positron --- constructor( @@ -145,6 +147,7 @@ export class SettingsChangeRelauncher extends Disposable implements IWorkbenchCo // --- Start Positron --- processChanged(this.autoUpdate.handleChange(config.update?.autoUpdate)); + processChanged(this.updateChannel.handleChange(config.update?.positron.channel)); // --- End Positron --- // On linux turning on accessibility support will also pass this flag to the chrome renderer, thus a restart is required