Skip to content

Commit 93da30b

Browse files
committed
Update patches to support VS Code version 1.90.1
1 parent 0d30318 commit 93da30b

File tree

2 files changed

+64
-30
lines changed

2 files changed

+64
-30
lines changed

patches/base-path.diff

Lines changed: 52 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -65,18 +65,40 @@ Index: sagemaker-code-editor/vscode/src/vs/code/browser/workbench/workbench.ts
6565
}
6666

6767
private startListening(): void {
68+
@@ -550,17 +551,6 @@ class WorkspaceProvider implements IWork
69+
}
70+
}
71+
72+
-function readCookie(name: string): string | undefined {
73+
- const cookies = document.cookie.split('; ');
74+
- for (const cookie of cookies) {
75+
- if (cookie.startsWith(name + '=')) {
76+
- return cookie.substring(name.length + 1);
77+
- }
78+
- }
79+
-
80+
- return undefined;
81+
-}
82+
-
83+
(function () {
84+
85+
// Find config by checking for DOM
86+
@@ -569,8 +559,8 @@ function readCookie(name: string): strin
87+
if (!configElement || !configElementAttribute) {
88+
throw new Error('Missing web configuration element');
89+
}
90+
- const config: IWorkbenchConstructionOptions & { folderUri?: UriComponents; workspaceUri?: UriComponents; callbackRoute: string } = JSON.parse(configElementAttribute);
91+
- const secretStorageKeyPath = readCookie('vscode-secret-key-path');
92+
+ const config: IWorkbenchConstructionOptions & { folderUri?: UriComponents; workspaceUri?: UriComponents; callbackRoute: string } = { ...JSON.parse(configElementAttribute), remoteAuthority: location.host }
93+
+ const secretStorageKeyPath = (window.location.pathname + "/mint-key").replace(/\/\/+/g, "/");
94+
const secretStorageCrypto = secretStorageKeyPath && ServerKeyedAESCrypto.supported()
95+
? new ServerKeyedAESCrypto(secretStorageKeyPath) : new TransparentCrypto();
96+
97+
6898
Index: sagemaker-code-editor/vscode/src/vs/platform/extensionResourceLoader/common/extensionResourceLoader.ts
6999
===================================================================
70100
--- sagemaker-code-editor.orig/vscode/src/vs/platform/extensionResourceLoader/common/extensionResourceLoader.ts
71101
+++ sagemaker-code-editor/vscode/src/vs/platform/extensionResourceLoader/common/extensionResourceLoader.ts
72-
@@ -16,7 +16,6 @@ import { getServiceMachineId } from 'vs/
73-
import { IStorageService } from 'vs/platform/storage/common/storage';
74-
import { TelemetryLevel } from 'vs/platform/telemetry/common/telemetry';
75-
import { getTelemetryLevel, supportsTelemetry } from 'vs/platform/telemetry/common/telemetryUtils';
76-
-import { RemoteAuthorities } from 'vs/base/common/network';
77-
import { TargetPlatform } from 'vs/platform/extensions/common/extensions';
78-
79-
const WEB_EXTENSION_RESOURCE_END_POINT_SEGMENT = '/web-extension-resource/';
80102
@@ -99,7 +98,7 @@ export abstract class AbstractExtensionR
81103
: version,
82104
path: 'extension'
@@ -102,39 +124,29 @@ Index: sagemaker-code-editor/vscode/src/vs/server/node/webClientServer.ts
102124
===================================================================
103125
--- sagemaker-code-editor.orig/vscode/src/vs/server/node/webClientServer.ts
104126
+++ sagemaker-code-editor/vscode/src/vs/server/node/webClientServer.ts
105-
@@ -270,16 +270,15 @@ export class WebClientServer {
106-
return void res.end();
107-
}
108-
109-
- const getFirstHeader = (headerName: string) => {
110-
- const val = req.headers[headerName];
111-
- return Array.isArray(val) ? val[0] : val;
112-
- };
113-
-
114-
const useTestResolver = (!this._environmentService.isBuilt && this._environmentService.args['use-test-resolver']);
115-
+ // For now we are getting the remote authority from the client to avoid
116-
+ // needing specific configuration for reverse proxies to work. Set this to
117-
+ // something invalid to make sure we catch code that is using this value
118-
+ // from the backend when it should not.
127+
@@ -278,7 +278,7 @@ export class WebClientServer {
119128
const remoteAuthority = (
120129
useTestResolver
121130
? 'test+test'
122131
- : (getFirstHeader('x-original-host') || getFirstHeader('x-forwarded-host') || req.headers.host)
123-
+ : 'remote'
132+
+ : (getFirstHeader('x-original-host') || getFirstHeader('x-forwarded-host') || req.headers.host || window.location.host)
124133
);
125134
if (!remoteAuthority) {
126135
return serveError(req, res, 400, `Bad request.`);
127-
@@ -306,6 +305,9 @@ export class WebClientServer {
136+
@@ -305,7 +305,12 @@ export class WebClientServer {
128137
scopes: [['user:email'], ['repo']]
129138
} : undefined;
130-
131-
+ const base = relativeRoot(getOriginalUrl(req))
132-
+ const vscodeBase = relativePath(getOriginalUrl(req))
139+
140+
+ const basePath: string = this._environmentService.args['server-base-path'] || "/"
141+
+ const base = relativeRoot(basePath)
142+
+ const vscodeBase = relativePath(basePath)
133143
+
134144
const productConfiguration = {
145+
+ rootEndpoint: base,
135146
embedderIdentifier: 'server-distro',
136147
extensionsGallery: this._webExtensionResourceUrlTemplate && this._productService.extensionsGallery ? {
137-
@@ -342,8 +344,10 @@ export class WebClientServer {
148+
...this._productService.extensionsGallery,
149+
@@ -340,8 +345,10 @@ export class WebClientServer {
138150
const values: { [key: string]: string } = {
139151
WORKBENCH_WEB_CONFIGURATION: asJSON(workbenchWebConfiguration),
140152
WORKBENCH_AUTH_SESSION: authSessionInfo ? asJSON(authSessionInfo) : '',
@@ -147,12 +159,11 @@ Index: sagemaker-code-editor/vscode/src/vs/server/node/webClientServer.ts
147159
};
148160

149161
if (useTestResolver) {
150-
@@ -443,3 +447,60 @@ export class WebClientServer {
162+
@@ -443,3 +445,70 @@ export class WebClientServer {
151163
return void res.end(data);
152164
}
153165
}
154166
+
155-
+
156167
+/**
157168
+ * Remove extra slashes in a URL.
158169
+ *
@@ -208,6 +219,17 @@ Index: sagemaker-code-editor/vscode/src/vs/server/node/webClientServer.ts
208219
+ const parts = originalUrl.split("?", 1)[0].split("/")
209220
+ return normalizeUrlPath("./" + parts[parts.length - 1])
210221
+}
222+
+
223+
+/**
224+
+ * code-server serves Code using Express. Express removes the base from the url
225+
+ * and puts the original in `originalUrl` so we must use this to get the correct
226+
+ * depth. Code is not aware it is behind Express so the types do not match. We
227+
+ * may want to continue moving code into Code and eventually remove the Express
228+
+ * wrapper or move the web server back into code-server.
229+
+ */
230+
+export const getOriginalUrl = (req: http.IncomingMessage): string => {
231+
+ return (req as any).originalUrl || req.url
232+
+}
211233
Index: sagemaker-code-editor/vscode/src/vs/server/node/serverEnvironmentService.ts
212234
===================================================================
213235
--- sagemaker-code-editor.orig/vscode/src/vs/server/node/serverEnvironmentService.ts

patches/sagemaker-extension.diff

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,18 @@ Index: sagemaker-code-editor/vscode/extensions/sagemaker-extension/package.json
258258
+ "repository": {
259259
+ }
260260
+}
261+
Index: sagemaker-code-editor/vscode/build/gulpfile.extensions.js
262+
===================================================================
263+
--- sagemaker-code-editor.orig/vscode/build/gulpfile.extensions.js
264+
+++ sagemaker-code-editor/vscode/build/gulpfile.extensions.js
265+
@@ -63,6 +63,7 @@ const compilations = [
266+
'extensions/references-view/tsconfig.json',
267+
'extensions/search-result/tsconfig.json',
268+
'extensions/simple-browser/tsconfig.json',
269+
+ 'extensions/sagemaker-extension/tsconfig.json',
270+
'extensions/tunnel-forwarding/tsconfig.json',
271+
'extensions/typescript-language-features/test-workspace/tsconfig.json',
272+
'extensions/typescript-language-features/web/tsconfig.json',
261273
Index: sagemaker-code-editor/vscode/extensions/sagemaker-extension/README.md
262274
===================================================================
263275
--- /dev/null

0 commit comments

Comments
 (0)