diff --git a/patches/use-github-pat.patch b/patches/use-github-pat.patch index b1475bb..8aa6af0 100644 --- a/patches/use-github-pat.patch +++ b/patches/use-github-pat.patch @@ -1,18 +1,22 @@ 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 +++ 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 { v4 as uuid } from 'uuid'; -import { PromiseAdapter, promiseFromEvent } from './common/utils'; 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 { isSupportedEnvironment } from './common/env'; -import { LoopbackAuthServer } from './authServer'; -import path = require('path'); -- + +-const localize = nls.loadMessageBundle(); -const CLIENT_ID = '01ab8ac9400c4e429b23'; -const GITHUB_TOKEN_URL = 'https://vscode.dev/codeExchangeProxyEndpoints/github/login/oauth/access_token'; const NETWORK_ERROR = 'network error'; @@ -21,7 +25,7 @@ index 42e4354..cd6f27e 100644 -const REDIRECT_URL_INSIDERS = 'https://insiders.vscode.dev/redirect'; - 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 { - device_code: string; @@ -31,12 +35,12 @@ index 42e4354..cd6f27e 100644 -} - 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}`, - 'User-Agent': 'Visual-Studio-Code' + '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 _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 _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, + // @ts-ignore 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> { - if (this._redirectEndpoint) { @@ -90,27 +94,27 @@ index 42e4354..cd6f27e 100644 - } - dispose() { -@@ -156,58 +97,8 @@ export class GitHubServer implements IGitHubServer { +@@ -158,58 +98,8 @@ export class GitHubServer implements IGitHubServer { let userCancelled: boolean | undefined; -- const yes = vscode.l10n.t('Yes'); -- const no = vscode.l10n.t('No'); +- const yes = localize('yes', "Yes"); +- const no = localize('no', "No"); - const promptToContinue = async () => { - if (userCancelled === undefined) { - // We haven't had a failure yet so wait to prompt - return; - } - const message = userCancelled -- ? vscode.l10n.t('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('userCancelledMessage', "Having trouble logging in? Would you like to try a different way?") +- : 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); - if (result !== yes) { - throw new Error('Cancelled'); - } - }; -- + - const nonce = uuid(); - const callbackUri = await vscode.env.asExternalUri(vscode.Uri.parse(`${vscode.env.uriScheme}://vscode.github-authentication/did-authenticate?nonce=${encodeURIComponent(nonce)}`)); - +- - const supported = isSupportedEnvironment(callbackUri); - if (supported) { - try { @@ -154,17 +158,13 @@ index 42e4354..cd6f27e 100644 + this._logger.error(e); + 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> { - this._logger.info(`Trying without local server... (${scopes})`); - return await vscode.window.withProgress<string>({ - location: vscode.ProgressLocation.Notification, -- title: vscode.l10n.t({ -- message: 'Signing in to {0}...', -- args: [this.baseUri.authority], -- comment: ['The {0} will be a url, e.g. github.com'] -- }), +- title: localize('signingIn', 'Signing in to {0}...', this.baseUri.authority), - cancellable: true - }, async (_, token) => { - const existingNonces = this._pendingNonces.get(scopes) || []; @@ -209,11 +209,7 @@ index 42e4354..cd6f27e 100644 - this._logger.info(`Trying with local server... (${scopes})`); - return await vscode.window.withProgress<string>({ - location: vscode.ProgressLocation.Notification, -- title: vscode.l10n.t({ -- message: 'Signing in to {0}...', -- args: [this.baseUri.authority], -- comment: ['The {0} will be a url, e.g. github.com'] -- }), +- title: localize('signingInAnotherWay', "Signing in to {0}...", this.baseUri.authority), - cancellable: true - }, async (_, token) => { - const redirectUri = await this.getRedirectEndpoint(); @@ -270,15 +266,15 @@ index 42e4354..cd6f27e 100644 - - const json = await result.json() as IGitHubDeviceCodeResponse; - -- const button = vscode.l10n.t('Copy & Continue to GitHub'); +- - 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, -- detail: vscode.l10n.t('To finish authenticating, navigate to GitHub and paste in the above one-time code.') -- }, button); +- detail: localize('code.detail', "To finish authenticating, navigate to GitHub and paste in the above one-time code.") +- }, 'Copy & Continue to GitHub'); - -- if (modalResult !== button) { +- if (modalResult !== 'Copy & Continue to GitHub') { - throw new Error('User Cancelled'); - } - @@ -289,9 +285,8 @@ index 42e4354..cd6f27e 100644 - - return await this.waitForDeviceCodeAccessToken(json); - } -- - private async doLoginWithPat(scopes: string): Promise<string> { -@@ -374,124 +131,2 @@ export class GitHubServer implements IGitHubServer { + +@@ -368,121 +133,2 @@ export class GitHubServer implements IGitHubServer { - private async waitForDeviceCodeAccessToken( - json: IGitHubDeviceCodeResponse, @@ -299,14 +294,11 @@ index 42e4354..cd6f27e 100644 - return await vscode.window.withProgress<string>({ - location: vscode.ProgressLocation.Notification, - cancellable: true, -- title: vscode.l10n.t({ -- message: 'Open [{0}]({0}) in a new tab and paste your one-time code: {1}', -- args: [json.verification_uri, json.user_code], -- comment: [ -- 'The [{0}]({0}) will be a url and the {1} will be a code, e.g. 123-456', -- '{Locked="[{0}]({0})"}' -- ] -- }) +- title: localize( +- 'progress', +- "Open [{0}]({0}) in a new tab and paste your one-time code: {1}", +- json.verification_uri, +- json.user_code) - }, async (_, token) => { - const refreshTokenUri = this.baseUri.with({ - path: '/login/oauth/access_token', @@ -417,7 +409,7 @@ index 42e4354..cd6f27e 100644 - private getServerUri(path: string = '') { 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 +++ b/src/vs/workbench/browser/parts/activitybar/activitybarActions.ts @@ -306,3 +306,3 @@ export class AccountsActivityActionViewItem extends MenuActivityActionViewItem { @@ -426,10 +418,10 @@ index ce2a3e8..2a5cf60 100644 + if (!menus.length) { 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 -index d5e2b75..a996eb7 100644 +index 69cb0d2..920d6c6 100644 --- a/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) { diff --git a/product.json b/product.json index 2390ff1..9084af7 100644 --- a/product.json +++ b/product.json @@ -61,8 +61,6 @@ "fileSearchProvider", "findTextInFiles", "notebookCellExecutionState", - "notebookContentProvider", - "notebookEditor", "notebookLiveShare", "terminalDimensions", "terminalDataWriteEvent", @@ -76,13 +74,11 @@ "tunnels" ], "ms-toolsai.vscode-ai-remote": [ - "resolvers", - "notebookEditor" + "resolvers" ], "ms-python.python": [ "quickPickSortByLabel", - "testObserver", - "localization" + "testObserver" ], "ms-dotnettools.dotnet-interactive-vscode": [ "notebookMessaging" @@ -101,8 +97,7 @@ "ms-vscode.azure-repos": [ "extensionRuntime", "fileSearchProvider", - "textSearchProvider", - "localization" + "textSearchProvider" ], "ms-vscode.remote-repositories": [ "contribEditSessions", @@ -120,8 +115,7 @@ "scmSelectedProvider", "scmValidation", "textSearchProvider", - "timeline", - "localization" + "timeline" ], "ms-vscode-remote.remote-wsl": [ "resolvers", @@ -166,8 +160,7 @@ "commentsResolvedState", "contribShareMenu", "contribCommentPeekContext", - "treeItemCheckbox", - "localization" + "treeItemCheckbox" ], "GitHub.copilot": [ "inlineCompletionsNew", @@ -190,8 +183,7 @@ "scmSelectedProvider", "scmValidation", "textSearchProvider", - "timeline", - "localization" + "timeline" ], "ms-python.gather": [ "notebookCellExecutionState" @@ -199,6 +191,9 @@ "ms-python.vscode-pylance": [ "notebookCellExecutionState" ], + "ms-toolsai.jupyter-renderers": [ + "contribNotebookStaticPreloads" + ], "ms-toolsai.jupyter": [ "notebookControllerKind", "notebookDeprecated", @@ -209,11 +204,11 @@ "quickPickSortByLabel", "notebookKernelSource", "interactiveWindow", - "notebookControllerAffinityHidden" + "notebookControllerAffinityHidden", + "contribNotebookStaticPreloads" ], "dbaeumer.vscode-eslint": [ - "notebookCellExecutionState", - "localization" + "notebookCellExecutionState" ], "ms-vscode.azure-sphere-tools-ui": [ "resolvers", @@ -227,9 +222,6 @@ ], "ms-vscode.cpptools": [ "terminalDataWriteEvent" - ], - "ms-vscode.vscode-github-issue-notebooks": [ - "localization" ] }, "extensionKind": {