From f83019b505ecdbef147fd3bdb43071c20eab25bc Mon Sep 17 00:00:00 2001 From: Austin Jang Date: Wed, 1 Oct 2025 13:36:04 -0700 Subject: [PATCH 1/3] Remove module type from service worker and update sha --- patches/webview.diff | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/patches/webview.diff b/patches/webview.diff index 25f77c266..6d96dc0de 100644 --- a/patches/webview.diff +++ b/patches/webview.diff @@ -74,10 +74,19 @@ Index: sagemaker-code-editor/vscode/src/vs/workbench/contrib/webview/browser/pre -+ content="default-src 'none'; script-src 'sha256-1qYtPnTQa4VwKNJO61EOhs2agF9TvuQSYIJ27OgzZqI=' 'self'; frame-src 'self'; style-src 'unsafe-inline';"> ++ content="default-src 'none'; script-src 'sha256-Oi71Tq4Buohx0KDH3yEbVJUzABnqYv9iVLo420HZXqI=' 'self'; frame-src 'self'; style-src 'unsafe-inline';"> { + /** + * @param {MessageEvent} event @@ -344,6 +344,12 @@ const hostname = location.hostname; From 54c75c3f23444b61aa29eaa881d72f3b4cc83986 Mon Sep 17 00:00:00 2001 From: Austin Jang Date: Tue, 7 Oct 2025 11:28:06 -0700 Subject: [PATCH 2/3] Update display language patch --- patches/display-language.patch | 182 ++++++++++++++++++++++++++++++++- 1 file changed, 180 insertions(+), 2 deletions(-) diff --git a/patches/display-language.patch b/patches/display-language.patch index 95c9a2197..0f8575f9e 100644 --- a/patches/display-language.patch +++ b/patches/display-language.patch @@ -85,9 +85,16 @@ Index: sagemaker-code-editor/vscode/src/vs/code/browser/workbench/workbench.html -@@ -37,6 +40,47 @@ +@@ -33,8 +36,53 @@ + ++ ++ + + @@ -140,6 +152,15 @@ Index: sagemaker-code-editor/vscode/src/vs/code/browser/workbench/workbench.html +- +- +- +- +- ++ ++ ++ + Index: sagemaker-code-editor/vscode/src/vs/platform/environment/common/environmentService.ts =================================================================== @@ -197,8 +218,7 @@ Index: sagemaker-code-editor/vscode/src/vs/server/node/remoteLanguagePacks.ts =================================================================== --- sagemaker-code-editor.orig/vscode/src/vs/server/node/remoteLanguagePacks.ts +++ sagemaker-code-editor/vscode/src/vs/server/node/remoteLanguagePacks.ts -@@ -0,38 +0,80 @@ import { FileAccess } from 'vs/base/comm - /*--------------------------------------------------------------------------------------------- +@@ -1,38 +1,80 @@ * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ @@ -209,16 +229,12 @@ Index: sagemaker-code-editor/vscode/src/vs/server/node/remoteLanguagePacks.ts -import { resolveNLSConfiguration } from '../../base/node/nls.js'; -import { Promises } from '../../base/node/pfs.js'; -import product from '../../platform/product/common/product.js'; -+import * as path from '../../base/common/path.js'; -+import * as lp from '../../base/node/languagePacks.js'; - +- -const nlsMetadataPath = join(FileAccess.asFileUri('').fsPath); -const defaultMessagesFile = join(nlsMetadataPath, 'nls.messages.json'); -const nlsConfigurationCache = new Map>(); -+const metaData = path.join(FileAccess.asFileUri('').fsPath, 'nls.metadata.json'); -+const _cache: Map> = new Map(); - --export async function getNLSConfiguration(language: string, userDataPath: string): Promise { +- +-export async function getNLSConfiguration(language: string, userDataPath: string): Promise { - if (!product.commit || !(await Promises.exists(defaultMessagesFile))) { - return { - userLocale: 'en', @@ -237,6 +253,17 @@ Index: sagemaker-code-editor/vscode/src/vs/server/node/remoteLanguagePacks.ts - if (!result) { - result = resolveNLSConfiguration({ userLocale: language, osLocale: language, commit: product.commit, userDataPath, nlsMetadataPath }); - nlsConfigurationCache.set(cacheKey, result); +- } +- +- return result; +-} ++import * as fs from 'fs'; ++import * as path from '../../base/common/path.js'; ++import * as lp from '../../base/node/languagePacks.js'; ++ ++const metaData = path.join(FileAccess.asFileUri('').fsPath, 'nls.metadata.json'); ++const _cache: Map> = new Map(); ++ +export function getNLSConfiguration(language: string, userDataPath: string): Promise { + const key = `${language}||${userDataPath}`; + let result = _cache.get(key); @@ -255,10 +282,9 @@ Index: sagemaker-code-editor/vscode/src/vs/server/node/remoteLanguagePacks.ts + return value; + }); + _cache.set(key, result); - } -- - return result; - } ++ } ++ return result; ++} + +export namespace InternalNLSConfiguration { + export function is(value: lp.NLSConfiguration): value is lp.InternalNLSConfiguration { @@ -306,7 +332,6 @@ Index: sagemaker-code-editor/vscode/src/vs/server/node/remoteLanguagePacks.ts + } + }); +}; -\ No newline at end of file Index: sagemaker-code-editor/vscode/src/vs/server/node/serverEnvironmentService.ts =================================================================== --- sagemaker-code-editor.orig/vscode/src/vs/server/node/serverEnvironmentService.ts @@ -358,23 +383,18 @@ Index: sagemaker-code-editor/vscode/src/vs/server/node/webClientServer.ts =================================================================== --- sagemaker-code-editor.orig/vscode/src/vs/server/node/webClientServer.ts +++ sagemaker-code-editor/vscode/src/vs/server/node/webClientServer.ts -@@ -0,8 +0,10 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - --import { createReadStream, promises } from 'fs'; -+import { createReadStream } from 'fs'; -+import { Promises } from '../../base/node/pfs.js'; -+import * as path from 'path'; - import * as http from 'http'; +@@ -8,6 +8,7 @@ import * as url from 'url'; import * as cookie from 'cookie'; -@@ -30,9 +32,9 @@ import { URI } from '../../base/common/uri.js' + import * as crypto from 'crypto'; ++import * as path from 'path'; + import { isEqualOrParent } from '../../base/common/extpath.js'; + import { getMediaMime } from '../../base/common/mime.js'; + import { isLinux } from '../../base/common/platform.js'; +@@ -25,9 +26,9 @@ import { streamToBuffer } from '../../base/common/buffer.js'; import { IProductConfiguration } from '../../base/common/product.js'; - import { isString } from '../../base/common/types.js'; + import { isString, Mutable } from '../../base/common/types.js'; +import { getLocaleFromConfig, getNLSConfiguration } from '../../server/node/remoteLanguagePacks.js'; import { CharCode } from '../../base/common/charCode.js'; import { IExtensionManifest } from '../../platform/extensions/common/extensions.js'; @@ -382,13 +402,13 @@ Index: sagemaker-code-editor/vscode/src/vs/server/node/webClientServer.ts const textMimeType: { [ext: string]: string | undefined } = { '.html': 'text/html', -@@ -393,25 +394,19 @@ export class WebClientServer { + '.js': 'text/javascript', +@@ -393,26 +394,20 @@ export class WebClientServer { workspaceUri: resolveWorkspaceURI(this._environmentService.args['default-workspace']), productConfiguration, - callbackRoute: callbackRoute -+ callbackRoute: this._callbackRoute - }; - +- }; +- - const cookies = cookie.parse(req.headers.cookie || ''); - const locale = cookies['vscode.nls.locale'] || req.headers['accept-language']?.split(',')[0]?.toLowerCase() || 'en'; - let WORKBENCH_NLS_BASE_URL: string | undefined; @@ -399,23 +419,32 @@ Index: sagemaker-code-editor/vscode/src/vs/server/node/webClientServer.ts - } else { - WORKBENCH_NLS_URL = ''; // fallback will apply - } -+ const locale = this._environmentService.args.locale || await getLocaleFromConfig(this._environmentService.argvResource.fsPath); -+ const nlsConfiguration = await getNLSConfiguration(locale, this._environmentService.userDataPath) - const nlsBaseUrl = this._productService.extensionsGallery?.nlsBaseUrl; - const values: { [key: string]: string } = { - WORKBENCH_WEB_CONFIGURATION: asJSON(workbenchWebConfiguration), - WORKBENCH_AUTH_SESSION: authSessionInfo ? asJSON(authSessionInfo) : '', +- +- const values: { [key: string]: string } = { +- WORKBENCH_WEB_CONFIGURATION: asJSON(workbenchWebConfiguration), +- WORKBENCH_AUTH_SESSION: authSessionInfo ? asJSON(authSessionInfo) : '', - WORKBENCH_WEB_BASE_URL: staticRoute, - WORKBENCH_NLS_URL, -- ORKBENCH_NLS_FALLBACK_URL: `${staticRoute}/out/nls.messages.js` +- WORKBENCH_NLS_FALLBACK_URL: `${staticRoute}/out/nls.messages.js` +- }; ++ callbackRoute: this._callbackRoute ++ }; ++ ++ const locale = this._environmentService.args.locale || await getLocaleFromConfig(this._environmentService.argvResource.fsPath); ++ const nlsConfiguration = await getNLSConfiguration(locale, this._environmentService.userDataPath) ++ const nlsBaseUrl = this._productService.extensionsGallery?.nlsBaseUrl; ++ const values: { [key: string]: string } = { ++ WORKBENCH_WEB_CONFIGURATION: asJSON(workbenchWebConfiguration), ++ WORKBENCH_AUTH_SESSION: authSessionInfo ? asJSON(authSessionInfo) : '', + WORKBENCH_WEB_BASE_URL: this._staticRoute, + WORKBENCH_NLS_BASE_URL: nlsBaseUrl ? `${nlsBaseUrl}${!nlsBaseUrl.endsWith('/') ? '/' : ''}${this._productService.commit}/${this._productService.version}/` : '', + BASE: base, + VS_BASE: vscodeBase, + NLS_CONFIGURATION: asJSON(nlsConfiguration), - }; ++ }; - if (useTestResolver) { + // DEV --------------------------------------------------------------------------------------- + // DEV: This is for development and enables loading CSS via import-statements via import-maps. @@ -401,7 +405,7 @@ export class WebClientServer { `frame-src 'self' https://*.vscode-cdn.net data:;`, 'worker-src \'self\' data: blob:;',