mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-15 18:46:36 -05:00
Merge from vscode 709a07d51919d3266ca71699c6ddfb2d3547c0e1 (#6575)
This commit is contained in:
@@ -61,6 +61,7 @@ export interface IBrowserWindowConfiguration {
|
||||
workspaceId: string;
|
||||
remoteAuthority?: string;
|
||||
webviewEndpoint?: string;
|
||||
connectionToken?: string;
|
||||
}
|
||||
|
||||
export class BrowserWorkbenchEnvironmentService implements IEnvironmentService {
|
||||
@@ -81,6 +82,7 @@ export class BrowserWorkbenchEnvironmentService implements IEnvironmentService {
|
||||
this.localeResource = joinPath(this.userRoamingDataHome, 'locale.json');
|
||||
this.backupHome = joinPath(this.userRoamingDataHome, BACKUPS);
|
||||
this.configuration.backupWorkspaceResource = joinPath(this.backupHome, configuration.workspaceId);
|
||||
this.configuration.connectionToken = configuration.connectionToken || this.getConnectionTokenFromLocation();
|
||||
|
||||
this.logsPath = '/web/logs';
|
||||
|
||||
@@ -182,4 +184,21 @@ export class BrowserWorkbenchEnvironmentService implements IEnvironmentService {
|
||||
get webviewCspSource(): string {
|
||||
return this.webviewEndpoint ? this.webviewEndpoint : 'vscode-resource:';
|
||||
}
|
||||
|
||||
private getConnectionTokenFromLocation(): string | undefined {
|
||||
// TODO: Check with @alexd where the token will be: search or hash?
|
||||
let connectionToken: string | undefined = undefined;
|
||||
if (document.location.search) {
|
||||
connectionToken = this.getConnectionToken(document.location.search);
|
||||
}
|
||||
if (!connectionToken && document.location.hash) {
|
||||
connectionToken = this.getConnectionToken(document.location.hash);
|
||||
}
|
||||
return connectionToken;
|
||||
}
|
||||
|
||||
private getConnectionToken(str: string): string | undefined {
|
||||
const m = str.match(/[#&]tkn=([^&]+)/);
|
||||
return m ? m[1] : undefined;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user