@@ -111,7 +111,18 @@ Index: code-server/lib/vscode/src/vs/server/node/webClientServer.ts
111
111
===================================================================
112
112
--- code-server.orig/lib/vscode/src/vs/server/node/webClientServer.ts
113
113
+++ code-server/lib/vscode/src/vs/server/node/webClientServer.ts
114
- @@ -285,10 +285,14 @@ export class WebClientServer {
114
+ @@ -246,7 +246,9 @@ export class WebClientServer {
115
+ };
116
+
117
+ // Prefix routes with basePath for clients
118
+ - const basePath = getFirstHeader('x-forwarded-prefix') || this._basePath;
119
+ + const rootBase = relativeRoot(getOriginalUrl(req))
120
+ + const vscodeBase = relativePath(getOriginalUrl(req))
121
+ + const basePath = vscodeBase || getFirstHeader('x-forwarded-prefix') || this._basePath;
122
+
123
+ const queryConnectionToken = parsedUrl.query[connectionTokenQueryName];
124
+ if (typeof queryConnectionToken === 'string') {
125
+ @@ -285,10 +287,14 @@ export class WebClientServer {
115
126
};
116
127
117
128
const useTestResolver = (!this._environmentService.isBuilt && this._environmentService.args['use-test-resolver']);
@@ -127,43 +138,26 @@ Index: code-server/lib/vscode/src/vs/server/node/webClientServer.ts
127
138
);
128
139
if (!remoteAuthority) {
129
140
return serveError(req, res, 400, `Bad request.`);
130
- @@ -333,8 +337,12 @@ export class WebClientServer {
131
- scopes: [['user:email'], ['repo']]
132
- } : undefined;
141
+ @@ -335,6 +341,7 @@ export class WebClientServer {
133
142
134
- + const base = relativeRoot(getOriginalUrl(req))
135
- + const vscodeBase = relativePath(getOriginalUrl(req))
136
- +
137
143
const productConfiguration = {
138
144
codeServerVersion: this._productService.codeServerVersion,
139
- + rootEndpoint: base ,
145
+ + rootEndpoint: rootBase ,
140
146
embedderIdentifier: 'server-distro',
141
147
extensionsGallery: this._webExtensionResourceUrlTemplate && this._productService.extensionsGallery ? {
142
148
...this._productService.extensionsGallery,
143
- @@ -363,7 +371,7 @@ export class WebClientServer {
144
- folderUri: resolveWorkspaceURI(this._environmentService.args['default-folder']),
145
- workspaceUri: resolveWorkspaceURI(this._environmentService.args['default-workspace']),
146
- productConfiguration,
147
- - callbackRoute: callbackRoute
148
- + callbackRoute: vscodeBase + callbackRoute
149
- };
150
-
151
- const cookies = cookie.parse(req.headers.cookie || '');
152
- @@ -380,9 +388,11 @@ export class WebClientServer {
153
- const values: { [key: string]: string } = {
154
- WORKBENCH_WEB_CONFIGURATION: asJSON(workbenchWebConfiguration),
149
+ @@ -382,7 +389,9 @@ export class WebClientServer {
155
150
WORKBENCH_AUTH_SESSION: authSessionInfo ? asJSON(authSessionInfo) : '',
156
- - WORKBENCH_WEB_BASE_URL: staticRoute,
157
- + WORKBENCH_WEB_BASE_URL: vscodeBase + staticRoute,
151
+ WORKBENCH_WEB_BASE_URL: staticRoute,
158
152
WORKBENCH_NLS_URL,
159
153
- WORKBENCH_NLS_FALLBACK_URL: `${staticRoute}/out/nls.messages.js`
160
- + WORKBENCH_NLS_FALLBACK_URL: `${vscodeBase}${ staticRoute}/out/nls.messages.js`,
161
- + BASE: base ,
162
- + VS_BASE: vscodeBase ,
154
+ + WORKBENCH_NLS_FALLBACK_URL: `${staticRoute}/out/nls.messages.js`,
155
+ + BASE: rootBase ,
156
+ + VS_BASE: basePath ,
163
157
};
164
158
165
159
// DEV ---------------------------------------------------------------------------------------
166
- @@ -419,7 +429 ,7 @@ export class WebClientServer {
160
+ @@ -419,7 +428 ,7 @@ export class WebClientServer {
167
161
'default-src \'self\';',
168
162
'img-src \'self\' https: data: blob:;',
169
163
'media-src \'self\';',
@@ -172,7 +166,7 @@ Index: code-server/lib/vscode/src/vs/server/node/webClientServer.ts
172
166
'child-src \'self\';',
173
167
`frame-src 'self' https://*.vscode-cdn.net data:;`,
174
168
'worker-src \'self\' data: blob:;',
175
- @@ -492,3 +502 ,70 @@ export class WebClientServer {
169
+ @@ -492,3 +501 ,70 @@ export class WebClientServer {
176
170
return void res.end(data);
177
171
}
178
172
}
0 commit comments