diff --git a/patches/build-version.patch b/patches/build-version.patch index 3884db6..a7b6444 100644 --- a/patches/build-version.patch +++ b/patches/build-version.patch @@ -1,212 +1,133 @@ diff --git a/build/gulpfile.reh.js b/build/gulpfile.reh.js -index 2abc3f3..a3cbf2d 100644 +index a07c552..e5546e0 100644 --- a/build/gulpfile.reh.js +++ b/build/gulpfile.reh.js -@@ -246,8 +246,9 @@ function packageTask(type, platform, arch, sourceFolderName, destinationFolderNa - } - +@@ -250,4 +250,5 @@ function packageTask(type, platform, arch, sourceFolderName, destinationFolderNa const name = product.nameShort; + const release = packageJson.release; const packageJsonStream = gulp.src(['remote/package.json'], { base: 'remote' }) - .pipe(json({ name, version, dependencies: undefined, optionalDependencies: undefined })); + .pipe(json({ name, version, release, dependencies: undefined, optionalDependencies: undefined })); - const date = new Date().toISOString(); - diff --git a/build/gulpfile.vscode.js b/build/gulpfile.vscode.js -index 28f8e52..f17962d 100644 +index 2c075a3..ff98402 100644 --- a/build/gulpfile.vscode.js +++ b/build/gulpfile.vscode.js -@@ -187,7 +187,7 @@ function packageTask(platform, arch, sourceFolderName, destinationFolderName, op - const sources = es.merge(src, extensions) - .pipe(filter(['**', '!**/*.js.map'], { dot: true })); +@@ -191,3 +191,3 @@ function packageTask(platform, arch, sourceFolderName, destinationFolderName, op - let version = packageJson.version; + let version = packageJson.version const quality = product.quality; - - if (quality && quality !== 'stable') { -@@ -195,7 +195,8 @@ function packageTask(platform, arch, sourceFolderName, destinationFolderName, op - } - +@@ -199,3 +199,4 @@ function packageTask(platform, arch, sourceFolderName, destinationFolderName, op const name = product.nameShort; - const packageJsonUpdates = { name, version }; + const release = packageJson.release; + const packageJsonUpdates = { name, version, release }; - // for linux url handling - if (platform === 'linux') { diff --git a/build/gulpfile.vscode.linux.js b/build/gulpfile.vscode.linux.js -index 489d9cc..e9f00f3 100644 +index 4a25ca5..ca33d2e 100644 --- a/build/gulpfile.vscode.linux.js +++ b/build/gulpfile.vscode.linux.js -@@ -83,7 +83,7 @@ function prepareDebPackage(arch) { - const dependencies = debianDependenciesGenerator.getDependencies(binaryDir, product.applicationName, debArch, sysroot); - gulp.src('resources/linux/debian/control.template', { base: '.' }) +@@ -24,4 +24,2 @@ const commit = util.getVersion(root); + +-const linuxPackageRevision = Math.floor(new Date().getTime() / 1000); +- + /** +@@ -87,3 +85,3 @@ function prepareDebPackage(arch) { .pipe(replace('@@NAME@@', product.applicationName)) - .pipe(replace('@@VERSION@@', packageJson.version + '-' + linuxPackageRevision)) + .pipe(replace('@@VERSION@@', `${packageJson.version}.${packageJson.release}`)) .pipe(replace('@@ARCHITECTURE@@', debArch)) - .pipe(replace('@@DEPENDS@@', dependencies.join(', '))) - .pipe(replace('@@RECOMMENDS@@', debianRecommendedDependencies.join(', '))) -@@ -188,8 +188,7 @@ function prepareRpmPackage(arch) { - .pipe(replace('@@NAME@@', product.applicationName)) - .pipe(replace('@@NAME_LONG@@', product.nameLong)) +@@ -192,4 +190,3 @@ function prepareRpmPackage(arch) { .pipe(replace('@@ICON@@', product.linuxIconName)) - .pipe(replace('@@VERSION@@', packageJson.version)) - .pipe(replace('@@RELEASE@@', linuxPackageRevision)) + .pipe(replace('@@VERSION@@', `${packageJson.version}.${packageJson.release}`)) .pipe(replace('@@ARCHITECTURE@@', rpmArch)) - .pipe(replace('@@LICENSE@@', product.licenseName)) - .pipe(replace('@@QUALITY@@', product.quality || '@@QUALITY@@')) -@@ -262,7 +261,7 @@ function prepareSnapPackage(arch) { - - const snapcraft = gulp.src('resources/linux/snap/snapcraft.yaml', { base: '.' }) +@@ -266,3 +263,3 @@ function prepareSnapPackage(arch) { .pipe(replace('@@NAME@@', product.applicationName)) - .pipe(replace('@@VERSION@@', commit.substr(0, 8))) + .pipe(replace('@@VERSION@@', `${packageJson.version}.${packageJson.release}`)) // Possible run-on values https://snapcraft.io/docs/architectures - .pipe(replace('@@ARCHITECTURE@@', arch === 'x64' ? 'amd64' : arch)) - .pipe(rename('snap/snapcraft.yaml')); diff --git a/build/gulpfile.vscode.win32.js b/build/gulpfile.vscode.win32.js index 81ba509..43f5377 100644 --- a/build/gulpfile.vscode.win32.js +++ b/build/gulpfile.vscode.win32.js -@@ -91,8 +91,8 @@ function buildWin32Setup(arch, target) { - NameLong: product.nameLong, - NameShort: product.nameShort, +@@ -93,4 +93,4 @@ function buildWin32Setup(arch, target) { DirName: product.win32DirName, - Version: pkg.version, - RawVersion: pkg.version.replace(/-\w+$/, ''), + Version: `${pkg.version}.${pkg.release}`, + RawVersion: `${pkg.version.replace(/-\w+$/, '')}.${pkg.release}`, NameVersion: product.win32NameVersion + (target === 'user' ? ' (User)' : ''), - ExeBasename: product.nameShort, - RegValueName: product.win32RegValueName, diff --git a/resources/linux/rpm/code.spec.template b/resources/linux/rpm/code.spec.template -index 00ddb6f..814c964 100644 +index 61659d2..5cafa06 100644 --- a/resources/linux/rpm/code.spec.template +++ b/resources/linux/rpm/code.spec.template -@@ -1,6 +1,6 @@ - Name: @@NAME@@ +@@ -2,3 +2,3 @@ Name: @@NAME@@ Version: @@VERSION@@ -Release: @@RELEASE@@.el7 +Release: el7 Summary: Code editing. Redefined. - Group: Development/Tools - Vendor: Microsoft Corporation diff --git a/src/vs/base/common/product.ts b/src/vs/base/common/product.ts index 1ae8079..0dad6ac 100644 --- a/src/vs/base/common/product.ts +++ b/src/vs/base/common/product.ts -@@ -32,6 +32,7 @@ export type ExtensionVirtualWorkspaceSupport = { - - export interface IProductConfiguration { +@@ -34,2 +34,3 @@ export interface IProductConfiguration { readonly version: string; + readonly release: string; readonly date?: string; - readonly quality?: string; - readonly commit?: string; -diff --git a/src/vs/code/electron-sandbox/issue/issueReporterMain.ts b/src/vs/code/electron-sandbox/issue/issueReporterMain.ts -index 046cb39..3271b6c 100644 ---- a/src/vs/code/electron-sandbox/issue/issueReporterMain.ts -+++ b/src/vs/code/electron-sandbox/issue/issueReporterMain.ts -@@ -75,7 +75,7 @@ export class IssueReporter extends Disposable { - this.issueReporterModel = new IssueReporterModel({ - issueType: configuration.data.issueType || IssueType.Bug, - versionInfo: { -- vscodeVersion: `${configuration.product.nameShort} ${!!configuration.product.darwinUniversalAssetId ? `${configuration.product.version} (Universal)` : configuration.product.version} (${configuration.product.commit || 'Commit unknown'}, ${configuration.product.date || 'Date unknown'})`, -+ vscodeVersion: `${configuration.product.nameShort} ${!!configuration.product.darwinUniversalAssetId ? `${configuration.product.version} (Universal)` : configuration.product.version} ${configuration.product.release || 'Release unknown'} (${configuration.product.commit || 'Commit unknown'}, ${configuration.product.date || 'Date unknown'})`, - os: `${this.configuration.os.type} ${this.configuration.os.arch} ${this.configuration.os.release}${isLinuxSnap ? ' snap' : ''}` - }, - extensionsDisabled: !!configuration.disableExtensions, -diff --git a/src/vs/code/electron-sandbox/issue/issueReporterModel.ts b/src/vs/code/electron-sandbox/issue/issueReporterModel.ts -index b0cc736..035c5cb 100644 ---- a/src/vs/code/electron-sandbox/issue/issueReporterModel.ts -+++ b/src/vs/code/electron-sandbox/issue/issueReporterModel.ts -@@ -74,7 +74,7 @@ Type: ${this.getIssueTypeTitle()} - - ${this._data.issueDescription} - ${this.getExtensionVersion()} --VS Code version: ${this._data.versionInfo && this._data.versionInfo.vscodeVersion} -+VSCodium version: ${this._data.versionInfo && this._data.versionInfo.vscodeVersion} - OS version: ${this._data.versionInfo && this._data.versionInfo.os} - Modes:${modes.length ? ' ' + modes.join(', ') : ''} - ${this.getRemoteOSes()} diff --git a/src/vs/platform/diagnostics/node/diagnosticsService.ts b/src/vs/platform/diagnostics/node/diagnosticsService.ts index e1c60a3..a12d52c 100644 --- a/src/vs/platform/diagnostics/node/diagnosticsService.ts +++ b/src/vs/platform/diagnostics/node/diagnosticsService.ts -@@ -237,7 +237,7 @@ export class DiagnosticsService implements IDiagnosticsService { - - private formatEnvironment(info: IMainProcessInfo): string { +@@ -239,3 +239,3 @@ export class DiagnosticsService implements IDiagnosticsService { const output: string[] = []; - output.push(`Version: ${this.productService.nameShort} ${this.productService.version} (${this.productService.commit || 'Commit unknown'}, ${this.productService.date || 'Date unknown'})`); + output.push(`Version: ${this.productService.nameShort} ${this.productService.version} ${this.productService.release || 'Release unknown'} (${this.productService.commit || 'Commit unknown'}, ${this.productService.date || 'Date unknown'})`); output.push(`OS Version: ${osLib.type()} ${osLib.arch()} ${osLib.release()}`); - const cpus = osLib.cpus(); - if (cpus && cpus.length > 0) { diff --git a/src/vs/platform/product/common/product.ts b/src/vs/platform/product/common/product.ts index 7e63a16..74d1f26 100644 --- a/src/vs/platform/product/common/product.ts +++ b/src/vs/platform/product/common/product.ts -@@ -32,7 +32,7 @@ else if (typeof require?.__$__nodeRequire === 'function') { - const rootPath = dirname(FileAccess.asFileUri('', require)); - +@@ -34,3 +34,3 @@ else if (typeof require?.__$__nodeRequire === 'function') { product = require.__$__nodeRequire(joinPath(rootPath, 'product.json').fsPath); - const pkg = require.__$__nodeRequire(joinPath(rootPath, 'package.json').fsPath) as { version: string }; + const pkg = require.__$__nodeRequire(joinPath(rootPath, 'package.json').fsPath) as { version: string, release: string }; - // Running out of sources - if (env['VSCODE_DEV']) { -@@ -45,7 +45,8 @@ else if (typeof require?.__$__nodeRequire === 'function') { - } - +@@ -47,3 +47,4 @@ else if (typeof require?.__$__nodeRequire === 'function') { Object.assign(product, { - version: pkg.version + version: pkg.version, + release: pkg.release }); - } - diff --git a/src/vs/workbench/browser/parts/dialogs/dialogHandler.ts b/src/vs/workbench/browser/parts/dialogs/dialogHandler.ts -index ec4ff95..f721052 100644 +index ec4ff95..36e882f 100644 --- a/src/vs/workbench/browser/parts/dialogs/dialogHandler.ts +++ b/src/vs/workbench/browser/parts/dialogs/dialogHandler.ts -@@ -144,7 +144,8 @@ export class BrowserDialogHandler implements IDialogHandler { - async about(): Promise { - const detailString = (useAgo: boolean): string => { +@@ -146,4 +146,5 @@ export class BrowserDialogHandler implements IDialogHandler { return localize('aboutDetail', - "Version: {0}\nCommit: {1}\nDate: {2}\nBrowser: {3}", + "Version: {0}\nRelease: {1}\nCommit: {2}\nDate: {3}\nBrowser: {4}", -+ this.productService.release || 'Unknown', this.productService.version || 'Unknown', ++ this.productService.release || 'Unknown', this.productService.commit || 'Unknown', - this.productService.date ? `${this.productService.date}${useAgo ? ' (' + fromNow(new Date(this.productService.date), true) + ')' : ''}` : 'Unknown', diff --git a/src/vs/workbench/contrib/issue/browser/issueService.ts b/src/vs/workbench/contrib/issue/browser/issueService.ts index dc7430b..23def01 100644 --- a/src/vs/workbench/contrib/issue/browser/issueService.ts +++ b/src/vs/workbench/contrib/issue/browser/issueService.ts -@@ -65,6 +65,7 @@ export class WebIssueService implements IWorkbenchIssueService { - return `ADD ISSUE DESCRIPTION HERE - +@@ -67,2 +67,3 @@ export class WebIssueService implements IWorkbenchIssueService { Version: ${this.productService.version} +Release: ${this.productService.release ?? 'unknown'} Commit: ${this.productService.commit ?? 'unknown'} - User Agent: ${userAgent ?? 'unknown'} - Embedder: ${this.productService.embedderIdentifier ?? 'unknown'} diff --git a/src/vs/workbench/electron-sandbox/parts/dialogs/dialogHandler.ts b/src/vs/workbench/electron-sandbox/parts/dialogs/dialogHandler.ts -index a4728e7..d1a8b94 100644 +index f63b75f..8e24c02 100644 --- a/src/vs/workbench/electron-sandbox/parts/dialogs/dialogHandler.ts +++ b/src/vs/workbench/electron-sandbox/parts/dialogs/dialogHandler.ts -@@ -167,8 +167,9 @@ export class NativeDialogHandler implements IDialogHandler { - - const detailString = (useAgo: boolean): string => { +@@ -169,4 +169,5 @@ export class NativeDialogHandler implements IDialogHandler { return localize({ key: 'aboutDetail', comment: ['Electron, Chromium, Node.js and V8 are product names that need no translation'] }, -- "Version: {0}\nCommit: {1}\nDate: {2}\nElectron: {3}\nChromium: {4}\nNode.js: {5}\nV8: {6}\nOS: {7}", -+ "Version: {0}\nRelease: {1}\nCommit: {2}\nDate: {3}\nElectron: {4}\nChromium: {5}\nNode.js: {6}\nV8: {7}\nOS: {8}", +- "Version: {0}\nCommit: {1}\nDate: {2}\nElectron: {3}\nChromium: {4}\nNode.js: {5}\nV8: {6}\nOS: {7}\nSandboxed: {8}", ++ "Version: {0}\nRelease: {1}\nCommit: {2}\nDate: {3}\nElectron: {4}\nChromium: {5}\nNode.js: {6}\nV8: {7}\nOS: {8}\nSandboxed: {9}", version, + this.productService.release || 'Unknown', this.productService.commit || 'Unknown', - this.productService.date ? `${this.productService.date}${useAgo ? ' (' + fromNow(new Date(this.productService.date), true) + ')' : ''}` : 'Unknown', - process.versions['electron'], diff --git a/patches/fix-build-linux.patch b/patches/fix-build-linux.patch index 8d3905e..fb2e6b0 100644 --- a/patches/fix-build-linux.patch +++ b/patches/fix-build-linux.patch @@ -1,62 +1,27 @@ -diff --git a/build/linux/debian/dependencies-generator.js b/build/linux/debian/dependencies-generator.js -index 235ca26..4f0f06e 100644 ---- a/build/linux/debian/dependencies-generator.js -+++ b/build/linux/debian/dependencies-generator.js -@@ -17,7 +17,7 @@ const dep_lists_1 = require("./dep-lists"); - // If true, we fail the build if there are new dependencies found during that task. - // The reference dependencies, which one has to update when the new dependencies +diff --git a/build/linux/dependencies-generator.js b/build/linux/dependencies-generator.js +index af20828..f09ba66 100644 +--- a/build/linux/dependencies-generator.js ++++ b/build/linux/dependencies-generator.js +@@ -22,3 +22,3 @@ const types_2 = require("./rpm/types"); // are valid, are in dep-lists.ts -const FAIL_BUILD_FOR_NEW_DEPENDENCIES = true; +const FAIL_BUILD_FOR_NEW_DEPENDENCIES = false; - function getDependencies(buildDir, applicationName, arch, sysroot) { - // Get the files for which we want to find dependencies. - const nativeModulesPath = path.join(buildDir, 'resources', 'app', 'node_modules.asar.unpacked'); -diff --git a/build/linux/debian/dependencies-generator.ts b/build/linux/debian/dependencies-generator.ts -index 9e3d466..776a4c2 100644 ---- a/build/linux/debian/dependencies-generator.ts -+++ b/build/linux/debian/dependencies-generator.ts -@@ -19,7 +19,7 @@ import { ArchString } from './types'; - // If true, we fail the build if there are new dependencies found during that task. - // The reference dependencies, which one has to update when the new dependencies + // Based on https://source.chromium.org/chromium/chromium/src/+/refs/tags/98.0.4758.109:chrome/installer/linux/BUILD.gn;l=64-80 +diff --git a/build/linux/dependencies-generator.ts b/build/linux/dependencies-generator.ts +index 34573c4..91adb8f 100644 +--- a/build/linux/dependencies-generator.ts ++++ b/build/linux/dependencies-generator.ts +@@ -23,3 +23,3 @@ import { isRpmArchString, RpmArchString } from './rpm/types'; // are valid, are in dep-lists.ts -const FAIL_BUILD_FOR_NEW_DEPENDENCIES: boolean = true; +const FAIL_BUILD_FOR_NEW_DEPENDENCIES: boolean = false; - export function getDependencies(buildDir: string, applicationName: string, arch: ArchString, sysroot: string): string[] { - // Get the files for which we want to find dependencies. -diff --git a/build/linux/rpm/dependencies-generator.js b/build/linux/rpm/dependencies-generator.js -index 90cfca9..c92579e 100644 ---- a/build/linux/rpm/dependencies-generator.js -+++ b/build/linux/rpm/dependencies-generator.js -@@ -16,7 +16,7 @@ const dep_lists_1 = require("./dep-lists"); - // If true, we fail the build if there are new dependencies found during that task. - // The reference dependencies, which one has to update when the new dependencies - // are valid, are in dep-lists.ts --const FAIL_BUILD_FOR_NEW_DEPENDENCIES = true; -+const FAIL_BUILD_FOR_NEW_DEPENDENCIES = false; - function getDependencies(buildDir, applicationName, arch) { - // Get the files for which we want to find dependencies. - const nativeModulesPath = path.join(buildDir, 'resources', 'app', 'node_modules.asar.unpacked'); -diff --git a/build/linux/rpm/dependencies-generator.ts b/build/linux/rpm/dependencies-generator.ts -index 4b84640..55429fb 100644 ---- a/build/linux/rpm/dependencies-generator.ts -+++ b/build/linux/rpm/dependencies-generator.ts -@@ -16,7 +16,7 @@ import { ArchString } from './types'; - // If true, we fail the build if there are new dependencies found during that task. - // The reference dependencies, which one has to update when the new dependencies - // are valid, are in dep-lists.ts --const FAIL_BUILD_FOR_NEW_DEPENDENCIES: boolean = true; -+const FAIL_BUILD_FOR_NEW_DEPENDENCIES: boolean = false; - - export function getDependencies(buildDir: string, applicationName: string, arch: ArchString): string[] { - // Get the files for which we want to find dependencies. diff --git a/resources/linux/rpm/code.spec.template b/resources/linux/rpm/code.spec.template -index 00ddb6f..cea0e97 100644 +index 61659d2..6331a67 100644 --- a/resources/linux/rpm/code.spec.template +++ b/resources/linux/rpm/code.spec.template -@@ -72,3 +72,5 @@ update-mime-database /usr/share/mime &> /dev/null || : - /usr/share/pixmaps/@@ICON@@.png - /usr/share/bash-completion/completions/@@NAME@@ - /usr/share/zsh/site-functions/_@@NAME@@ +@@ -78 +78,3 @@ update-mime-database %{_datadir}/mime &> /dev/null || : + %{_datadir}/zsh/site-functions/_%{name} + -+%config(noreplace) /usr/share/@@NAME@@/resources/app/product.json ++%config(noreplace) /usr/share/%{name}/resources/app/product.json +\ No newline at end of file diff --git a/patches/insider/disable-sandbox.patch b/patches/insider/disable-sandbox.patch new file mode 100644 index 0000000..98964ef --- /dev/null +++ b/patches/insider/disable-sandbox.patch @@ -0,0 +1,21 @@ +diff --git a/src/vs/platform/windows/electron-main/windowImpl.ts b/src/vs/platform/windows/electron-main/windowImpl.ts +index c9501cb..a6958ff 100644 +--- a/src/vs/platform/windows/electron-main/windowImpl.ts ++++ b/src/vs/platform/windows/electron-main/windowImpl.ts +@@ -42,7 +42,6 @@ import { Color } from 'vs/base/common/color'; + import { IPolicyService } from 'vs/platform/policy/common/policy'; + import { IUserDataProfile } from 'vs/platform/userDataProfile/common/userDataProfile'; + import { IStateMainService } from 'vs/platform/state/electron-main/state'; +-import product from 'vs/platform/product/common/product'; + import { IUserDataProfilesMainService } from 'vs/platform/userDataProfile/electron-main/userDataProfile'; + + export interface IWindowCreationOptions { +@@ -203,7 +202,7 @@ export class CodeWindow extends Disposable implements ICodeWindow { + if (typeof windowSettings?.experimental?.useSandbox === 'boolean') { + useSandbox = windowSettings.experimental.useSandbox; + } else { +- useSandbox = typeof product.quality === 'string' && product.quality !== 'stable'; ++ useSandbox = false; + } + + const options: BrowserWindowConstructorOptions & { experimentalDarkMode: boolean } = { diff --git a/patches/insider/system-extensions.patch b/patches/insider/system-extensions.patch new file mode 100644 index 0000000..ba23f0f --- /dev/null +++ b/patches/insider/system-extensions.patch @@ -0,0 +1,13 @@ +diff --git a/src/vs/workbench/contrib/extensions/browser/extensionsWorkbenchService.ts b/src/vs/workbench/contrib/extensions/browser/extensionsWorkbenchService.ts +index 81bf4b2..5a88688 100644 +--- a/src/vs/workbench/contrib/extensions/browser/extensionsWorkbenchService.ts ++++ b/src/vs/workbench/contrib/extensions/browser/extensionsWorkbenchService.ts +@@ -233,7 +233,7 @@ export class Extension implements IExtension { + return false; + } + // Do not allow updating system extensions in stable +- if (this.type === ExtensionType.System && this.productService.quality === 'stable') { ++ if (this.type === ExtensionType.System) { + return false; + } + if (!this.local.preRelease && this.gallery.properties.isPreReleaseVersion) { diff --git a/patches/use-github-extensions.patch b/patches/use-github-extensions.patch deleted file mode 100644 index 2e74ac1..0000000 --- a/patches/use-github-extensions.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff --git a/build/gulpfile.extensions.js b/build/gulpfile.extensions.js ---- a/build/gulpfile.extensions.js -+++ b/build/gulpfile.extensions.js -@@ -223,7 +223,7 @@ const cleanExtensionsBuildTask = task.define('clean-extensions-build', util.rimr - const compileExtensionsBuildTask = task.define('compile-extensions-build', task.series( - cleanExtensionsBuildTask, - task.define('bundle-extensions-build', () => ext.packageLocalExtensionsStream(false).pipe(gulp.dest('.build'))), -- task.define('bundle-marketplace-extensions-build', () => ext.packageMarketplaceExtensionsStream(false, product.extensionsGallery?.serviceUrl).pipe(gulp.dest('.build'))), -+ task.define('bundle-marketplace-extensions-build', () => ext.packageMarketplaceExtensionsStream(false).pipe(gulp.dest('.build'))), - )); - - gulp.task(compileExtensionsBuildTask); diff --git a/patches/use-github-pat.patch b/patches/use-github-pat.patch index a5a68d8..a28a98c 100644 --- a/patches/use-github-pat.patch +++ b/patches/use-github-pat.patch @@ -1,10 +1,8 @@ diff --git a/extensions/github-authentication/src/githubServer.ts b/extensions/github-authentication/src/githubServer.ts -index c366ff3..75f32da 100644 +index 1614794..c6d54f6 100644 --- a/extensions/github-authentication/src/githubServer.ts +++ b/extensions/github-authentication/src/githubServer.ts -@@ -3,27 +3,13 @@ - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ +@@ -5,7 +5,4 @@ -import * as nls from 'vscode-nls'; import * as vscode from 'vscode'; @@ -12,7 +10,7 @@ index c366ff3..75f32da 100644 -import { v4 as uuid } from 'uuid'; -import { PromiseAdapter, promiseFromEvent } from './common/utils'; import { ExperimentationTelemetry } from './experimentationService'; - import { AuthProviderType } from './github'; +@@ -13,15 +10,4 @@ import { AuthProviderType } from './github'; import { Log } from './common/logger'; -import { isSupportedEnvironment } from './common/env'; -import { LoopbackAuthServer } from './authServer'; @@ -29,13 +27,8 @@ index c366ff3..75f32da 100644 -const REDIRECT_URL_INSIDERS = 'https://insiders.vscode.dev/redirect'; +const NETWORK_ERROR = 'network error'; - class UriEventHandler extends vscode.EventEmitter implements vscode.UriHandler { - constructor(private readonly Logger: Log) { -@@ -43,14 +29,6 @@ export interface IGitHubServer extends vscode.Disposable { - friendlyName: string; - type: AuthProviderType; - } -- +@@ -46,9 +32,2 @@ export interface IGitHubServer extends vscode.Disposable { + -interface IGitHubDeviceCodeResponse { - device_code: string; - user_code: string; @@ -44,11 +37,7 @@ index c366ff3..75f32da 100644 -} - async function getScopes(token: string, serverUri: vscode.Uri, logger: Log): Promise { - try { - logger.info('Getting token scopes...'); -@@ -118,23 +96,11 @@ export class GitHubServer implements IGitHubServer { - friendlyName = 'GitHub'; - type = AuthProviderType.github; +@@ -120,19 +99,7 @@ export class GitHubServer implements IGitHubServer { - private _pendingNonces = new Map(); - private _codeExchangePromises = new Map; cancel: vscode.EventEmitter }>(); @@ -69,11 +58,9 @@ index c366ff3..75f32da 100644 - return redirectUri; - }); } +@@ -152,60 +119,9 @@ export class GitHubServer implements IGitHubServer { - dispose() { -@@ -152,181 +118,17 @@ export class GitHubServer implements IGitHubServer { - - // Used for showing a friendlier message to the user when the explicitly cancel a flow. +- // Used for showing a friendlier message to the user when the explicitly cancel a flow. let userCancelled: boolean | undefined; - const yes = localize('yes', "Yes"); - const no = localize('no', "No"); @@ -103,7 +90,7 @@ index c366ff3..75f32da 100644 - userCancelled = e.message ?? e === 'User Cancelled'; - } - } -- + - // Starting a local server isn't supported in web - if (vscode.env.uiKind === vscode.UIKind.Desktop) { - try { @@ -114,7 +101,7 @@ index c366ff3..75f32da 100644 - userCancelled = e.message ?? e === 'User Cancelled'; - } - } - +- - if (this._supportDeviceCodeFlow) { - try { - await promptToContinue(); @@ -137,9 +124,7 @@ index c366ff3..75f32da 100644 + this._logger.error(e); + userCancelled = e.message ?? e === 'User Cancelled'; } - - throw new Error(userCancelled ? 'Cancelled' : 'No auth flow succeeded.'); - } +@@ -215,117 +131,2 @@ export class GitHubServer implements IGitHubServer { - private async doLoginWithoutLocalServer(scopes: string, nonce: string, callbackUri: vscode.Uri): Promise { - this._logger.info(`Trying without local server... (${scopes})`); @@ -171,7 +156,7 @@ index c366ff3..75f32da 100644 - try { - return await Promise.race([ - codeExchangePromise.promise, -- new Promise((_, reject) => setTimeout(() => reject('Cancelled'), 60000)), +- new Promise((_, reject) => setTimeout(() => reject('Timed out'), 300_000)), // 5min timeout - promiseFromEvent(token.onCancellationRequested, (_, __, reject) => { reject('User Cancelled'); }).promise - ]); - } finally { @@ -204,7 +189,7 @@ index c366ff3..75f32da 100644 - vscode.env.openExternal(vscode.Uri.parse(`http://127.0.0.1:${port}/signin?nonce=${encodeURIComponent(server.nonce)}`)); - const { code } = await Promise.race([ - server.waitForOAuthResponse(), -- new Promise((_, reject) => setTimeout(() => reject('Cancelled'), 60000)), +- new Promise((_, reject) => setTimeout(() => reject('Timed out'), 300_000)), // 5min timeout - promiseFromEvent(token.onCancellationRequested, (_, __, reject) => { reject('User Cancelled'); }).promise - ]); - codeToExchange = code; @@ -255,12 +240,9 @@ index c366ff3..75f32da 100644 - - return await this.waitForDeviceCodeAccessToken(json); - } - +- private async doLoginWithPat(scopes: string): Promise { - this._logger.info(`Trying to retrieve PAT... (${scopes})`); -@@ -351,118 +153,6 @@ export class GitHubServer implements IGitHubServer { - return token; - } +@@ -353,114 +154,2 @@ export class GitHubServer implements IGitHubServer { - private async waitForDeviceCodeAccessToken( - json: IGitHubDeviceCodeResponse, @@ -375,28 +357,20 @@ index c366ff3..75f32da 100644 - } - private getServerUri(path: string = '') { - const apiUri = vscode.Uri.parse('https://api.github.com'); - return vscode.Uri.parse(`${apiUri.scheme}://${apiUri.authority}${path}`); diff --git a/src/vs/workbench/browser/parts/activitybar/activitybarActions.ts b/src/vs/workbench/browser/parts/activitybar/activitybarActions.ts -index 36647e6..55e722b 100644 +index d5f0967..ea256a0 100644 --- a/src/vs/workbench/browser/parts/activitybar/activitybarActions.ts +++ b/src/vs/workbench/browser/parts/activitybar/activitybarActions.ts -@@ -271,7 +271,7 @@ export class AccountsActivityActionViewItem extends MenuActivityActionViewItem { - } - }); +@@ -287,3 +287,3 @@ export class AccountsActivityActionViewItem extends MenuActivityActionViewItem { - if (providers.length && !menus.length) { + if (!menus.length) { const noAccountsAvailableAction = disposables.add(new Action('noAccountsAvailable', localize('noAccounts', "You are not signed in to any accounts"), undefined, false)); - menus.push(noAccountsAvailableAction); - } diff --git a/src/vs/workbench/services/authentication/browser/authenticationService.ts b/src/vs/workbench/services/authentication/browser/authenticationService.ts -index f543021..ad40bc3 100644 +index 6fe923a..9eb0b0c 100644 --- a/src/vs/workbench/services/authentication/browser/authenticationService.ts +++ b/src/vs/workbench/services/authentication/browser/authenticationService.ts -@@ -272,16 +272,6 @@ export class AuthenticationService extends Disposable implements IAuthentication - this.removeAccessRequest(id, extensionId); - }); +@@ -275,12 +275,2 @@ export class AuthenticationService extends Disposable implements IAuthentication } - - if (!this._authenticationProviders.size) { @@ -409,5 +383,3 @@ index f543021..ad40bc3 100644 - }); - } } - - async sessionsUpdate(id: string, event: AuthenticationSessionsChangeEvent): Promise {