fix(1.62): fix patches (#899)

This commit is contained in:
Baptiste Augrain 2021-11-06 02:52:55 +01:00 committed by GitHub
parent b0ff3b4f34
commit 38810539a7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 29 additions and 43 deletions

View file

@ -25,7 +25,6 @@ if [[ "${SHOULD_BUILD}" == "yes" ]]; then
. ../build/windows/rtf/make.sh
yarn gulp "vscode-win32-${VSCODE_ARCH}-min-ci"
yarn gulp "vscode-win32-${VSCODE_ARCH}-code-helper"
yarn gulp "vscode-win32-${VSCODE_ARCH}-inno-updater"
if [[ "${SHOULD_BUILD_ZIP}" != "no" ]]; then

View file

@ -1,8 +1,8 @@
diff --git a/src/vs/base/common/product.ts b/src/vs/base/common/product.ts
index 78d6060..dfa9de2 100644
index 657b9c9..9b9b12e 100644
--- a/src/vs/base/common/product.ts
+++ b/src/vs/base/common/product.ts
@@ -69,6 +69,7 @@ export interface IProductConfiguration {
@@ -70,6 +70,7 @@ export interface IProductConfiguration {
readonly extensionsGallery?: {
readonly serviceUrl: string;
@ -11,7 +11,7 @@ index 78d6060..dfa9de2 100644
readonly resourceUrlTemplate: string;
readonly controlUrl: string;
diff --git a/src/vs/platform/product/common/product.ts b/src/vs/platform/product/common/product.ts
index 09dfc64..fec0cfa 100644
index 5e38d35..12bb161 100644
--- a/src/vs/platform/product/common/product.ts
+++ b/src/vs/platform/product/common/product.ts
@@ -4,11 +4,12 @@
@ -26,9 +26,9 @@ index 09dfc64..fec0cfa 100644
import { ISandboxConfiguration } from 'vs/base/parts/sandbox/common/sandboxTypes';
+import { getUserDataPath } from 'vs/platform/environment/node/userDataPath';
let product: IProductConfiguration;
@@ -31,6 +32,32 @@ else if (typeof require?.__$__nodeRequire === 'function') {
/**
* @deprecated You MUST use `IProductService` if possible.
@@ -34,6 +35,32 @@ 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; };
@ -61,7 +61,7 @@ index 09dfc64..fec0cfa 100644
// Running out of sources
if (env['VSCODE_DEV']) {
Object.assign(product, {
@@ -40,6 +67,19 @@ else if (typeof require?.__$__nodeRequire === 'function') {
@@ -43,6 +70,19 @@ else if (typeof require?.__$__nodeRequire === 'function') {
});
}

View file

@ -1,5 +1,5 @@
diff --git a/extensions/github-authentication/src/githubServer.ts b/extensions/github-authentication/src/githubServer.ts
index 8424f5b..5bac245 100644
index fe0fbfd..656d8bb 100644
--- a/extensions/github-authentication/src/githubServer.ts
+++ b/extensions/github-authentication/src/githubServer.ts
@@ -6,8 +6,6 @@
@ -47,7 +47,7 @@ index 8424f5b..5bac245 100644
private _statusBarCommandId = `${this.type}.provide-manually`;
private _disposable: vscode.Disposable;
private _uriHandler = new UriEventHandler(this._logger);
@@ -115,150 +99,35 @@ export class GitHubServer implements IGitHubServer {
@@ -115,137 +99,35 @@ export class GitHubServer implements IGitHubServer {
this._disposable.dispose();
}
@ -58,15 +58,13 @@ index 8424f5b..5bac245 100644
- // TODO@joaomoreno TODO@TylerLeonhardt
- private async isNoCorsEnvironment(): Promise<boolean> {
- const uri = await vscode.env.asExternalUri(vscode.Uri.parse(`${vscode.env.uriScheme}://vscode.github-authentication/dummy`));
- return (uri.scheme === 'https' && /^(vscode|github)\./.test(uri.authority)) || (uri.scheme === 'http' && /^localhost/.test(uri.authority));
- return (uri.scheme === 'https' && /^((insiders\.)?vscode|github)\./.test(uri.authority)) || (uri.scheme === 'http' && /^localhost/.test(uri.authority));
- }
-
public async login(scopes: string): Promise<string> {
this._logger.info(`Logging in for the following scopes: ${scopes}`);
- // TODO@joaomoreno TODO@TylerLeonhardt
- const nocors = await this.isNoCorsEnvironment();
- const callbackUri = await vscode.env.asExternalUri(vscode.Uri.parse(`${vscode.env.uriScheme}://vscode.github-authentication/did-authenticate${nocors ? '?nocors=true' : ''}`));
- const callbackUri = await vscode.env.asExternalUri(vscode.Uri.parse(`${vscode.env.uriScheme}://vscode.github-authentication/did-authenticate`));
-
- if (this.isTestEnvironment(callbackUri)) {
- const token = await vscode.window.showInputBox({ prompt: 'GitHub Personal Access Token', ignoreFocusOut: true });
@ -86,7 +84,7 @@ index 8424f5b..5bac245 100644
- return tokenScopes.includes(splitScopes);
- });
- })) {
- throw new Error(`The provided token is does not match the requested scopes: ${scopes}`);
- throw new Error(`The provided token does not match the requested scopes: ${scopes}`);
+ const tokenScopes = await getScopes(token, this.getServerUri('/'), this._logger); // Example: ['repo', 'user']
+ const scopesList = scopes.split(' '); // Example: 'read:user repo user:email'
+ if (!scopesList.every(scope => {
@ -104,7 +102,7 @@ index 8424f5b..5bac245 100644
- const existingStates = this._pendingStates.get(scopes) || [];
- this._pendingStates.set(scopes, [...existingStates, state]);
-
- const uri = vscode.Uri.parse(`https://${AUTH_RELAY_SERVER}/authorize/?callbackUri=${encodeURIComponent(callbackUri.toString())}&scope=${scopes}&state=${state}&responseType=code&authServer=https://github.com${nocors ? '&nocors=true' : ''}`);
- const uri = vscode.Uri.parse(`https://${AUTH_RELAY_SERVER}/authorize/?callbackUri=${encodeURIComponent(callbackUri.toString())}&scope=${scopes}&state=${state}&responseType=code&authServer=https://github.com`);
- await vscode.env.openExternal(uri);
-
- // Register a single listener for the URI callback, in case the user starts the login process multiple times
@ -117,7 +115,7 @@ index 8424f5b..5bac245 100644
+ return tokenScopes.includes(splitScopes);
+ });
+ })) {
+ throw new Error(`The provided token is does not match the requested scopes: ${scopes}`);
+ throw new Error(`The provided token does not match the requested scopes: ${scopes}`);
}
- return Promise.race([
@ -158,34 +156,23 @@ index 8424f5b..5bac245 100644
- const url = `https://${AUTH_RELAY_SERVER}/token?code=${code}&state=${query.state}`;
- this._logger.info('Exchanging code for token...');
-
- // TODO@joao: remove
- if (query.nocors) {
- try {
- const json: any = await vscode.commands.executeCommand('_workbench.fetchJSON', url, 'POST');
- try {
- const result = await fetch(url, {
- method: 'POST',
- headers: {
- Accept: 'application/json'
- }
- });
-
- if (result.ok) {
- const json = await result.json();
- this._logger.info('Token exchange success!');
- resolve(json.access_token);
- } catch (err) {
- reject(err);
- }
- } else {
- try {
- const result = await fetch(url, {
- method: 'POST',
- headers: {
- Accept: 'application/json'
- }
- });
-
- if (result.ok) {
- const json = await result.json();
- this._logger.info('Token exchange success!');
- resolve(json.access_token);
- } else {
- reject(result.statusText);
- }
- } catch (ex) {
- reject(ex);
- } else {
- reject(result.statusText);
- }
- } catch (ex) {
- reject(ex);
- }
- };
-
@ -212,7 +199,7 @@ index 8424f5b..5bac245 100644
private async manuallyProvideUri() {
const uri = await vscode.window.showInputBox({
prompt: 'Uri',
@@ -290,44 +159,7 @@ export class GitHubServer implements IGitHubServer {
@@ -277,44 +159,7 @@ export class GitHubServer implements IGitHubServer {
return getUserInfo(token, this.getServerUri('/user'), this._logger);
}