Skip to content

Commit

Permalink
fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
jsjoeio committed Oct 7, 2022
1 parent 4c8b9f0 commit 39be51a
Showing 1 changed file with 14 additions and 16 deletions.
30 changes: 14 additions & 16 deletions patches/proxy-uri.diff
Original file line number Diff line number Diff line change
Expand Up @@ -74,17 +74,26 @@ Index: code-server/lib/vscode/src/vs/server/node/webClientServer.ts
===================================================================
--- code-server.orig/lib/vscode/src/vs/server/node/webClientServer.ts
+++ code-server/lib/vscode/src/vs/server/node/webClientServer.ts
@@ -314,10 +314,12 @@ export class WebClientServer {
@@ -300,6 +300,8 @@ export class WebClientServer {
const base = relativeRoot(getOriginalUrl(req))
const vscodeBase = relativePath(getOriginalUrl(req))

+ console.log("web client server, ", this._environmentService.args)
+
const workbenchWebConfiguration = {
remoteAuthority,
webviewEndpoint: vscodeBase + this._staticRoute + '/out/vs/workbench/contrib/webview/browser/pre',
@@ -314,10 +316,12 @@ export class WebClientServer {
rootEndpoint: base,
updateEndpoint: !this._environmentService.args['disable-update-check'] ? base + '/update/check' : undefined,
logoutEndpoint: this._environmentService.args['auth'] && this._environmentService.args['auth'] !== "none" ? base + '/logout' : undefined,
+ proxyEndpointTemplate: base + '/proxy/{{port}}',
+ proxyDomain: this._environmentService.args['proxyDomain'] ? `{{port}}.${this._environmentService.args['proxyDomain'][0]}` : undefined,
embedderIdentifier: 'server-distro',
extensionsGallery: this._productService.extensionsGallery,
},
- callbackRoute: this._callbackRoute
+ callbackRoute: this._callbackRoute,
+ proxyDomain: this._environmentService.args['proxyDomain'] ? `{{port}}.${this._environmentService.args['proxyDomain']}` : undefined
};

const nlsBaseUrl = this._productService.extensionsGallery?.nlsBaseUrl;
Expand Down Expand Up @@ -126,7 +135,7 @@ Index: code-server/lib/vscode/src/vs/code/browser/workbench/workbench.ts

interface ICredential {
service: string;
@@ -507,6 +508,21 @@ function doCreateUri(path: string, query
@@ -507,6 +508,23 @@ function doCreateUri(path: string, query
} : undefined,
workspaceProvider: WorkspaceProvider.create(config),
urlCallbackProvider: new LocalStorageURLCallbackProvider(config.callbackRoute),
Expand All @@ -136,8 +145,10 @@ Index: code-server/lib/vscode/src/vs/code/browser/workbench/workbench.ts
+ let resolvedUri = uri
+ const localhostMatch = extractLocalHostUriMetaDataForPortMapping(uri)
+
+ console.log(config.proxyDomain, "proxyDomain where you at", config.productConfiguration?.proxyDomain)
+ if (localhostMatch) {
+ if (config.productConfiguration && config.productConfiguration.proxyEndpointTemplate) {
+ // TODO@jsjoeio here we need to check about proxyDomain
+ resolvedUri = URI.parse(new URL(config.productConfiguration.proxyEndpointTemplate.replace('{{port}}', localhostMatch.port.toString()), window.location.href).toString())
+ } else {
+ throw new Error(`Failed to resolve external URI: ${uri.toString()}. Could not determine base url because productConfiguration missing.`)
Expand All @@ -149,19 +160,6 @@ Index: code-server/lib/vscode/src/vs/code/browser/workbench/workbench.ts
+ }
});
})();
Index: code-server/lib/vscode/src/vs/workbench/browser/web.api.ts
===================================================================
--- code-server.orig/lib/vscode/src/vs/workbench/browser/web.api.ts
+++ code-server/lib/vscode/src/vs/workbench/browser/web.api.ts
@@ -328,6 +328,8 @@ export interface IWorkbenchConstructionO

//#endregion

+ readonly proxyDomain?: string;
+
}

export interface IResourceUriProvider {
Index: code-server/lib/vscode/src/vs/server/node/serverEnvironmentService.ts
===================================================================
--- code-server.orig/lib/vscode/src/vs/server/node/serverEnvironmentService.ts
Expand Down

0 comments on commit 39be51a

Please sign in to comment.