fix(1.62): fix patches (#899)
This commit is contained in:
parent
b0ff3b4f34
commit
38810539a7
3 changed files with 29 additions and 43 deletions
1
build.sh
1
build.sh
|
@ -25,7 +25,6 @@ if [[ "${SHOULD_BUILD}" == "yes" ]]; then
|
||||||
. ../build/windows/rtf/make.sh
|
. ../build/windows/rtf/make.sh
|
||||||
|
|
||||||
yarn gulp "vscode-win32-${VSCODE_ARCH}-min-ci"
|
yarn gulp "vscode-win32-${VSCODE_ARCH}-min-ci"
|
||||||
yarn gulp "vscode-win32-${VSCODE_ARCH}-code-helper"
|
|
||||||
yarn gulp "vscode-win32-${VSCODE_ARCH}-inno-updater"
|
yarn gulp "vscode-win32-${VSCODE_ARCH}-inno-updater"
|
||||||
|
|
||||||
if [[ "${SHOULD_BUILD_ZIP}" != "no" ]]; then
|
if [[ "${SHOULD_BUILD_ZIP}" != "no" ]]; then
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
diff --git a/src/vs/base/common/product.ts b/src/vs/base/common/product.ts
|
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
|
--- a/src/vs/base/common/product.ts
|
||||||
+++ b/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 extensionsGallery?: {
|
||||||
readonly serviceUrl: string;
|
readonly serviceUrl: string;
|
||||||
|
@ -11,7 +11,7 @@ index 78d6060..dfa9de2 100644
|
||||||
readonly resourceUrlTemplate: string;
|
readonly resourceUrlTemplate: string;
|
||||||
readonly controlUrl: string;
|
readonly controlUrl: string;
|
||||||
diff --git a/src/vs/platform/product/common/product.ts b/src/vs/platform/product/common/product.ts
|
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
|
--- a/src/vs/platform/product/common/product.ts
|
||||||
+++ b/src/vs/platform/product/common/product.ts
|
+++ b/src/vs/platform/product/common/product.ts
|
||||||
@@ -4,11 +4,12 @@
|
@@ -4,11 +4,12 @@
|
||||||
|
@ -26,9 +26,9 @@ index 09dfc64..fec0cfa 100644
|
||||||
import { ISandboxConfiguration } from 'vs/base/parts/sandbox/common/sandboxTypes';
|
import { ISandboxConfiguration } from 'vs/base/parts/sandbox/common/sandboxTypes';
|
||||||
+import { getUserDataPath } from 'vs/platform/environment/node/userDataPath';
|
+import { getUserDataPath } from 'vs/platform/environment/node/userDataPath';
|
||||||
|
|
||||||
let product: IProductConfiguration;
|
/**
|
||||||
|
* @deprecated You MUST use `IProductService` if possible.
|
||||||
@@ -31,6 +32,32 @@ else if (typeof require?.__$__nodeRequire === 'function') {
|
@@ -34,6 +35,32 @@ else if (typeof require?.__$__nodeRequire === 'function') {
|
||||||
product = require.__$__nodeRequire(joinPath(rootPath, 'product.json').fsPath);
|
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; };
|
||||||
|
|
||||||
|
@ -61,7 +61,7 @@ index 09dfc64..fec0cfa 100644
|
||||||
// Running out of sources
|
// Running out of sources
|
||||||
if (env['VSCODE_DEV']) {
|
if (env['VSCODE_DEV']) {
|
||||||
Object.assign(product, {
|
Object.assign(product, {
|
||||||
@@ -40,6 +67,19 @@ else if (typeof require?.__$__nodeRequire === 'function') {
|
@@ -43,6 +70,19 @@ else if (typeof require?.__$__nodeRequire === 'function') {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
diff --git a/extensions/github-authentication/src/githubServer.ts b/extensions/github-authentication/src/githubServer.ts
|
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
|
--- a/extensions/github-authentication/src/githubServer.ts
|
||||||
+++ b/extensions/github-authentication/src/githubServer.ts
|
+++ b/extensions/github-authentication/src/githubServer.ts
|
||||||
@@ -6,8 +6,6 @@
|
@@ -6,8 +6,6 @@
|
||||||
|
@ -47,7 +47,7 @@ index 8424f5b..5bac245 100644
|
||||||
private _statusBarCommandId = `${this.type}.provide-manually`;
|
private _statusBarCommandId = `${this.type}.provide-manually`;
|
||||||
private _disposable: vscode.Disposable;
|
private _disposable: vscode.Disposable;
|
||||||
private _uriHandler = new UriEventHandler(this._logger);
|
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();
|
this._disposable.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,15 +58,13 @@ index 8424f5b..5bac245 100644
|
||||||
- // TODO@joaomoreno TODO@TylerLeonhardt
|
- // TODO@joaomoreno TODO@TylerLeonhardt
|
||||||
- private async isNoCorsEnvironment(): Promise<boolean> {
|
- private async isNoCorsEnvironment(): Promise<boolean> {
|
||||||
- const uri = await vscode.env.asExternalUri(vscode.Uri.parse(`${vscode.env.uriScheme}://vscode.github-authentication/dummy`));
|
- 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> {
|
public async login(scopes: string): Promise<string> {
|
||||||
this._logger.info(`Logging in for the following scopes: ${scopes}`);
|
this._logger.info(`Logging in for the following scopes: ${scopes}`);
|
||||||
|
|
||||||
- // TODO@joaomoreno TODO@TylerLeonhardt
|
- const callbackUri = await vscode.env.asExternalUri(vscode.Uri.parse(`${vscode.env.uriScheme}://vscode.github-authentication/did-authenticate`));
|
||||||
- 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' : ''}`));
|
|
||||||
-
|
-
|
||||||
- if (this.isTestEnvironment(callbackUri)) {
|
- if (this.isTestEnvironment(callbackUri)) {
|
||||||
- const token = await vscode.window.showInputBox({ prompt: 'GitHub Personal Access Token', ignoreFocusOut: true });
|
- 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);
|
- 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 tokenScopes = await getScopes(token, this.getServerUri('/'), this._logger); // Example: ['repo', 'user']
|
||||||
+ const scopesList = scopes.split(' '); // Example: 'read:user repo user:email'
|
+ const scopesList = scopes.split(' '); // Example: 'read:user repo user:email'
|
||||||
+ if (!scopesList.every(scope => {
|
+ if (!scopesList.every(scope => {
|
||||||
|
@ -104,7 +102,7 @@ index 8424f5b..5bac245 100644
|
||||||
- const existingStates = this._pendingStates.get(scopes) || [];
|
- const existingStates = this._pendingStates.get(scopes) || [];
|
||||||
- this._pendingStates.set(scopes, [...existingStates, state]);
|
- 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);
|
- await vscode.env.openExternal(uri);
|
||||||
-
|
-
|
||||||
- // Register a single listener for the URI callback, in case the user starts the login process multiple times
|
- // 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);
|
+ 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([
|
- return Promise.race([
|
||||||
|
@ -158,34 +156,23 @@ index 8424f5b..5bac245 100644
|
||||||
- const url = `https://${AUTH_RELAY_SERVER}/token?code=${code}&state=${query.state}`;
|
- const url = `https://${AUTH_RELAY_SERVER}/token?code=${code}&state=${query.state}`;
|
||||||
- this._logger.info('Exchanging code for token...');
|
- this._logger.info('Exchanging code for token...');
|
||||||
-
|
-
|
||||||
- // TODO@joao: remove
|
- try {
|
||||||
- if (query.nocors) {
|
- const result = await fetch(url, {
|
||||||
- try {
|
- method: 'POST',
|
||||||
- const json: any = await vscode.commands.executeCommand('_workbench.fetchJSON', url, 'POST');
|
- headers: {
|
||||||
|
- Accept: 'application/json'
|
||||||
|
- }
|
||||||
|
- });
|
||||||
|
-
|
||||||
|
- if (result.ok) {
|
||||||
|
- const json = await result.json();
|
||||||
- this._logger.info('Token exchange success!');
|
- this._logger.info('Token exchange success!');
|
||||||
- resolve(json.access_token);
|
- resolve(json.access_token);
|
||||||
- } catch (err) {
|
- } else {
|
||||||
- reject(err);
|
- reject(result.statusText);
|
||||||
- }
|
|
||||||
- } 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);
|
|
||||||
- }
|
- }
|
||||||
|
- } catch (ex) {
|
||||||
|
- reject(ex);
|
||||||
- }
|
- }
|
||||||
- };
|
- };
|
||||||
-
|
-
|
||||||
|
@ -212,7 +199,7 @@ index 8424f5b..5bac245 100644
|
||||||
private async manuallyProvideUri() {
|
private async manuallyProvideUri() {
|
||||||
const uri = await vscode.window.showInputBox({
|
const uri = await vscode.window.showInputBox({
|
||||||
prompt: 'Uri',
|
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);
|
return getUserInfo(token, this.getServerUri('/user'), this._logger);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue