Skip to content

Commit

Permalink
Add VSCODE_PROXY_URI to resolver env
Browse files Browse the repository at this point in the history
Closes coder#1510.
  • Loading branch information
code-asher committed Aug 25, 2021
1 parent cfd9faf commit e337741
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import { RemoteAuthorities } from 'vs/base/common/network';
import { URI } from 'vs/base/common/uri';
import { Emitter } from 'vs/base/common/event';
import { Disposable } from 'vs/base/common/lifecycle';
import { Options } from 'vs/ipc';
import { getOptions } from 'vs/server/common/util';

export class RemoteAuthorityResolverService extends Disposable implements IRemoteAuthorityResolverService {

Expand Down Expand Up @@ -59,11 +61,14 @@ export class RemoteAuthorityResolverService extends Disposable implements IRemot

private _doResolveAuthority(authority: string): ResolverResult {
const connectionToken = this._connectionTokens.get(authority) || this._connectionToken;
// NOTE@coder: Add the proxy URI to the environment for use in the remote.
const options = getOptions<Options>();
const extensionHostEnv = { VSCODE_PROXY_URI: `${window.location.origin}${options.base}/proxy/{port}` };
if (authority.indexOf(':') >= 0) {
const pieces = authority.split(':');
return { authority: { authority, host: pieces[0], port: parseInt(pieces[1], 10), connectionToken } };
return { authority: { authority, host: pieces[0], port: parseInt(pieces[1], 10), connectionToken }, options: { extensionHostEnv } };
}
return { authority: { authority, host: authority, port: 80, connectionToken } };
return { authority: { authority, host: authority, port: 80, connectionToken }, options: { extensionHostEnv } };
}

_clearResolvedAuthority(authority: string): void {
Expand Down

0 comments on commit e337741

Please sign in to comment.