Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 26 additions & 26 deletions patched-vscode/extensions/git/package.nls.json

Large diffs are not rendered by default.

66 changes: 15 additions & 51 deletions patched-vscode/product.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down Expand Up @@ -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"
]
}
}
8 changes: 5 additions & 3 deletions patched-vscode/src/vs/platform/product/common/product.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we want to change this? the date too

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should revisit this - let's track in a github issue

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tracking issue here: #14

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',
});
}
}
Expand Down
2 changes: 2 additions & 0 deletions patched-vscode/src/vs/server/node/webClientServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
61 changes: 61 additions & 0 deletions patched-vscode/src/vs/workbench/browser/client.ts
Original file line number Diff line number Diff line change
@@ -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;
}
}
5 changes: 5 additions & 0 deletions patched-vscode/src/vs/workbench/browser/web.api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,11 @@ export interface IWorkbenchConstructionOptions {
*/
readonly configurationDefaults?: Record<string, any>;

/**
* Path to the user data directory.
*/
readonly userDataPath?: string

//#endregion

//#region Profile options
Expand Down
4 changes: 4 additions & 0 deletions patched-vscode/src/vs/workbench/browser/web.main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down Expand Up @@ -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));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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).`);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<meta charset="UTF-8">

<meta http-equiv="Content-Security-Policy"
content="default-src 'none'; script-src 'sha256-QA1gXilHYAUFCvp7MpjgcmyBCFzSKV0SpiecMU8aUVc=' 'self'; frame-src 'self'; style-src 'unsafe-inline';">
content="default-src 'none'; script-src 'sha256-5X5RiKYn8NTJVx919WStPrAmsV80rIIBbePhKquPcAQ=' 'self'; frame-src 'self'; style-src 'unsafe-inline';">

<!-- Disable pinch zooming -->
<meta name="viewport"
Expand Down Expand Up @@ -335,6 +335,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).`);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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', {},);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -257,8 +257,8 @@ export const walkthroughs: GettingStartedWalkthroughContent = [

{
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',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,14 @@ export class BrowserWorkbenchEnvironmentService implements IBrowserWorkbenchEnvi
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'); }
Expand Down Expand Up @@ -225,7 +232,7 @@ export class BrowserWorkbenchEnvironmentService implements IBrowserWorkbenchEnvi

@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/';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<meta http-equiv="Content-Security-Policy" content="
default-src 'none';
child-src 'self' data: blob:;
script-src 'self' 'unsafe-eval' 'sha256-/r7rqQ+yrxt57sxLuQ6AMYcy/lUpvAIzHjIJt/OeLWU=' https:;
script-src 'self' 'unsafe-eval' 'sha256-TkIM/TmudlFEe0ZRp0ptvN54LClwk30Rql4ZPE0hm/I=' https:;
connect-src 'self' https: wss: http://localhost:* http://127.0.0.1:* ws://localhost:* ws://127.0.0.1:*;"/>
</head>
<body>
Expand All @@ -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!`));
Expand Down
66 changes: 66 additions & 0 deletions patches/local-storage.diff
Original file line number Diff line number Diff line change
@@ -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<string, any>;

+ /**
+ * 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'); }
Loading