diff --git a/patches/use-github-pat.patch b/patches/use-github-pat.patch index a4f9793..e3805a8 100644 --- a/patches/use-github-pat.patch +++ b/patches/use-github-pat.patch @@ -1,5 +1,5 @@ diff --git a/extensions/github-authentication/src/githubServer.ts b/extensions/github-authentication/src/githubServer.ts -index f292b3a..1010092 100644 +index 8565178..e35d29f 100644 --- a/extensions/github-authentication/src/githubServer.ts +++ b/extensions/github-authentication/src/githubServer.ts @@ -6,4 +6,2 @@ @@ -22,7 +22,7 @@ index f292b3a..1010092 100644 -const REDIRECT_URL_INSIDERS = 'https://insiders.vscode.dev/redirect'; - export interface IGitHubServer { -@@ -30,9 +20,2 @@ export interface IGitHubServer { +@@ -30,8 +20,2 @@ export interface IGitHubServer { -interface IGitHubDeviceCodeResponse { - device_code: string; @@ -30,9 +30,8 @@ index f292b3a..1010092 100644 - verification_uri: string; - interval: number; -} -- - async function getScopes(token: string, serverUri: vscode.Uri, logger: Log): Promise { -@@ -63,8 +46,4 @@ export class GitHubServer implements IGitHubServer { + +@@ -63,8 +47,4 @@ export class GitHubServer implements IGitHubServer { - private readonly _pendingNonces = new Map(); - private readonly _codeExchangePromises = new Map; cancel: vscode.EventEmitter }>(); @@ -41,13 +40,13 @@ index f292b3a..1010092 100644 - private _redirectEndpoint: string | undefined; - constructor( -@@ -72,3 +51,5 @@ export class GitHubServer implements IGitHubServer { +@@ -72,3 +52,5 @@ export class GitHubServer implements IGitHubServer { private readonly _telemetryReporter: ExperimentationTelemetry, + // @ts-ignore private readonly _uriHandler: UriEventHandler, + // @ts-ignore private readonly _extensionKind: vscode.ExtensionKind, -@@ -87,41 +68,2 @@ export class GitHubServer implements IGitHubServer { +@@ -87,41 +69,2 @@ export class GitHubServer implements IGitHubServer { - private async getRedirectEndpoint(): Promise { - if (this._redirectEndpoint) { @@ -89,7 +88,7 @@ index f292b3a..1010092 100644 - } - // TODO@joaomoreno TODO@TylerLeonhardt -@@ -137,64 +79,8 @@ export class GitHubServer implements IGitHubServer { +@@ -137,57 +80,2 @@ export class GitHubServer implements IGitHubServer { let userCancelled: boolean | undefined; - const yes = vscode.l10n.t('Yes'); - const no = vscode.l10n.t('No'); @@ -109,7 +108,7 @@ index f292b3a..1010092 100644 - - const nonce: string = crypto.getRandomValues(new Uint32Array(2)).reduce((prev, curr) => prev += curr.toString(16), ''); - 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 { @@ -145,7 +144,11 @@ index f292b3a..1010092 100644 - this._logger.error(e); - userCancelled = e.message ?? e === 'User Cancelled'; - } -- } else if (!supported) { +- } + +@@ -195,10 +83,7 @@ export class GitHubServer implements IGitHubServer { + // With that said, GitHub Enterprise isn't used by Settings Sync so we can use PATs for that. +- if (!supported || this._type === AuthProviderType.githubEnterprise) { - try { - await promptToContinue(); - return await this.doLoginWithPat(scopes); @@ -159,7 +162,7 @@ index f292b3a..1010092 100644 + this._logger.error(e); + userCancelled = e.message ?? e === 'User Cancelled'; } -@@ -204,135 +90,2 @@ export class GitHubServer implements IGitHubServer { +@@ -208,136 +93,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})`); @@ -294,8 +297,9 @@ index f292b3a..1010092 100644 - - return await this.waitForDeviceCodeAccessToken(json); - } - -@@ -361,124 +114,2 @@ export class GitHubServer implements IGitHubServer { +- + private async doLoginWithPat(scopes: string): Promise { +@@ -381,124 +132,2 @@ export class GitHubServer implements IGitHubServer { - private async waitForDeviceCodeAccessToken( - json: IGitHubDeviceCodeResponse,