more staging detection (#121769)

* more staging detection

* check for scheme
This commit is contained in:
João Moreno 2021-04-20 22:19:06 +02:00 committed by GitHub
parent ad3e7ea1c0
commit 7b23ff442e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -81,7 +81,9 @@ export class GitHubServer {
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`);
// TODO@joaomoreno TODO@RMacfarlane
const staging = callbackUri.scheme === 'https' && /^vscode\./.test(callbackUri.authority);
const uri = vscode.Uri.parse(`https://${staging ? AUTH_RELAY_STAGING_SERVER : AUTH_RELAY_SERVER}/authorize/?callbackUri=${encodeURIComponent(callbackUri.toString())}&scope=${scopes}&state=${state}&responseType=code&authServer=https://github.com${staging ? '&staging=true' : ''}`);
await vscode.env.openExternal(uri);
}