diff --git a/patched-vscode/extensions/git/package.nls.json b/patched-vscode/extensions/git/package.nls.json index de8f10e71..bdd03a2c8 100644 --- a/patched-vscode/extensions/git/package.nls.json +++ b/patched-vscode/extensions/git/package.nls.json @@ -203,7 +203,7 @@ "message": "List of git commands (ex: commit, push) that would have their `stdout` logged to the [git output](command:git.showOutput). If the git command has a client-side hook configured, the client-side hook's `stdout` will also be logged to the [git output](command:git.showOutput).", "comment": [ "{Locked='](command:git.showOutput'}", - "Do not translate the 'command:*' part inside of the '(..)'. It is an internal command syntax for VS Code", + "Do not translate the 'command:*' part inside of the '(..)'. It is an internal command syntax for Code-OSS", "Please make sure there is no space between the right bracket and left parenthesis: ]( this is an internal syntax for links" ] }, @@ -230,8 +230,8 @@ "config.untrackedChanges.hidden": "Untracked changes are hidden and excluded from several actions.", "config.requireGitUserConfig": "Controls whether to require explicit Git user configuration or allow Git to guess if missing.", "config.showCommitInput": "Controls whether to show the commit input in the Git source control panel.", - "config.terminalAuthentication": "Controls whether to enable VS Code to be the authentication handler for Git processes spawned in the Integrated Terminal. Note: Terminals need to be restarted to pick up a change in this setting.", - "config.terminalGitEditor": "Controls whether to enable VS Code to be the Git editor for Git processes spawned in the integrated terminal. Note: Terminals need to be restarted to pick up a change in this setting.", + "config.terminalAuthentication": "Controls whether to enable Code-OSS to be the authentication handler for Git processes spawned in the Integrated Terminal. Note: Terminals need to be restarted to pick up a change in this setting.", + "config.terminalGitEditor": "Controls whether to enable Code-OSS to be the Git editor for Git processes spawned in the integrated terminal. Note: Terminals need to be restarted to pick up a change in this setting.", "config.timeline.showAuthor": "Controls whether to show the commit author in the Timeline view.", "config.timeline.showUncommitted": "Controls whether to show uncommitted changes in the Timeline view.", "config.timeline.date": "Controls which date to use for items in the Timeline view.", @@ -282,7 +282,7 @@ "message": "[Download Git for Windows](https://git-scm.com/download/win)\nAfter installing, please [reload](command:workbench.action.reloadWindow) (or [troubleshoot](command:git.showOutput)). Additional source control providers can be installed [from the Marketplace](command:workbench.extensions.search?%22%40category%3A%5C%22scm%20providers%5C%22%22).", "comment": [ "{Locked='](command:workbench.action.reloadWindow'}", - "Do not translate the 'command:*' part inside of the '(..)'. It is an internal command syntax for VS Code", + "Do not translate the 'command:*' part inside of the '(..)'. It is an internal command syntax for Code-OSS", "Please make sure there is no space between the right bracket and left parenthesis: ]( this is an internal syntax for links" ] }, @@ -290,7 +290,7 @@ "message": "[Download Git for macOS](https://git-scm.com/download/mac)\nAfter installing, please [reload](command:workbench.action.reloadWindow) (or [troubleshoot](command:git.showOutput)). Additional source control providers can be installed [from the Marketplace](command:workbench.extensions.search?%22%40category%3A%5C%22scm%20providers%5C%22%22).", "comment": [ "{Locked='](command:workbench.action.reloadWindow'}", - "Do not translate the 'command:*' part inside of the '(..)'. It is an internal command syntax for VS Code", + "Do not translate the 'command:*' part inside of the '(..)'. It is an internal command syntax for Code-OSS", "Please make sure there is no space between the right bracket and left parenthesis: ]( this is an internal syntax for links" ] }, @@ -298,48 +298,48 @@ "message": "Source control depends on Git being installed.\n[Download Git for Linux](https://git-scm.com/download/linux)\nAfter installing, please [reload](command:workbench.action.reloadWindow) (or [troubleshoot](command:git.showOutput)). Additional source control providers can be installed [from the Marketplace](command:workbench.extensions.search?%22%40category%3A%5C%22scm%20providers%5C%22%22).", "comment": [ "{Locked='](command:workbench.action.reloadWindow'}", - "Do not translate the 'command:*' part inside of the '(..)'. It is an internal command syntax for VS Code", + "Do not translate the 'command:*' part inside of the '(..)'. It is an internal command syntax for Code-OSS", "Please make sure there is no space between the right bracket and left parenthesis: ]( this is an internal syntax for links" ] }, "view.workbench.scm.missing": "Install Git, a popular source control system, to track code changes and collaborate with others. Learn more in our [Git guides](https://aka.ms/vscode-scm).", "view.workbench.scm.disabled": { - "message": "If you would like to use git features, please enable git in your [settings](command:workbench.action.openSettings?%5B%22git.enabled%22%5D).\nTo learn more about how to use git and source control in VS Code [read our docs](https://aka.ms/vscode-scm).", + "message": "If you would like to use git features, please enable git in your [settings](command:workbench.action.openSettings?%5B%22git.enabled%22%5D).\nTo learn more about how to use git and source control in Code-OSS [read the docs](https://aka.ms/vscode-scm).", "comment": [ "{Locked='](command:workbench.action.openSettings?%5B%22git.enabled%22%5D'}", - "Do not translate the 'command:*' part inside of the '(..)'. It is an internal command syntax for VS Code", + "Do not translate the 'command:*' part inside of the '(..)'. It is an internal command syntax for Code-OSS", "Please make sure there is no space between the right bracket and left parenthesis: ]( this is an internal syntax for links" ] }, "view.workbench.scm.empty": { - "message": "In order to use git features, you can open a folder containing a git repository or clone from a URL.\n[Open Folder](command:vscode.openFolder)\n[Clone Repository](command:git.clone)\nTo learn more about how to use git and source control in VS Code [read our docs](https://aka.ms/vscode-scm).", + "message": "In order to use git features, you can open a folder containing a git repository or clone from a URL.\n[Open Folder](command:vscode.openFolder)\n[Clone Repository](command:git.clone)\nTo learn more about how to use git and source control in Code-OSS [read the docs](https://aka.ms/vscode-scm).", "comment": [ "{Locked='](command:vscode.openFolder'}", - "Do not translate the 'command:*' part inside of the '(..)'. It is an internal command syntax for VS Code", + "Do not translate the 'command:*' part inside of the '(..)'. It is an internal command syntax for Code-OSS", "Please make sure there is no space between the right bracket and left parenthesis: ]( this is an internal syntax for links" ] }, "view.workbench.scm.folder": { - "message": "The folder currently open doesn't have a git repository. You can initialize a repository which will enable source control features powered by git.\n[Initialize Repository](command:git.init?%5Btrue%5D)\nTo learn more about how to use git and source control in VS Code [read our docs](https://aka.ms/vscode-scm).", + "message": "The folder currently open doesn't have a git repository. You can initialize a repository which will enable source control features powered by git.\n[Initialize Repository](command:git.init?%5Btrue%5D)\nTo learn more about how to use git and source control in Code-OSS [read the docs](https://aka.ms/vscode-scm).", "comment": [ "{Locked='](command:git.init?%5Btrue%5D'}", - "Do not translate the 'command:*' part inside of the '(..)'. It is an internal command syntax for VS Code", + "Do not translate the 'command:*' part inside of the '(..)'. It is an internal command syntax for Code-OSS", "Please make sure there is no space between the right bracket and left parenthesis: ]( this is an internal syntax for links" ] }, "view.workbench.scm.workspace": { - "message": "The workspace currently open doesn't have any folders containing git repositories. You can initialize a repository on a folder which will enable source control features powered by git.\n[Initialize Repository](command:git.init)\nTo learn more about how to use git and source control in VS Code [read our docs](https://aka.ms/vscode-scm).", + "message": "The workspace currently open doesn't have any folders containing git repositories. You can initialize a repository on a folder which will enable source control features powered by git.\n[Initialize Repository](command:git.init)\nTo learn more about how to use git and source control in Code-OSS [read the docs](https://aka.ms/vscode-scm).", "comment": [ "{Locked='](command:git.init'}", - "Do not translate the 'command:*' part inside of the '(..)'. It is an internal command syntax for VS Code", + "Do not translate the 'command:*' part inside of the '(..)'. It is an internal command syntax for Code-OSS", "Please make sure there is no space between the right bracket and left parenthesis: ]( this is an internal syntax for links" ] }, "view.workbench.scm.emptyWorkspace": { - "message": "The workspace currently open doesn't have any folders containing git repositories.\n[Add Folder to Workspace](command:workbench.action.addRootFolder)\nTo learn more about how to use git and source control in VS Code [read our docs](https://aka.ms/vscode-scm).", + "message": "The workspace currently open doesn't have any folders containing git repositories.\n[Add Folder to Workspace](command:workbench.action.addRootFolder)\nTo learn more about how to use git and source control in Code-OSS [read the docs](https://aka.ms/vscode-scm).", "comment": [ "{Locked='](command:workbench.action.addRootFolder'}", - "Do not translate the 'command:*' part inside of the '(..)'. It is an internal command syntax for VS Code", + "Do not translate the 'command:*' part inside of the '(..)'. It is an internal command syntax for Code-OSS", "Please make sure there is no space between the right bracket and left parenthesis: ]( this is an internal syntax for links" ] }, @@ -354,7 +354,7 @@ "comment": [ "{Locked='](command:git.openRepositoriesInParentFolders'}", "{Locked='](command:workbench.action.openSettings?%5B%22git.openRepositoryInParentFolders%22%5D'}", - "Do not translate the 'command:*' part inside of the '(..)'. It is an internal command syntax for VS Code", + "Do not translate the 'command:*' part inside of the '(..)'. It is an internal command syntax for Code-OSS", "Please make sure there is no space between the right bracket and left parenthesis: ]( this is an internal syntax for links" ] }, @@ -363,7 +363,7 @@ "comment": [ "{Locked='](command:git.openRepositoriesInParentFolders'}", "{Locked='](command:workbench.action.openSettings?%5B%22git.openRepositoryInParentFolders%22%5D'}", - "Do not translate the 'command:*' part inside of the '(..)'. It is an internal command syntax for VS Code", + "Do not translate the 'command:*' part inside of the '(..)'. It is an internal command syntax for Code-OSS", "Please make sure there is no space between the right bracket and left parenthesis: ]( this is an internal syntax for links" ] }, @@ -371,7 +371,7 @@ "message": "The detected git repository is potentially unsafe as the folder is owned by someone other than the current user.\n[Manage Unsafe Repositories](command:git.manageUnsafeRepositories)\nTo learn more about unsafe repositories [read our docs](https://aka.ms/vscode-git-unsafe-repository).", "comment": [ "{Locked='](command:git.manageUnsafeRepositories'}", - "Do not translate the 'command:*' part inside of the '(..)'. It is an internal command syntax for VS Code", + "Do not translate the 'command:*' part inside of the '(..)'. It is an internal command syntax for Code-OSS", "Please make sure there is no space between the right bracket and left parenthesis: ]( this is an internal syntax for links" ] }, @@ -379,23 +379,23 @@ "message": "The detected git repositories are potentially unsafe as the folders are owned by someone other than the current user.\n[Manage Unsafe Repositories](command:git.manageUnsafeRepositories)\nTo learn more about unsafe repositories [read our docs](https://aka.ms/vscode-git-unsafe-repository).", "comment": [ "{Locked='](command:git.manageUnsafeRepositories'}", - "Do not translate the 'command:*' part inside of the '(..)'. It is an internal command syntax for VS Code", + "Do not translate the 'command:*' part inside of the '(..)'. It is an internal command syntax for Code-OSS", "Please make sure there is no space between the right bracket and left parenthesis: ]( this is an internal syntax for links" ] }, "view.workbench.scm.closedRepository": { - "message": "A git repository was found that was previously closed.\n[Reopen Closed Repository](command:git.reopenClosedRepositories)\nTo learn more about how to use git and source control in VS Code [read our docs](https://aka.ms/vscode-scm).", + "message": "A git repository was found that was previously closed.\n[Reopen Closed Repository](command:git.reopenClosedRepositories)\nTo learn more about how to use git and source control in Code-OSS [read the docs](https://aka.ms/vscode-scm).", "comment": [ "{Locked='](command:git.reopenClosedRepositories'}", - "Do not translate the 'command:*' part inside of the '(..)'. It is an internal command syntax for VS Code", + "Do not translate the 'command:*' part inside of the '(..)'. It is an internal command syntax for Code-OSS", "Please make sure there is no space between the right bracket and left parenthesis: ]( this is an internal syntax for links" ] }, "view.workbench.scm.closedRepositories": { - "message": "Git repositories were found that were previously closed.\n[Reopen Closed Repositories](command:git.reopenClosedRepositories)\nTo learn more about how to use git and source control in VS Code [read our docs](https://aka.ms/vscode-scm).", + "message": "Git repositories were found that were previously closed.\n[Reopen Closed Repositories](command:git.reopenClosedRepositories)\nTo learn more about how to use git and source control in Code-OSS [read the docs](https://aka.ms/vscode-scm).", "comment": [ "{Locked='](command:git.reopenClosedRepositories'}", - "Do not translate the 'command:*' part inside of the '(..)'. It is an internal command syntax for VS Code", + "Do not translate the 'command:*' part inside of the '(..)'. It is an internal command syntax for Code-OSS", "Please make sure there is no space between the right bracket and left parenthesis: ]( this is an internal syntax for links" ] }, @@ -403,9 +403,9 @@ "message": "You can clone a repository locally.\n[Clone Repository](command:git.clone 'Clone a repository once the git extension has activated')", "comment": [ "{Locked='](command:git.clone'}", - "Do not translate the 'command:*' part inside of the '(..)'. It is an internal command syntax for VS Code", + "Do not translate the 'command:*' part inside of the '(..)'. It is an internal command syntax for Code-OSS", "Please make sure there is no space between the right bracket and left parenthesis: ]( this is an internal syntax for links" ] }, - "view.workbench.learnMore": "To learn more about how to use git and source control in VS Code [read our docs](https://aka.ms/vscode-scm)." + "view.workbench.learnMore": "To learn more about how to use git and source control in Code-OSS [read the docs](https://aka.ms/vscode-scm)." } diff --git a/patched-vscode/product.json b/patched-vscode/product.json index d4ff5cd56..2eee35831 100644 --- a/patched-vscode/product.json +++ b/patched-vscode/product.json @@ -1,6 +1,6 @@ { - "nameShort": "Code - OSS", - "nameLong": "Code - OSS", + "nameShort": "SageMaker Code Editor", + "nameLong": "SageMaker Code Editor", "applicationName": "code-oss", "dataFolderName": ".vscode-oss", "win32MutexName": "vscodeoss", @@ -34,53 +34,17 @@ "urlProtocol": "code-oss", "webviewContentExternalBaseUrlTemplate": "https://{{uuid}}.vscode-cdn.net/insider/ef65ac1ba57f57f2a3961bfe94aa20481caca4c6/out/vs/workbench/contrib/webview/browser/pre/", "builtInExtensions": [ - { - "name": "ms-vscode.js-debug-companion", - "version": "1.1.2", - "sha256": "e034b8b41beb4e97e02c70f7175bd88abe66048374c2bd629f54bb33354bc2aa", - "repo": "https://github.com/microsoft/vscode-js-debug-companion", - "metadata": { - "id": "99cb0b7f-7354-4278-b8da-6cc79972169d", - "publisherId": { - "publisherId": "5f5636e7-69ed-4afe-b5d6-8d231fb3d3ee", - "publisherName": "ms-vscode", - "displayName": "Microsoft", - "flags": "verified" - }, - "publisherDisplayName": "Microsoft" - } - }, - { - "name": "ms-vscode.js-debug", - "version": "1.83.1", - "sha256": "1452fdbab8d0d83ca5765bb66170d50b005c97ca4dcd13e154c3401d842a92d4", - "repo": "https://github.com/microsoft/vscode-js-debug", - "metadata": { - "id": "25629058-ddac-4e17-abba-74678e126c5d", - "publisherId": { - "publisherId": "5f5636e7-69ed-4afe-b5d6-8d231fb3d3ee", - "publisherName": "ms-vscode", - "displayName": "Microsoft", - "flags": "verified" - }, - "publisherDisplayName": "Microsoft" - } - }, - { - "name": "ms-vscode.vscode-js-profile-table", - "version": "1.0.3", - "sha256": "b9dab017506d9e6a469a0f82b392e4cb1d7a25a4843f1db8ba396cbee209cfc5", - "repo": "https://github.com/microsoft/vscode-js-profile-visualizer", - "metadata": { - "id": "7e52b41b-71ad-457b-ab7e-0620f1fc4feb", - "publisherId": { - "publisherId": "5f5636e7-69ed-4afe-b5d6-8d231fb3d3ee", - "publisherName": "ms-vscode", - "displayName": "Microsoft", - "flags": "verified" - }, - "publisherDisplayName": "Microsoft" - } - } + ], + "extensionsGallery": { + "serviceUrl": "https://open-vsx.org/vscode/gallery", + "itemUrl": "https://open-vsx.org/vscode/item", + "resourceUrlTemplate": "https://open-vsx.org/vscode/unpkg/{publisher}/{name}/{version}/{path}", + "controlUrl": "", + "recommendationsUrl": "", + "nlsBaseUrl": "", + "publisherUrl": "" + }, + "linkProtectionTrustedDomains": [ + "https://open-vsx.org" ] -} +} \ No newline at end of file diff --git a/patched-vscode/src/vs/platform/product/common/product.ts b/patched-vscode/src/vs/platform/product/common/product.ts index 8cc6f60aa..30bb54c96 100644 --- a/patched-vscode/src/vs/platform/product/common/product.ts +++ b/patched-vscode/src/vs/platform/product/common/product.ts @@ -59,15 +59,17 @@ else { if (Object.keys(product).length === 0) { Object.assign(product, { version: '1.82.0-dev', - nameShort: 'Code - OSS Dev', - nameLong: 'Code - OSS Dev', + nameShort: 'CodeEditor', + nameLong: 'Code Editor', applicationName: 'code-oss', dataFolderName: '.vscode-oss', + commit: "hellocommit", + date: "hellodate", urlProtocol: 'code-oss', reportIssueUrl: 'https://github.com/microsoft/vscode/issues/new', licenseName: 'MIT', licenseUrl: 'https://github.com/microsoft/vscode/blob/main/LICENSE.txt', - serverLicenseUrl: 'https://github.com/microsoft/vscode/blob/main/LICENSE.txt' + serverLicenseUrl: 'https://github.com/microsoft/vscode/blob/main/LICENSE.txt', }); } } diff --git a/patched-vscode/src/vs/server/node/webClientServer.ts b/patched-vscode/src/vs/server/node/webClientServer.ts index ee8ef4386..30bd7b7bc 100644 --- a/patched-vscode/src/vs/server/node/webClientServer.ts +++ b/patched-vscode/src/vs/server/node/webClientServer.ts @@ -331,6 +331,8 @@ export class WebClientServer { const workbenchWebConfiguration = { remoteAuthority, + webviewEndpoint: vscodeBase + this._staticRoute + '/out/vs/workbench/contrib/webview/browser/pre', + userDataPath: this._environmentService.userDataPath, _wrapWebWorkerExtHostInIframe, developmentOptions: { enableSmokeTestDriver: this._environmentService.args['enable-smoke-test-driver'] ? true : undefined, logLevel: this._logService.getLevel() }, settingsSyncOptions: !this._environmentService.isBuilt && this._environmentService.args['enable-sync'] ? { enabled: true } : undefined, diff --git a/patched-vscode/src/vs/workbench/browser/client.ts b/patched-vscode/src/vs/workbench/browser/client.ts new file mode 100644 index 000000000..1de4fedb0 --- /dev/null +++ b/patched-vscode/src/vs/workbench/browser/client.ts @@ -0,0 +1,61 @@ +import { Disposable } from 'vs/base/common/lifecycle'; +import { CommandsRegistry } from 'vs/platform/commands/common/commands'; +import { MenuId, MenuRegistry } from "vs/platform/actions/common/actions"; +import { localize } from "vs/nls"; +import { ILogService } from "vs/platform/log/common/log"; + +export class SagemakerServerClient extends Disposable { + constructor ( + @ILogService private logService: ILogService + ) { + super(); + + this.logService.debug('Initializing SagemakerServerClient...'); + this.registerSagemakerCommands(); + } + + static LOGOUT_COMMAND_ID = 'sagemaker.logout'; + static COOKIE_COMMAND_ID = 'sagemaker.parseCookies'; + + private registerSagemakerCommands() { + const authMode: string | undefined = this.getCookieValue('authMode'); + const expiryTime: string | undefined = this.getCookieValue('expiryTime'); + const studioUserProfileName: string | undefined = this.getCookieValue('studioUserProfileName') + const ssoExpiryTimestamp: string | undefined = this.getCookieValue('ssoExpiryTimestamp') + const redirectURL: string | undefined = this.getCookieValue('redirectURL') + + this.logService.debug('Registering sagemaker commands...'); + + CommandsRegistry.registerCommand(SagemakerServerClient.COOKIE_COMMAND_ID, () => { + return { + authMode: authMode, + expiryTime: expiryTime, + ssoExpiryTimestamp: ssoExpiryTimestamp, + studioUserProfileName: studioUserProfileName, + redirectURL: redirectURL + }; + }); + + CommandsRegistry.registerCommand(SagemakerServerClient.LOGOUT_COMMAND_ID, () => { + const currentUrl = new URL(window.location.href); + const hostname = currentUrl.hostname; + const pathComponents = currentUrl.pathname.split('/'); + const logoutUrl = `https://${hostname}/${pathComponents[1]}/${pathComponents[2]}/logout`; + window.location.href = logoutUrl; + }); + + for (const menuId of [MenuId.CommandPalette, MenuId.MenubarHomeMenu]) { + MenuRegistry.appendMenuItem(menuId, { + command: { + id: SagemakerServerClient.LOGOUT_COMMAND_ID, + title: localize('logout', "{0}: Log out", 'Sagemaker'), + }, + }); + } + } + + private getCookieValue(name: string): string | undefined { + const match = document.cookie.match('(^|[^;]+)\\s*' + name + '\\s*=\\s*([^;]+)'); // See https://stackoverflow.com/a/25490531 + return match ? match.pop() : undefined; + } +} \ No newline at end of file diff --git a/patched-vscode/src/vs/workbench/browser/web.api.ts b/patched-vscode/src/vs/workbench/browser/web.api.ts index 642bfeb10..9887a4c7b 100644 --- a/patched-vscode/src/vs/workbench/browser/web.api.ts +++ b/patched-vscode/src/vs/workbench/browser/web.api.ts @@ -276,6 +276,11 @@ export interface IWorkbenchConstructionOptions { */ readonly configurationDefaults?: Record; + /** + * Path to the user data directory. + */ + readonly userDataPath?: string + //#endregion //#region Profile options diff --git a/patched-vscode/src/vs/workbench/browser/web.main.ts b/patched-vscode/src/vs/workbench/browser/web.main.ts index 03a5a2f4d..e3941b22b 100644 --- a/patched-vscode/src/vs/workbench/browser/web.main.ts +++ b/patched-vscode/src/vs/workbench/browser/web.main.ts @@ -95,6 +95,7 @@ import { EncryptionService } from 'vs/workbench/services/encryption/browser/encr import { IEncryptionService } from 'vs/platform/encryption/common/encryptionService'; import { ISecretStorageService } from 'vs/platform/secrets/common/secrets'; import { TunnelSource } from 'vs/workbench/services/remote/common/tunnelModel'; +import { SagemakerServerClient } from 'vs/workbench/browser/client'; export class BrowserMain extends Disposable { @@ -130,6 +131,9 @@ export class BrowserMain extends Disposable { // Startup const instantiationService = workbench.startup(); + // Create instance of SagemakerServerClient + this._register(instantiationService.createInstance(SagemakerServerClient)); + // Window this._register(instantiationService.createInstance(BrowserWindow)); diff --git a/patched-vscode/src/vs/workbench/contrib/webview/browser/pre/index-no-csp.html b/patched-vscode/src/vs/workbench/contrib/webview/browser/pre/index-no-csp.html index 0cc07c2f1..a9c3f6f34 100644 --- a/patched-vscode/src/vs/workbench/contrib/webview/browser/pre/index-no-csp.html +++ b/patched-vscode/src/vs/workbench/contrib/webview/browser/pre/index-no-csp.html @@ -334,6 +334,12 @@ const hostname = location.hostname; + // It is safe to run if we are on the same host. + const parent = new URL(parentOrigin) + if (parent.hostname === hostname) { + return start(parentOrigin) + } + if (!crypto.subtle) { // cannot validate, not running in a secure context throw new Error(`'crypto.subtle' is not available so webviews will not work. This is likely because the editor is not running in a secure context (https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts).`); diff --git a/patched-vscode/src/vs/workbench/contrib/webview/browser/pre/index.html b/patched-vscode/src/vs/workbench/contrib/webview/browser/pre/index.html index a6c387295..593dbd6e5 100644 --- a/patched-vscode/src/vs/workbench/contrib/webview/browser/pre/index.html +++ b/patched-vscode/src/vs/workbench/contrib/webview/browser/pre/index.html @@ -5,7 +5,7 @@ + content="default-src 'none'; script-src 'sha256-5X5RiKYn8NTJVx919WStPrAmsV80rIIBbePhKquPcAQ=' 'self'; frame-src 'self'; style-src 'unsafe-inline';"> @@ -23,6 +23,13 @@ // validation not requested return start(); } + + // It is safe to run if we are on the same host. + const parent = new URL(parentOrigin) + if (parent.hostname === hostname) { + return start() + } + if (!crypto.subtle) { // cannot validate, not running in a secure context return sendError(new Error(`Cannot validate in current context!`)); diff --git a/patches/local-storage.diff b/patches/local-storage.diff new file mode 100644 index 000000000..90c24abe7 --- /dev/null +++ b/patches/local-storage.diff @@ -0,0 +1,66 @@ +Make storage local to the remote server + +This solves two problems: + 1. Extensions running in the browser (like Vim) might use these paths + directly instead of using the file service and most likely can't write + to `/User` on disk. + 2. Settings will be stored in the file system instead of in browser + storage. Using browser storage makes sharing or seeding settings + between browsers difficult. We may want to revisit this once/if we get + settings sync. + +Unfortunately this does not affect state which uses a separate method with +IndexedDB and does not appear nearly as easy to redirect to disk. + +To test install the Vim extension and make sure something that uses file storage +works (history recall for example) and change settings from the UI and on disk +while making sure they appear on the other side. + +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 +@@ -332,6 +332,7 @@ export class WebClientServer { + const workbenchWebConfiguration = { + remoteAuthority, + webviewEndpoint: vscodeBase + this._staticRoute + '/out/vs/workbench/contrib/webview/browser/pre', ++ userDataPath: this._environmentService.userDataPath, + _wrapWebWorkerExtHostInIframe, + developmentOptions: { enableSmokeTestDriver: this._environmentService.args['enable-smoke-test-driver'] ? true : undefined, logLevel: this._logService.getLevel() }, + settingsSyncOptions: !this._environmentService.isBuilt && this._environmentService.args['enable-sync'] ? { enabled: true } : undefined, +Index: sagemaker-code-editor/vscode/src/vs/workbench/browser/web.api.ts +=================================================================== +--- sagemaker-code-editor.orig/vscode/src/vs/workbench/browser/web.api.ts ++++ sagemaker-code-editor/vscode/src/vs/workbench/browser/web.api.ts +@@ -276,6 +276,11 @@ export interface IWorkbenchConstructionO + */ + readonly configurationDefaults?: Record; + ++ /** ++ * Path to the user data directory. ++ */ ++ readonly userDataPath?: string ++ + //#endregion + + //#region Profile options +Index: sagemaker-code-editor/vscode/src/vs/workbench/services/environment/browser/environmentService.ts +=================================================================== +--- sagemaker-code-editor.orig/vscode/src/vs/workbench/services/environment/browser/environmentService.ts ++++ sagemaker-code-editor/vscode/src/vs/workbench/services/environment/browser/environmentService.ts +@@ -102,7 +102,14 @@ export class BrowserWorkbenchEnvironment + get logFile(): URI { return joinPath(this.windowLogsPath, 'window.log'); } + + @memoize +- get userRoamingDataHome(): URI { return URI.file('/User').with({ scheme: Schemas.vscodeUserData }); } ++ get userRoamingDataHome(): URI { return joinPath(URI.file(this.userDataPath).with({ scheme: Schemas.vscodeRemote }), 'User'); } ++ ++ get userDataPath(): string { ++ if (!this.options.userDataPath) { ++ throw new Error('userDataPath was not provided to the browser'); ++ } ++ return this.options.userDataPath; ++ } + + @memoize + get argvResource(): URI { return joinPath(this.userRoamingDataHome, 'argv.json'); } diff --git a/patches/sagemaker-integration.diff b/patches/sagemaker-integration.diff new file mode 100644 index 000000000..a9fa925b7 --- /dev/null +++ b/patches/sagemaker-integration.diff @@ -0,0 +1,395 @@ +Index: sagemaker-code-editor/vscode/src/vs/workbench/browser/client.ts +=================================================================== +--- /dev/null ++++ sagemaker-code-editor/vscode/src/vs/workbench/browser/client.ts +@@ -0,0 +1,61 @@ ++import { Disposable } from 'vs/base/common/lifecycle'; ++import { CommandsRegistry } from 'vs/platform/commands/common/commands'; ++import { MenuId, MenuRegistry } from "vs/platform/actions/common/actions"; ++import { localize } from "vs/nls"; ++import { ILogService } from "vs/platform/log/common/log"; ++ ++export class SagemakerServerClient extends Disposable { ++ constructor ( ++ @ILogService private logService: ILogService ++ ) { ++ super(); ++ ++ this.logService.debug('Initializing SagemakerServerClient...'); ++ this.registerSagemakerCommands(); ++ } ++ ++ static LOGOUT_COMMAND_ID = 'sagemaker.logout'; ++ static COOKIE_COMMAND_ID = 'sagemaker.parseCookies'; ++ ++ private registerSagemakerCommands() { ++ const authMode: string | undefined = this.getCookieValue('authMode'); ++ const expiryTime: string | undefined = this.getCookieValue('expiryTime'); ++ const studioUserProfileName: string | undefined = this.getCookieValue('studioUserProfileName') ++ const ssoExpiryTimestamp: string | undefined = this.getCookieValue('ssoExpiryTimestamp') ++ const redirectURL: string | undefined = this.getCookieValue('redirectURL') ++ ++ this.logService.debug('Registering sagemaker commands...'); ++ ++ CommandsRegistry.registerCommand(SagemakerServerClient.COOKIE_COMMAND_ID, () => { ++ return { ++ authMode: authMode, ++ expiryTime: expiryTime, ++ ssoExpiryTimestamp: ssoExpiryTimestamp, ++ studioUserProfileName: studioUserProfileName, ++ redirectURL: redirectURL ++ }; ++ }); ++ ++ CommandsRegistry.registerCommand(SagemakerServerClient.LOGOUT_COMMAND_ID, () => { ++ const currentUrl = new URL(window.location.href); ++ const hostname = currentUrl.hostname; ++ const pathComponents = currentUrl.pathname.split('/'); ++ const logoutUrl = `https://${hostname}/${pathComponents[1]}/${pathComponents[2]}/logout`; ++ window.location.href = logoutUrl; ++ }); ++ ++ for (const menuId of [MenuId.CommandPalette, MenuId.MenubarHomeMenu]) { ++ MenuRegistry.appendMenuItem(menuId, { ++ command: { ++ id: SagemakerServerClient.LOGOUT_COMMAND_ID, ++ title: localize('logout', "{0}: Log out", 'Sagemaker'), ++ }, ++ }); ++ } ++ } ++ ++ private getCookieValue(name: string): string | undefined { ++ const match = document.cookie.match('(^|[^;]+)\\s*' + name + '\\s*=\\s*([^;]+)'); // See https://stackoverflow.com/a/25490531 ++ return match ? match.pop() : undefined; ++ } ++} +\ No newline at end of file +Index: sagemaker-code-editor/vscode/src/vs/workbench/browser/web.main.ts +=================================================================== +--- sagemaker-code-editor.orig/vscode/src/vs/workbench/browser/web.main.ts ++++ sagemaker-code-editor/vscode/src/vs/workbench/browser/web.main.ts +@@ -95,6 +95,7 @@ import { TunnelSource } from 'vs/workbench/services/re + import { IEncryptionService } from 'vs/platform/encryption/common/encryptionService'; + import { ISecretStorageService } from 'vs/platform/secrets/common/secrets'; + import { TunnelSource } from 'vs/workbench/services/remote/common/tunnelModel'; ++import { SagemakerServerClient } from 'vs/workbench/browser/client'; + + export class BrowserMain extends Disposable { + +@@ -129,6 +130,9 @@ export class BrowserMain extends Disposable { + + // Startup + const instantiationService = workbench.startup(); ++ ++ // Create instance of SagemakerServerClient ++ this._register(instantiationService.createInstance(SagemakerServerClient)); + + // Window + this._register(instantiationService.createInstance(BrowserWindow)); +Index: sagemaker-code-editor/vscode/product.json +=================================================================== +--- sagemaker-code-editor.orig/vscode/product.json ++++ sagemaker-code-editor/vscode/product.json +@@ -1,6 +1,6 @@ + { +- "nameShort": "Code - OSS", +- "nameLong": "Code - OSS", ++ "nameShort": "SageMaker Code Editor", ++ "nameLong": "SageMaker Code Editor", + "applicationName": "code-oss", + "dataFolderName": ".vscode-oss", + "win32MutexName": "vscodeoss", +@@ -34,53 +34,17 @@ + "urlProtocol": "code-oss", + "webviewContentExternalBaseUrlTemplate": "https://{{uuid}}.vscode-cdn.net/insider/ef65ac1ba57f57f2a3961bfe94aa20481caca4c6/out/vs/workbench/contrib/webview/browser/pre/", + "builtInExtensions": [ +- { +- "name": "ms-vscode.js-debug-companion", +- "version": "1.1.2", +- "sha256": "e034b8b41beb4e97e02c70f7175bd88abe66048374c2bd629f54bb33354bc2aa", +- "repo": "https://github.com/microsoft/vscode-js-debug-companion", +- "metadata": { +- "id": "99cb0b7f-7354-4278-b8da-6cc79972169d", +- "publisherId": { +- "publisherId": "5f5636e7-69ed-4afe-b5d6-8d231fb3d3ee", +- "publisherName": "ms-vscode", +- "displayName": "Microsoft", +- "flags": "verified" +- }, +- "publisherDisplayName": "Microsoft" +- } +- }, +- { +- "name": "ms-vscode.js-debug", +- "version": "1.83.1", +- "sha256": "1452fdbab8d0d83ca5765bb66170d50b005c97ca4dcd13e154c3401d842a92d4", +- "repo": "https://github.com/microsoft/vscode-js-debug", +- "metadata": { +- "id": "25629058-ddac-4e17-abba-74678e126c5d", +- "publisherId": { +- "publisherId": "5f5636e7-69ed-4afe-b5d6-8d231fb3d3ee", +- "publisherName": "ms-vscode", +- "displayName": "Microsoft", +- "flags": "verified" +- }, +- "publisherDisplayName": "Microsoft" +- } +- }, +- { +- "name": "ms-vscode.vscode-js-profile-table", +- "version": "1.0.3", +- "sha256": "b9dab017506d9e6a469a0f82b392e4cb1d7a25a4843f1db8ba396cbee209cfc5", +- "repo": "https://github.com/microsoft/vscode-js-profile-visualizer", +- "metadata": { +- "id": "7e52b41b-71ad-457b-ab7e-0620f1fc4feb", +- "publisherId": { +- "publisherId": "5f5636e7-69ed-4afe-b5d6-8d231fb3d3ee", +- "publisherName": "ms-vscode", +- "displayName": "Microsoft", +- "flags": "verified" +- }, +- "publisherDisplayName": "Microsoft" +- } +- } ++ ], ++ "extensionsGallery": { ++ "serviceUrl": "https://open-vsx.org/vscode/gallery", ++ "itemUrl": "https://open-vsx.org/vscode/item", ++ "resourceUrlTemplate": "https://open-vsx.org/vscode/unpkg/{publisher}/{name}/{version}/{path}", ++ "controlUrl": "", ++ "recommendationsUrl": "", ++ "nlsBaseUrl": "", ++ "publisherUrl": "" ++ }, ++ "linkProtectionTrustedDomains": [ ++ "https://open-vsx.org" + ] +-} +\ No newline at end of file ++} +Index: sagemaker-code-editor/vscode/src/vs/platform/product/common/product.ts +=================================================================== +--- sagemaker-code-editor.orig/vscode/src/vs/platform/product/common/product.ts ++++ sagemaker-code-editor/vscode/src/vs/platform/product/common/product.ts +@@ -59,15 +59,17 @@ else { + if (Object.keys(product).length === 0) { + Object.assign(product, { + version: '1.82.0-dev', +- nameShort: 'Code - OSS Dev', +- nameLong: 'Code - OSS Dev', ++ nameShort: 'CodeEditor', ++ nameLong: 'Code Editor', + applicationName: 'code-oss', + dataFolderName: '.vscode-oss', ++ commit: "hellocommit", ++ date: "hellodate", + urlProtocol: 'code-oss', + reportIssueUrl: 'https://github.com/microsoft/vscode/issues/new', + licenseName: 'MIT', + licenseUrl: 'https://github.com/microsoft/vscode/blob/main/LICENSE.txt', +- serverLicenseUrl: 'https://github.com/microsoft/vscode/blob/main/LICENSE.txt' ++ serverLicenseUrl: 'https://github.com/microsoft/vscode/blob/main/LICENSE.txt', + }); + } + } +Index: sagemaker-code-editor/vscode/src/vs/workbench/contrib/welcomeGettingStarted/browser/gettingStarted.ts +=================================================================== +--- sagemaker-code-editor.orig/vscode/src/vs/workbench/contrib/welcomeGettingStarted/browser/gettingStarted.ts ++++ sagemaker-code-editor/vscode/src/vs/workbench/contrib/welcomeGettingStarted/browser/gettingStarted.ts +@@ -779,8 +779,8 @@ export class GettingStartedPage extends EditorPane { + })); + + const header = $('.header', {}, +- $('h1.product-name.caption', {}, this.productService.nameLong), +- $('p.subtitle.description', {}, localize({ key: 'gettingStarted.editingEvolved', comment: ['Shown as subtitle on the Welcome page.'] }, "Editing evolved")) ++ $('h1.product-name.caption', {}, "Code Editor"), ++ $('p.subtitle.description', {}, localize({ key: 'gettingStarted.editingEvolved', comment: ['Shown as subtitle on the Welcome page.'] }, "Based on Code-OSS, Visual Studio Code Open Source")) + ); + + const leftColumn = $('.categories-column.categories-column-left', {},); +Index: sagemaker-code-editor/vscode/extensions/git/package.nls.json +=================================================================== +--- sagemaker-code-editor.orig/vscode/extensions/git/package.nls.json ++++ sagemaker-code-editor/vscode/extensions/git/package.nls.json +@@ -203,7 +203,7 @@ + "message": "List of git commands (ex: commit, push) that would have their `stdout` logged to the [git output](command:git.showOutput). If the git command has a client-side hook configured, the client-side hook's `stdout` will also be logged to the [git output](command:git.showOutput).", + "comment": [ + "{Locked='](command:git.showOutput'}", +- "Do not translate the 'command:*' part inside of the '(..)'. It is an internal command syntax for VS Code", ++ "Do not translate the 'command:*' part inside of the '(..)'. It is an internal command syntax for Code-OSS", + "Please make sure there is no space between the right bracket and left parenthesis: ]( this is an internal syntax for links" + ] + }, +@@ -230,8 +230,8 @@ + "config.untrackedChanges.hidden": "Untracked changes are hidden and excluded from several actions.", + "config.requireGitUserConfig": "Controls whether to require explicit Git user configuration or allow Git to guess if missing.", + "config.showCommitInput": "Controls whether to show the commit input in the Git source control panel.", +- "config.terminalAuthentication": "Controls whether to enable VS Code to be the authentication handler for Git processes spawned in the Integrated Terminal. Note: Terminals need to be restarted to pick up a change in this setting.", +- "config.terminalGitEditor": "Controls whether to enable VS Code to be the Git editor for Git processes spawned in the integrated terminal. Note: Terminals need to be restarted to pick up a change in this setting.", ++ "config.terminalAuthentication": "Controls whether to enable Code-OSS to be the authentication handler for Git processes spawned in the Integrated Terminal. Note: Terminals need to be restarted to pick up a change in this setting.", ++ "config.terminalGitEditor": "Controls whether to enable Code-OSS to be the Git editor for Git processes spawned in the integrated terminal. Note: Terminals need to be restarted to pick up a change in this setting.", + "config.timeline.showAuthor": "Controls whether to show the commit author in the Timeline view.", + "config.timeline.showUncommitted": "Controls whether to show uncommitted changes in the Timeline view.", + "config.timeline.date": "Controls which date to use for items in the Timeline view.", +@@ -282,7 +282,7 @@ + "message": "[Download Git for Windows](https://git-scm.com/download/win)\nAfter installing, please [reload](command:workbench.action.reloadWindow) (or [troubleshoot](command:git.showOutput)). Additional source control providers can be installed [from the Marketplace](command:workbench.extensions.search?%22%40category%3A%5C%22scm%20providers%5C%22%22).", + "comment": [ + "{Locked='](command:workbench.action.reloadWindow'}", +- "Do not translate the 'command:*' part inside of the '(..)'. It is an internal command syntax for VS Code", ++ "Do not translate the 'command:*' part inside of the '(..)'. It is an internal command syntax for Code-OSS", + "Please make sure there is no space between the right bracket and left parenthesis: ]( this is an internal syntax for links" + ] + }, +@@ -290,7 +290,7 @@ + "message": "[Download Git for macOS](https://git-scm.com/download/mac)\nAfter installing, please [reload](command:workbench.action.reloadWindow) (or [troubleshoot](command:git.showOutput)). Additional source control providers can be installed [from the Marketplace](command:workbench.extensions.search?%22%40category%3A%5C%22scm%20providers%5C%22%22).", + "comment": [ + "{Locked='](command:workbench.action.reloadWindow'}", +- "Do not translate the 'command:*' part inside of the '(..)'. It is an internal command syntax for VS Code", ++ "Do not translate the 'command:*' part inside of the '(..)'. It is an internal command syntax for Code-OSS", + "Please make sure there is no space between the right bracket and left parenthesis: ]( this is an internal syntax for links" + ] + }, +@@ -298,48 +298,48 @@ + "message": "Source control depends on Git being installed.\n[Download Git for Linux](https://git-scm.com/download/linux)\nAfter installing, please [reload](command:workbench.action.reloadWindow) (or [troubleshoot](command:git.showOutput)). Additional source control providers can be installed [from the Marketplace](command:workbench.extensions.search?%22%40category%3A%5C%22scm%20providers%5C%22%22).", + "comment": [ + "{Locked='](command:workbench.action.reloadWindow'}", +- "Do not translate the 'command:*' part inside of the '(..)'. It is an internal command syntax for VS Code", ++ "Do not translate the 'command:*' part inside of the '(..)'. It is an internal command syntax for Code-OSS", + "Please make sure there is no space between the right bracket and left parenthesis: ]( this is an internal syntax for links" + ] + }, + "view.workbench.scm.missing": "Install Git, a popular source control system, to track code changes and collaborate with others. Learn more in our [Git guides](https://aka.ms/vscode-scm).", + "view.workbench.scm.disabled": { +- "message": "If you would like to use git features, please enable git in your [settings](command:workbench.action.openSettings?%5B%22git.enabled%22%5D).\nTo learn more about how to use git and source control in VS Code [read our docs](https://aka.ms/vscode-scm).", ++ "message": "If you would like to use git features, please enable git in your [settings](command:workbench.action.openSettings?%5B%22git.enabled%22%5D).\nTo learn more about how to use git and source control in Code-OSS [read the docs](https://aka.ms/vscode-scm).", + "comment": [ + "{Locked='](command:workbench.action.openSettings?%5B%22git.enabled%22%5D'}", +- "Do not translate the 'command:*' part inside of the '(..)'. It is an internal command syntax for VS Code", ++ "Do not translate the 'command:*' part inside of the '(..)'. It is an internal command syntax for Code-OSS", + "Please make sure there is no space between the right bracket and left parenthesis: ]( this is an internal syntax for links" + ] + }, + "view.workbench.scm.empty": { +- "message": "In order to use git features, you can open a folder containing a git repository or clone from a URL.\n[Open Folder](command:vscode.openFolder)\n[Clone Repository](command:git.clone)\nTo learn more about how to use git and source control in VS Code [read our docs](https://aka.ms/vscode-scm).", ++ "message": "In order to use git features, you can open a folder containing a git repository or clone from a URL.\n[Open Folder](command:vscode.openFolder)\n[Clone Repository](command:git.clone)\nTo learn more about how to use git and source control in Code-OSS [read the docs](https://aka.ms/vscode-scm).", + "comment": [ + "{Locked='](command:vscode.openFolder'}", +- "Do not translate the 'command:*' part inside of the '(..)'. It is an internal command syntax for VS Code", ++ "Do not translate the 'command:*' part inside of the '(..)'. It is an internal command syntax for Code-OSS", + "Please make sure there is no space between the right bracket and left parenthesis: ]( this is an internal syntax for links" + ] + }, + "view.workbench.scm.folder": { +- "message": "The folder currently open doesn't have a git repository. You can initialize a repository which will enable source control features powered by git.\n[Initialize Repository](command:git.init?%5Btrue%5D)\nTo learn more about how to use git and source control in VS Code [read our docs](https://aka.ms/vscode-scm).", ++ "message": "The folder currently open doesn't have a git repository. You can initialize a repository which will enable source control features powered by git.\n[Initialize Repository](command:git.init?%5Btrue%5D)\nTo learn more about how to use git and source control in Code-OSS [read the docs](https://aka.ms/vscode-scm).", + "comment": [ + "{Locked='](command:git.init?%5Btrue%5D'}", +- "Do not translate the 'command:*' part inside of the '(..)'. It is an internal command syntax for VS Code", ++ "Do not translate the 'command:*' part inside of the '(..)'. It is an internal command syntax for Code-OSS", + "Please make sure there is no space between the right bracket and left parenthesis: ]( this is an internal syntax for links" + ] + }, + "view.workbench.scm.workspace": { +- "message": "The workspace currently open doesn't have any folders containing git repositories. You can initialize a repository on a folder which will enable source control features powered by git.\n[Initialize Repository](command:git.init)\nTo learn more about how to use git and source control in VS Code [read our docs](https://aka.ms/vscode-scm).", ++ "message": "The workspace currently open doesn't have any folders containing git repositories. You can initialize a repository on a folder which will enable source control features powered by git.\n[Initialize Repository](command:git.init)\nTo learn more about how to use git and source control in Code-OSS [read the docs](https://aka.ms/vscode-scm).", + "comment": [ + "{Locked='](command:git.init'}", +- "Do not translate the 'command:*' part inside of the '(..)'. It is an internal command syntax for VS Code", ++ "Do not translate the 'command:*' part inside of the '(..)'. It is an internal command syntax for Code-OSS", + "Please make sure there is no space between the right bracket and left parenthesis: ]( this is an internal syntax for links" + ] + }, + "view.workbench.scm.emptyWorkspace": { +- "message": "The workspace currently open doesn't have any folders containing git repositories.\n[Add Folder to Workspace](command:workbench.action.addRootFolder)\nTo learn more about how to use git and source control in VS Code [read our docs](https://aka.ms/vscode-scm).", ++ "message": "The workspace currently open doesn't have any folders containing git repositories.\n[Add Folder to Workspace](command:workbench.action.addRootFolder)\nTo learn more about how to use git and source control in Code-OSS [read the docs](https://aka.ms/vscode-scm).", + "comment": [ + "{Locked='](command:workbench.action.addRootFolder'}", +- "Do not translate the 'command:*' part inside of the '(..)'. It is an internal command syntax for VS Code", ++ "Do not translate the 'command:*' part inside of the '(..)'. It is an internal command syntax for Code-OSS", + "Please make sure there is no space between the right bracket and left parenthesis: ]( this is an internal syntax for links" + ] + }, +@@ -354,7 +354,7 @@ + "comment": [ + "{Locked='](command:git.openRepositoriesInParentFolders'}", + "{Locked='](command:workbench.action.openSettings?%5B%22git.openRepositoryInParentFolders%22%5D'}", +- "Do not translate the 'command:*' part inside of the '(..)'. It is an internal command syntax for VS Code", ++ "Do not translate the 'command:*' part inside of the '(..)'. It is an internal command syntax for Code-OSS", + "Please make sure there is no space between the right bracket and left parenthesis: ]( this is an internal syntax for links" + ] + }, +@@ -363,7 +363,7 @@ + "comment": [ + "{Locked='](command:git.openRepositoriesInParentFolders'}", + "{Locked='](command:workbench.action.openSettings?%5B%22git.openRepositoryInParentFolders%22%5D'}", +- "Do not translate the 'command:*' part inside of the '(..)'. It is an internal command syntax for VS Code", ++ "Do not translate the 'command:*' part inside of the '(..)'. It is an internal command syntax for Code-OSS", + "Please make sure there is no space between the right bracket and left parenthesis: ]( this is an internal syntax for links" + ] + }, +@@ -371,7 +371,7 @@ + "message": "The detected git repository is potentially unsafe as the folder is owned by someone other than the current user.\n[Manage Unsafe Repositories](command:git.manageUnsafeRepositories)\nTo learn more about unsafe repositories [read our docs](https://aka.ms/vscode-git-unsafe-repository).", + "comment": [ + "{Locked='](command:git.manageUnsafeRepositories'}", +- "Do not translate the 'command:*' part inside of the '(..)'. It is an internal command syntax for VS Code", ++ "Do not translate the 'command:*' part inside of the '(..)'. It is an internal command syntax for Code-OSS", + "Please make sure there is no space between the right bracket and left parenthesis: ]( this is an internal syntax for links" + ] + }, +@@ -379,23 +379,23 @@ + "message": "The detected git repositories are potentially unsafe as the folders are owned by someone other than the current user.\n[Manage Unsafe Repositories](command:git.manageUnsafeRepositories)\nTo learn more about unsafe repositories [read our docs](https://aka.ms/vscode-git-unsafe-repository).", + "comment": [ + "{Locked='](command:git.manageUnsafeRepositories'}", +- "Do not translate the 'command:*' part inside of the '(..)'. It is an internal command syntax for VS Code", ++ "Do not translate the 'command:*' part inside of the '(..)'. It is an internal command syntax for Code-OSS", + "Please make sure there is no space between the right bracket and left parenthesis: ]( this is an internal syntax for links" + ] + }, + "view.workbench.scm.closedRepository": { +- "message": "A git repository was found that was previously closed.\n[Reopen Closed Repository](command:git.reopenClosedRepositories)\nTo learn more about how to use git and source control in VS Code [read our docs](https://aka.ms/vscode-scm).", ++ "message": "A git repository was found that was previously closed.\n[Reopen Closed Repository](command:git.reopenClosedRepositories)\nTo learn more about how to use git and source control in Code-OSS [read the docs](https://aka.ms/vscode-scm).", + "comment": [ + "{Locked='](command:git.reopenClosedRepositories'}", +- "Do not translate the 'command:*' part inside of the '(..)'. It is an internal command syntax for VS Code", ++ "Do not translate the 'command:*' part inside of the '(..)'. It is an internal command syntax for Code-OSS", + "Please make sure there is no space between the right bracket and left parenthesis: ]( this is an internal syntax for links" + ] + }, + "view.workbench.scm.closedRepositories": { +- "message": "Git repositories were found that were previously closed.\n[Reopen Closed Repositories](command:git.reopenClosedRepositories)\nTo learn more about how to use git and source control in VS Code [read our docs](https://aka.ms/vscode-scm).", ++ "message": "Git repositories were found that were previously closed.\n[Reopen Closed Repositories](command:git.reopenClosedRepositories)\nTo learn more about how to use git and source control in Code-OSS [read the docs](https://aka.ms/vscode-scm).", + "comment": [ + "{Locked='](command:git.reopenClosedRepositories'}", +- "Do not translate the 'command:*' part inside of the '(..)'. It is an internal command syntax for VS Code", ++ "Do not translate the 'command:*' part inside of the '(..)'. It is an internal command syntax for Code-OSS", + "Please make sure there is no space between the right bracket and left parenthesis: ]( this is an internal syntax for links" + ] + }, +@@ -403,9 +403,9 @@ + "message": "You can clone a repository locally.\n[Clone Repository](command:git.clone 'Clone a repository once the git extension has activated')", + "comment": [ + "{Locked='](command:git.clone'}", +- "Do not translate the 'command:*' part inside of the '(..)'. It is an internal command syntax for VS Code", ++ "Do not translate the 'command:*' part inside of the '(..)'. It is an internal command syntax for Code-OSS", + "Please make sure there is no space between the right bracket and left parenthesis: ]( this is an internal syntax for links" + ] + }, +- "view.workbench.learnMore": "To learn more about how to use git and source control in VS Code [read our docs](https://aka.ms/vscode-scm)." ++ "view.workbench.learnMore": "To learn more about how to use git and source control in Code-OSS [read the docs](https://aka.ms/vscode-scm)." + } +Index: sagemaker-code-editor/vscode/src/vs/workbench/contrib/welcomeGettingStarted/common/gettingStartedContent.ts +=================================================================== +--- sagemaker-code-editor.orig/vscode/src/vs/workbench/contrib/welcomeGettingStarted/common/gettingStartedContent.ts ++++ sagemaker-code-editor/vscode/src/vs/workbench/contrib/welcomeGettingStarted/common/gettingStartedContent.ts +@@ -257,8 +257,8 @@ export const walkthroughs: GettingStartedWalkthroughCo + + { + id: 'SetupWeb', +- title: localize('gettingStarted.setupWeb.title', "Get Started with VS Code for the Web"), +- description: localize('gettingStarted.setupWeb.description', "Discover the best customizations to make VS Code for the Web yours."), ++ title: localize('gettingStarted.setupWeb.title', "Get Started with Code Editor"), ++ description: localize('gettingStarted.setupWeb.description', "Discover the best customizations to make Code Editor yours."), + isFeatured: true, + icon: setupIcon, + when: 'isWeb', diff --git a/patches/series b/patches/series index 6f238e852..8ffae8993 100644 --- a/patches/series +++ b/patches/series @@ -1,4 +1,7 @@ sagemaker-extension.diff disable-online-services.diff disable-telemetry.diff -base-path.diff \ No newline at end of file +base-path.diff +webview.diff +local-storage.diff +sagemaker-integration.diff \ No newline at end of file diff --git a/patches/webview.diff b/patches/webview.diff new file mode 100644 index 000000000..f973af4df --- /dev/null +++ b/patches/webview.diff @@ -0,0 +1,137 @@ +Serve webviews from the same origin + +Normally webviews are served from vscode-webview.net but we would rather them be +self-hosted. + +When doing this CSP will block resources (for example when viewing images) so +add 'self' to the CSP to fix that. + +Additionally the service worker defaults to handling *all* requests made to the +current host but when self-hosting the webview this will end up including the +webview HTML itself which means these requests will fail since the communication +channel between the webview and the main thread has not been set up yet as the +webview itself is not ready yet (it has no HTML and therefore no script either). +Since this code exists only for the authentication case we can just skip it when +it is served from the current host as authentication is not a problem if the +request is not cross-origin. + +There is also an origin check we bypass (this seems to be related to how the +webview host is separate by default but we serve on the same host). + +To test, open a few types of webviews (images, markdown, extension details, etc). + +Make sure to update the hash. To do so: +1. run code-server +2. open any webview (i.e. preview Markdown) +3. see error in console and copy hash + +That will test the hash change in pre/index.html + +Double-check the console to make sure there are no console errors for the webWorkerExtensionHostIframe +which also requires a hash change. + +parentOriginHash changes + +This fixes webviews from not working properly due to a change upstream. +Upstream added a check to ensure parent authority is encoded into the webview +origin. Since our webview origin is the parent authority, we can bypass this +check. + +Note: webviews will only work in secure contexts (i.e. accessing the server using https or localhost) +And this change will not apply if using port forwarding to access the server from a different address + +Index: sagemaker-code-editor/vscode/src/vs/workbench/services/environment/browser/environmentService.ts +=================================================================== +--- sagemaker-code-editor.orig/vscode/src/vs/workbench/services/environment/browser/environmentService.ts ++++ sagemaker-code-editor/vscode/src/vs/workbench/services/environment/browser/environmentService.ts +@@ -225,7 +225,7 @@ export class BrowserWorkbenchEnvironment + + @memoize + get webviewExternalEndpoint(): string { +- const endpoint = this.options.webviewEndpoint ++ const endpoint = (this.options.webviewEndpoint && new URL(this.options.webviewEndpoint, window.location.toString()).toString()) + || this.productService.webviewContentExternalBaseUrlTemplate + || 'https://{{uuid}}.vscode-cdn.net/{{quality}}/{{commit}}/out/vs/workbench/contrib/webview/browser/pre/'; + +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 +@@ -323,6 +323,7 @@ export class WebClientServer { + + const workbenchWebConfiguration = { + remoteAuthority, ++ webviewEndpoint: vscodeBase + this._staticRoute + '/out/vs/workbench/contrib/webview/browser/pre', + _wrapWebWorkerExtHostInIframe, + developmentOptions: { enableSmokeTestDriver: this._environmentService.args['enable-smoke-test-driver'] ? true : undefined, logLevel: this._logService.getLevel() }, + settingsSyncOptions: !this._environmentService.isBuilt && this._environmentService.args['enable-sync'] ? { enabled: true } : undefined, +Index: sagemaker-code-editor/vscode/src/vs/workbench/contrib/webview/browser/pre/index.html +=================================================================== +--- sagemaker-code-editor.orig/vscode/src/vs/workbench/contrib/webview/browser/pre/index.html ++++ sagemaker-code-editor/vscode/src/vs/workbench/contrib/webview/browser/pre/index.html +@@ -5,7 +5,7 @@ + + + ++ content="default-src 'none'; script-src 'sha256-5X5RiKYn8NTJVx919WStPrAmsV80rIIBbePhKquPcAQ=' 'self'; frame-src 'self'; style-src 'unsafe-inline';"> + + + + + +@@ -23,6 +23,13 @@ + // validation not requested + return start(); + } ++ ++ // It is safe to run if we are on the same host. ++ const parent = new URL(parentOrigin) ++ if (parent.hostname === hostname) { ++ return start() ++ } ++ + if (!crypto.subtle) { + // cannot validate, not running in a secure context + return sendError(new Error(`Cannot validate in current context!`));