fix: patch [skip ci]

This commit is contained in:
Baptiste Augrain 2022-11-02 08:23:18 +01:00
parent b9cf9669ec
commit 0f32071868
2 changed files with 50 additions and 66 deletions

View File

@ -1,18 +1,22 @@
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 42e4354..cd6f27e 100644 index 94ce542..2e93aea 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
@@ -7,4 +7,2 @@ import * as vscode from 'vscode'; @@ -5,7 +5,4 @@
-import * as nls from 'vscode-nls';
import * as vscode from 'vscode';
import fetch, { Response } from 'node-fetch'; import fetch, { Response } from 'node-fetch';
-import { v4 as uuid } from 'uuid'; -import { v4 as uuid } from 'uuid';
-import { PromiseAdapter, promiseFromEvent } from './common/utils'; -import { PromiseAdapter, promiseFromEvent } from './common/utils';
import { ExperimentationTelemetry } from './experimentationService'; import { ExperimentationTelemetry } from './experimentationService';
@@ -12,13 +10,4 @@ import { AuthProviderType } from './github'; @@ -13,14 +10,5 @@ import { AuthProviderType } from './github';
import { Log } from './common/logger'; import { Log } from './common/logger';
-import { isSupportedEnvironment } from './common/env'; -import { isSupportedEnvironment } from './common/env';
-import { LoopbackAuthServer } from './authServer'; -import { LoopbackAuthServer } from './authServer';
-import path = require('path'); -import path = require('path');
-
-const localize = nls.loadMessageBundle();
-const CLIENT_ID = '01ab8ac9400c4e429b23'; -const CLIENT_ID = '01ab8ac9400c4e429b23';
-const GITHUB_TOKEN_URL = 'https://vscode.dev/codeExchangeProxyEndpoints/github/login/oauth/access_token'; -const GITHUB_TOKEN_URL = 'https://vscode.dev/codeExchangeProxyEndpoints/github/login/oauth/access_token';
const NETWORK_ERROR = 'network error'; const NETWORK_ERROR = 'network error';
@ -21,7 +25,7 @@ index 42e4354..cd6f27e 100644
-const REDIRECT_URL_INSIDERS = 'https://insiders.vscode.dev/redirect'; -const REDIRECT_URL_INSIDERS = 'https://insiders.vscode.dev/redirect';
- -
class UriEventHandler extends vscode.EventEmitter<vscode.Uri> implements vscode.UriHandler { class UriEventHandler extends vscode.EventEmitter<vscode.Uri> implements vscode.UriHandler {
@@ -42,9 +31,2 @@ export interface IGitHubServer extends vscode.Disposable { @@ -44,9 +32,2 @@ export interface IGitHubServer extends vscode.Disposable {
-interface IGitHubDeviceCodeResponse { -interface IGitHubDeviceCodeResponse {
- device_code: string; - device_code: string;
@ -31,12 +35,12 @@ index 42e4354..cd6f27e 100644
-} -}
- -
async function getScopes(token: string, serverUri: vscode.Uri, logger: Log): Promise<string[]> { async function getScopes(token: string, serverUri: vscode.Uri, logger: Log): Promise<string[]> {
@@ -55,3 +37,3 @@ async function getScopes(token: string, serverUri: vscode.Uri, logger: Log): Pro @@ -57,3 +38,3 @@ async function getScopes(token: string, serverUri: vscode.Uri, logger: Log): Pro
Authorization: `token ${token}`, Authorization: `token ${token}`,
- 'User-Agent': 'Visual-Studio-Code' - 'User-Agent': 'Visual-Studio-Code'
+ 'User-Agent': 'VSCodium' + 'User-Agent': 'VSCodium'
} }
@@ -75,7 +57,4 @@ export class GitHubServer implements IGitHubServer { @@ -77,7 +58,4 @@ export class GitHubServer implements IGitHubServer {
- private _pendingNonces = new Map<string, string[]>(); - private _pendingNonces = new Map<string, string[]>();
- private _codeExchangePromises = new Map<string, { promise: Promise<string>; cancel: vscode.EventEmitter<void> }>(); - private _codeExchangePromises = new Map<string, { promise: Promise<string>; cancel: vscode.EventEmitter<void> }>();
@ -44,11 +48,11 @@ index 42e4354..cd6f27e 100644
private static _uriHandler: UriEventHandler | undefined; private static _uriHandler: UriEventHandler | undefined;
- private _redirectEndpoint: string | undefined; - private _redirectEndpoint: string | undefined;
@@ -83,2 +62,3 @@ export class GitHubServer implements IGitHubServer { @@ -85,2 +63,3 @@ export class GitHubServer implements IGitHubServer {
public readonly type: AuthProviderType, public readonly type: AuthProviderType,
+ // @ts-ignore + // @ts-ignore
private readonly _supportDeviceCodeFlow: boolean, private readonly _supportDeviceCodeFlow: boolean,
@@ -102,41 +82,2 @@ export class GitHubServer implements IGitHubServer { @@ -104,41 +83,2 @@ export class GitHubServer implements IGitHubServer {
- private async getRedirectEndpoint(): Promise<string> { - private async getRedirectEndpoint(): Promise<string> {
- if (this._redirectEndpoint) { - if (this._redirectEndpoint) {
@ -90,27 +94,27 @@ index 42e4354..cd6f27e 100644
- } - }
- -
dispose() { dispose() {
@@ -156,58 +97,8 @@ export class GitHubServer implements IGitHubServer { @@ -158,58 +98,8 @@ export class GitHubServer implements IGitHubServer {
let userCancelled: boolean | undefined; let userCancelled: boolean | undefined;
- const yes = vscode.l10n.t('Yes'); - const yes = localize('yes', "Yes");
- const no = vscode.l10n.t('No'); - const no = localize('no', "No");
- const promptToContinue = async () => { - const promptToContinue = async () => {
- if (userCancelled === undefined) { - if (userCancelled === undefined) {
- // We haven't had a failure yet so wait to prompt - // We haven't had a failure yet so wait to prompt
- return; - return;
- } - }
- const message = userCancelled - const message = userCancelled
- ? vscode.l10n.t('Having trouble logging in? Would you like to try a different way?') - ? localize('userCancelledMessage', "Having trouble logging in? Would you like to try a different way?")
- : vscode.l10n.t('otherReasonMessage', 'You have not yet finished authorizing this extension to use GitHub. Would you like to keep trying?'); - : localize('otherReasonMessage', "You have not yet finished authorizing this extension to use GitHub. Would you like to keep trying?");
- const result = await vscode.window.showWarningMessage(message, yes, no); - const result = await vscode.window.showWarningMessage(message, yes, no);
- if (result !== yes) { - if (result !== yes) {
- throw new Error('Cancelled'); - throw new Error('Cancelled');
- } - }
- }; - };
-
- const nonce = uuid(); - const nonce = uuid();
- const callbackUri = await vscode.env.asExternalUri(vscode.Uri.parse(`${vscode.env.uriScheme}://vscode.github-authentication/did-authenticate?nonce=${encodeURIComponent(nonce)}`)); - const callbackUri = await vscode.env.asExternalUri(vscode.Uri.parse(`${vscode.env.uriScheme}://vscode.github-authentication/did-authenticate?nonce=${encodeURIComponent(nonce)}`));
-
- const supported = isSupportedEnvironment(callbackUri); - const supported = isSupportedEnvironment(callbackUri);
- if (supported) { - if (supported) {
- try { - try {
@ -154,17 +158,13 @@ index 42e4354..cd6f27e 100644
+ this._logger.error(e); + this._logger.error(e);
+ userCancelled = e.message ?? e === 'User Cancelled'; + userCancelled = e.message ?? e === 'User Cancelled';
} }
@@ -217,136 +108,2 @@ export class GitHubServer implements IGitHubServer { @@ -219,127 +109,2 @@ export class GitHubServer implements IGitHubServer {
- private async doLoginWithoutLocalServer(scopes: string, nonce: string, callbackUri: vscode.Uri): Promise<string> { - private async doLoginWithoutLocalServer(scopes: string, nonce: string, callbackUri: vscode.Uri): Promise<string> {
- this._logger.info(`Trying without local server... (${scopes})`); - this._logger.info(`Trying without local server... (${scopes})`);
- return await vscode.window.withProgress<string>({ - return await vscode.window.withProgress<string>({
- location: vscode.ProgressLocation.Notification, - location: vscode.ProgressLocation.Notification,
- title: vscode.l10n.t({ - title: localize('signingIn', 'Signing in to {0}...', this.baseUri.authority),
- message: 'Signing in to {0}...',
- args: [this.baseUri.authority],
- comment: ['The {0} will be a url, e.g. github.com']
- }),
- cancellable: true - cancellable: true
- }, async (_, token) => { - }, async (_, token) => {
- const existingNonces = this._pendingNonces.get(scopes) || []; - const existingNonces = this._pendingNonces.get(scopes) || [];
@ -209,11 +209,7 @@ index 42e4354..cd6f27e 100644
- this._logger.info(`Trying with local server... (${scopes})`); - this._logger.info(`Trying with local server... (${scopes})`);
- return await vscode.window.withProgress<string>({ - return await vscode.window.withProgress<string>({
- location: vscode.ProgressLocation.Notification, - location: vscode.ProgressLocation.Notification,
- title: vscode.l10n.t({ - title: localize('signingInAnotherWay', "Signing in to {0}...", this.baseUri.authority),
- message: 'Signing in to {0}...',
- args: [this.baseUri.authority],
- comment: ['The {0} will be a url, e.g. github.com']
- }),
- cancellable: true - cancellable: true
- }, async (_, token) => { - }, async (_, token) => {
- const redirectUri = await this.getRedirectEndpoint(); - const redirectUri = await this.getRedirectEndpoint();
@ -270,15 +266,15 @@ index 42e4354..cd6f27e 100644
- -
- const json = await result.json() as IGitHubDeviceCodeResponse; - const json = await result.json() as IGitHubDeviceCodeResponse;
- -
- const button = vscode.l10n.t('Copy & Continue to GitHub'); -
- const modalResult = await vscode.window.showInformationMessage( - const modalResult = await vscode.window.showInformationMessage(
- vscode.l10n.t({ message: 'Your Code: {0}', args: [json.user_code], comment: ['The {0} will be a code, e.g. 123-456'] }), - localize('code.title', "Your Code: {0}", json.user_code),
- { - {
- modal: true, - modal: true,
- detail: vscode.l10n.t('To finish authenticating, navigate to GitHub and paste in the above one-time code.') - detail: localize('code.detail', "To finish authenticating, navigate to GitHub and paste in the above one-time code.")
- }, button); - }, 'Copy & Continue to GitHub');
- -
- if (modalResult !== button) { - if (modalResult !== 'Copy & Continue to GitHub') {
- throw new Error('User Cancelled'); - throw new Error('User Cancelled');
- } - }
- -
@ -289,9 +285,8 @@ index 42e4354..cd6f27e 100644
- -
- return await this.waitForDeviceCodeAccessToken(json); - return await this.waitForDeviceCodeAccessToken(json);
- } - }
-
private async doLoginWithPat(scopes: string): Promise<string> { @@ -368,121 +133,2 @@ export class GitHubServer implements IGitHubServer {
@@ -374,124 +131,2 @@ export class GitHubServer implements IGitHubServer {
- private async waitForDeviceCodeAccessToken( - private async waitForDeviceCodeAccessToken(
- json: IGitHubDeviceCodeResponse, - json: IGitHubDeviceCodeResponse,
@ -299,14 +294,11 @@ index 42e4354..cd6f27e 100644
- return await vscode.window.withProgress<string>({ - return await vscode.window.withProgress<string>({
- location: vscode.ProgressLocation.Notification, - location: vscode.ProgressLocation.Notification,
- cancellable: true, - cancellable: true,
- title: vscode.l10n.t({ - title: localize(
- message: 'Open [{0}]({0}) in a new tab and paste your one-time code: {1}', - 'progress',
- args: [json.verification_uri, json.user_code], - "Open [{0}]({0}) in a new tab and paste your one-time code: {1}",
- comment: [ - json.verification_uri,
- 'The [{0}]({0}) will be a url and the {1} will be a code, e.g. 123-456', - json.user_code)
- '{Locked="[{0}]({0})"}'
- ]
- })
- }, async (_, token) => { - }, async (_, token) => {
- const refreshTokenUri = this.baseUri.with({ - const refreshTokenUri = this.baseUri.with({
- path: '/login/oauth/access_token', - path: '/login/oauth/access_token',
@ -417,7 +409,7 @@ index 42e4354..cd6f27e 100644
- -
private getServerUri(path: string = '') { private getServerUri(path: string = '') {
diff --git a/src/vs/workbench/browser/parts/activitybar/activitybarActions.ts b/src/vs/workbench/browser/parts/activitybar/activitybarActions.ts diff --git a/src/vs/workbench/browser/parts/activitybar/activitybarActions.ts b/src/vs/workbench/browser/parts/activitybar/activitybarActions.ts
index ce2a3e8..2a5cf60 100644 index 1f16d17..61d5ccf 100644
--- a/src/vs/workbench/browser/parts/activitybar/activitybarActions.ts --- a/src/vs/workbench/browser/parts/activitybar/activitybarActions.ts
+++ b/src/vs/workbench/browser/parts/activitybar/activitybarActions.ts +++ b/src/vs/workbench/browser/parts/activitybar/activitybarActions.ts
@@ -306,3 +306,3 @@ export class AccountsActivityActionViewItem extends MenuActivityActionViewItem { @@ -306,3 +306,3 @@ export class AccountsActivityActionViewItem extends MenuActivityActionViewItem {
@ -426,10 +418,10 @@ index ce2a3e8..2a5cf60 100644
+ if (!menus.length) { + if (!menus.length) {
const noAccountsAvailableAction = disposables.add(new Action('noAccountsAvailable', localize('noAccounts', "You are not signed in to any accounts"), undefined, false)); const noAccountsAvailableAction = disposables.add(new Action('noAccountsAvailable', localize('noAccounts', "You are not signed in to any accounts"), undefined, false));
diff --git a/src/vs/workbench/services/authentication/browser/authenticationService.ts b/src/vs/workbench/services/authentication/browser/authenticationService.ts diff --git a/src/vs/workbench/services/authentication/browser/authenticationService.ts b/src/vs/workbench/services/authentication/browser/authenticationService.ts
index d5e2b75..a996eb7 100644 index 69cb0d2..920d6c6 100644
--- a/src/vs/workbench/services/authentication/browser/authenticationService.ts --- a/src/vs/workbench/services/authentication/browser/authenticationService.ts
+++ b/src/vs/workbench/services/authentication/browser/authenticationService.ts +++ b/src/vs/workbench/services/authentication/browser/authenticationService.ts
@@ -279,12 +279,2 @@ export class AuthenticationService extends Disposable implements IAuthentication @@ -275,12 +275,2 @@ export class AuthenticationService extends Disposable implements IAuthentication
} }
- -
- if (!this._authenticationProviders.size) { - if (!this._authenticationProviders.size) {

View File

@ -61,8 +61,6 @@
"fileSearchProvider", "fileSearchProvider",
"findTextInFiles", "findTextInFiles",
"notebookCellExecutionState", "notebookCellExecutionState",
"notebookContentProvider",
"notebookEditor",
"notebookLiveShare", "notebookLiveShare",
"terminalDimensions", "terminalDimensions",
"terminalDataWriteEvent", "terminalDataWriteEvent",
@ -76,13 +74,11 @@
"tunnels" "tunnels"
], ],
"ms-toolsai.vscode-ai-remote": [ "ms-toolsai.vscode-ai-remote": [
"resolvers", "resolvers"
"notebookEditor"
], ],
"ms-python.python": [ "ms-python.python": [
"quickPickSortByLabel", "quickPickSortByLabel",
"testObserver", "testObserver"
"localization"
], ],
"ms-dotnettools.dotnet-interactive-vscode": [ "ms-dotnettools.dotnet-interactive-vscode": [
"notebookMessaging" "notebookMessaging"
@ -101,8 +97,7 @@
"ms-vscode.azure-repos": [ "ms-vscode.azure-repos": [
"extensionRuntime", "extensionRuntime",
"fileSearchProvider", "fileSearchProvider",
"textSearchProvider", "textSearchProvider"
"localization"
], ],
"ms-vscode.remote-repositories": [ "ms-vscode.remote-repositories": [
"contribEditSessions", "contribEditSessions",
@ -120,8 +115,7 @@
"scmSelectedProvider", "scmSelectedProvider",
"scmValidation", "scmValidation",
"textSearchProvider", "textSearchProvider",
"timeline", "timeline"
"localization"
], ],
"ms-vscode-remote.remote-wsl": [ "ms-vscode-remote.remote-wsl": [
"resolvers", "resolvers",
@ -166,8 +160,7 @@
"commentsResolvedState", "commentsResolvedState",
"contribShareMenu", "contribShareMenu",
"contribCommentPeekContext", "contribCommentPeekContext",
"treeItemCheckbox", "treeItemCheckbox"
"localization"
], ],
"GitHub.copilot": [ "GitHub.copilot": [
"inlineCompletionsNew", "inlineCompletionsNew",
@ -190,8 +183,7 @@
"scmSelectedProvider", "scmSelectedProvider",
"scmValidation", "scmValidation",
"textSearchProvider", "textSearchProvider",
"timeline", "timeline"
"localization"
], ],
"ms-python.gather": [ "ms-python.gather": [
"notebookCellExecutionState" "notebookCellExecutionState"
@ -199,6 +191,9 @@
"ms-python.vscode-pylance": [ "ms-python.vscode-pylance": [
"notebookCellExecutionState" "notebookCellExecutionState"
], ],
"ms-toolsai.jupyter-renderers": [
"contribNotebookStaticPreloads"
],
"ms-toolsai.jupyter": [ "ms-toolsai.jupyter": [
"notebookControllerKind", "notebookControllerKind",
"notebookDeprecated", "notebookDeprecated",
@ -209,11 +204,11 @@
"quickPickSortByLabel", "quickPickSortByLabel",
"notebookKernelSource", "notebookKernelSource",
"interactiveWindow", "interactiveWindow",
"notebookControllerAffinityHidden" "notebookControllerAffinityHidden",
"contribNotebookStaticPreloads"
], ],
"dbaeumer.vscode-eslint": [ "dbaeumer.vscode-eslint": [
"notebookCellExecutionState", "notebookCellExecutionState"
"localization"
], ],
"ms-vscode.azure-sphere-tools-ui": [ "ms-vscode.azure-sphere-tools-ui": [
"resolvers", "resolvers",
@ -227,9 +222,6 @@
], ],
"ms-vscode.cpptools": [ "ms-vscode.cpptools": [
"terminalDataWriteEvent" "terminalDataWriteEvent"
],
"ms-vscode.vscode-github-issue-notebooks": [
"localization"
] ]
}, },
"extensionKind": { "extensionKind": {