diff --git a/.gitignore b/.gitignore index e615ec46..d453ee2e 100644 --- a/.gitignore +++ b/.gitignore @@ -22,3 +22,4 @@ test/test-results # Quilt's internal data. /.pc +/patches/*.diff~ diff --git a/docs/CONTRIBUTING.md b/docs/CONTRIBUTING.md index 20531155..eaa4b736 100644 --- a/docs/CONTRIBUTING.md +++ b/docs/CONTRIBUTING.md @@ -96,10 +96,10 @@ re-apply the patches. ### Version updates to Code 1. Update the `lib/vscode` submodule to the desired upstream version branch. -2. From the code-server **project root**, run `yarn install`. -3. Apply the patches (`quilt push -a`) or restore your stashed changes. At this +2. Apply the patches (`quilt push -a`) or restore your stashed changes. At this stage you may need to resolve conflicts. For example use `quilt push -f`, manually apply the rejected portions, then `quilt refresh`. +3. From the code-server **project root**, run `yarn install`. 4. Test code-server locally to make sure everything works. 5. Check the Node.js version that's used by Electron (which is shipped with VS Code. If necessary, update your version of Node.js to match. diff --git a/lib/vscode b/lib/vscode index f80445ac..c722ca6c 160000 --- a/lib/vscode +++ b/lib/vscode @@ -1 +1 @@ -Subproject commit f80445acd5a3dadef24aa209168452a3d97cc326 +Subproject commit c722ca6c7eed3d7987c0d5c3df5c45f6b15e77d1 diff --git a/patches/base-path.diff b/patches/base-path.diff index 715f8a21..eb3008eb 100644 --- a/patches/base-path.diff +++ b/patches/base-path.diff @@ -185,10 +185,10 @@ Index: code-server/lib/vscode/src/vs/server/node/webClientServer.ts settingsSyncOptions: !this._environmentService.isBuilt && this._environmentService.args['enable-sync'] ? { enabled: true } : undefined, productConfiguration: >{ + rootEndpoint: base, + embedderIdentifier: 'server-distro', extensionsGallery: this._webExtensionResourceUrlTemplate ? { ...this._productService.extensionsGallery, - 'resourceUrlTemplate': this._webExtensionResourceUrlTemplate.with({ -@@ -289,7 +295,9 @@ export class WebClientServer { +@@ -290,7 +296,9 @@ export class WebClientServer { } : undefined } }))) @@ -199,7 +199,7 @@ Index: code-server/lib/vscode/src/vs/server/node/webClientServer.ts const cspDirectives = [ 'default-src \'self\';', -@@ -368,3 +376,70 @@ export class WebClientServer { +@@ -369,3 +377,70 @@ export class WebClientServer { return res.end(data); } } @@ -286,7 +286,7 @@ Index: code-server/lib/vscode/src/vs/code/browser/workbench/workbench.ts =================================================================== --- code-server.orig/lib/vscode/src/vs/code/browser/workbench/workbench.ts +++ code-server/lib/vscode/src/vs/code/browser/workbench/workbench.ts -@@ -504,6 +504,7 @@ function doCreateUri(path: string, query +@@ -482,6 +482,7 @@ function doCreateUri(path: string, query }); } @@ -294,11 +294,11 @@ Index: code-server/lib/vscode/src/vs/code/browser/workbench/workbench.ts return URI.parse(window.location.href).with({ path, query }); } -@@ -515,7 +516,7 @@ function doCreateUri(path: string, query +@@ -493,7 +494,7 @@ function doCreateUri(path: string, query if (!configElement || !configElementAttribute) { throw new Error('Missing web configuration element'); } -- const config: IWorkbenchConstructionOptions & { folderUri?: UriComponents, workspaceUri?: UriComponents } = JSON.parse(configElementAttribute); +- const config: IWorkbenchConstructionOptions & { folderUri?: UriComponents; workspaceUri?: UriComponents } = JSON.parse(configElementAttribute); + const config: IWorkbenchConstructionOptions & { folderUri?: UriComponents, workspaceUri?: UriComponents } = { ...JSON.parse(configElementAttribute), remoteAuthority: location.host } // Create workbench diff --git a/patches/display-language.diff b/patches/display-language.diff index bbcaa673..999c29b1 100644 --- a/patches/display-language.diff +++ b/patches/display-language.diff @@ -6,7 +6,7 @@ Index: code-server/lib/vscode/src/vs/server/node/serverServices.ts =================================================================== --- code-server.orig/lib/vscode/src/vs/server/node/serverServices.ts +++ code-server/lib/vscode/src/vs/server/node/serverServices.ts -@@ -198,6 +198,9 @@ export async function setupServerService +@@ -188,6 +188,9 @@ export async function setupServerService const channel = new ExtensionManagementChannel(extensionManagementService, (ctx: RemoteAgentConnectionContext) => getUriTransformer(ctx.remoteAuthority)); socketServer.registerChannel('extensions', channel); @@ -20,7 +20,7 @@ Index: code-server/lib/vscode/src/vs/base/common/platform.ts =================================================================== --- code-server.orig/lib/vscode/src/vs/base/common/platform.ts +++ code-server/lib/vscode/src/vs/base/common/platform.ts -@@ -83,6 +83,17 @@ if (typeof navigator === 'object' && !is +@@ -84,6 +84,17 @@ if (typeof navigator === 'object' && !is _isWeb = true; _locale = navigator.language; _language = _locale; @@ -185,7 +185,7 @@ Index: code-server/lib/vscode/src/vs/server/node/webClientServer.ts const data = (await util.promisify(fs.readFile)(filePath)).toString() .replace('{{WORKBENCH_WEB_CONFIGURATION}}', escapeAttribute(JSON.stringify({ remoteAuthority, -@@ -301,7 +304,8 @@ export class WebClientServer { +@@ -302,7 +305,8 @@ export class WebClientServer { }))) .replace('{{WORKBENCH_AUTH_SESSION}}', () => authSessionInfo ? escapeAttribute(JSON.stringify(authSessionInfo)) : '') .replace(/{{BASE}}/g, base) @@ -252,7 +252,7 @@ Index: code-server/lib/vscode/src/vs/workbench/workbench.web.main.ts =================================================================== --- code-server.orig/lib/vscode/src/vs/workbench/workbench.web.main.ts +++ code-server/lib/vscode/src/vs/workbench/workbench.web.main.ts -@@ -109,6 +109,10 @@ registerSingleton(ICustomEndpointTelemet +@@ -111,6 +111,10 @@ registerSingleton(IDiagnosticsService, N //#region --- workbench contributions diff --git a/patches/integration.diff b/patches/integration.diff index 6f629c2e..1be03618 100644 --- a/patches/integration.diff +++ b/patches/integration.diff @@ -174,10 +174,10 @@ Index: code-server/lib/vscode/src/vs/workbench/browser/web.main.ts =================================================================== --- code-server.orig/lib/vscode/src/vs/workbench/browser/web.main.ts +++ code-server/lib/vscode/src/vs/workbench/browser/web.main.ts -@@ -69,6 +69,7 @@ import { ICredentialsService } from 'vs/ - import { IndexedDB } from 'vs/base/browser/indexedDB'; +@@ -69,6 +69,7 @@ import { IndexedDB } from 'vs/base/brows import { BrowserCredentialsService } from 'vs/workbench/services/credentials/browser/credentialsService'; import { IWorkspace } from 'vs/workbench/services/host/browser/browserHostService'; + import { WebFileSystemAccess } from 'vs/platform/files/browser/webFileSystemAccess'; +import { CodeServerClient } from 'vs/workbench/browser/client'; export class BrowserMain extends Disposable { diff --git a/patches/last-opened.diff b/patches/last-opened.diff index 83fafe29..71a1c998 100644 --- a/patches/last-opened.diff +++ b/patches/last-opened.diff @@ -6,27 +6,3 @@ respect it here then remove our own redirction code that handles this. Our version might be better anyway since it puts the workspace in the URL. -Index: code-server/lib/vscode/src/vs/code/browser/workbench/workbench.ts -=================================================================== ---- code-server.orig/lib/vscode/src/vs/code/browser/workbench/workbench.ts -+++ code-server/lib/vscode/src/vs/code/browser/workbench/workbench.ts -@@ -410,19 +410,6 @@ class WorkspaceProvider implements IWork - workspace = { folderUri: URI.revive(config.folderUri) }; - } else if (config.workspaceUri) { - workspace = { workspaceUri: URI.revive(config.workspaceUri) }; -- } else { -- workspace = (() => { -- const lastWorkspaceRaw = window.localStorage.getItem(WorkspaceProvider.LAST_WORKSPACE_STORAGE_KEY); -- if (lastWorkspaceRaw) { -- try { -- return parse(lastWorkspaceRaw); // use marshalling#parse() to revive potential URIs -- } catch (error) { -- // Ignore -- } -- } -- -- return undefined; -- })(); - } - } - diff --git a/patches/local-storage.diff b/patches/local-storage.diff index 8da6393c..4c3c90da 100644 --- a/patches/local-storage.diff +++ b/patches/local-storage.diff @@ -48,7 +48,7 @@ Index: code-server/lib/vscode/src/vs/workbench/services/environment/browser/envi =================================================================== --- code-server.orig/lib/vscode/src/vs/workbench/services/environment/browser/environmentService.ts +++ code-server/lib/vscode/src/vs/workbench/services/environment/browser/environmentService.ts -@@ -126,7 +126,14 @@ export class BrowserWorkbenchEnvironment +@@ -52,7 +52,14 @@ export class BrowserWorkbenchEnvironment get logFile(): URI { return joinPath(this.logsHome, 'window.log'); } @memoize diff --git a/patches/logout.diff b/patches/logout.diff index 94c03086..7bbf73ef 100644 --- a/patches/logout.diff +++ b/patches/logout.diff @@ -45,9 +45,9 @@ Index: code-server/lib/vscode/src/vs/server/node/webClientServer.ts rootEndpoint: base, updateEndpoint: !this._environmentService.args['disable-update-check'] ? base + '/update/check' : undefined, + logoutEndpoint: this._environmentService.args['auth'] ? base + '/logout' : undefined, + embedderIdentifier: 'server-distro', extensionsGallery: { ...this._productService.extensionsGallery, - 'resourceUrlTemplate': this._webExtensionResourceUrlTemplate ? this._webExtensionResourceUrlTemplate.with({ Index: code-server/lib/vscode/src/vs/workbench/browser/client.ts =================================================================== --- code-server.orig/lib/vscode/src/vs/workbench/browser/client.ts diff --git a/patches/marketplace.diff b/patches/marketplace.diff index 024c4bbb..17442fc1 100644 --- a/patches/marketplace.diff +++ b/patches/marketplace.diff @@ -32,10 +32,10 @@ Index: code-server/lib/vscode/src/vs/server/node/webClientServer.ts =================================================================== --- code-server.orig/lib/vscode/src/vs/server/node/webClientServer.ts +++ code-server/lib/vscode/src/vs/server/node/webClientServer.ts -@@ -285,14 +285,14 @@ export class WebClientServer { - settingsSyncOptions: !this._environmentService.isBuilt && this._environmentService.args['enable-sync'] ? { enabled: true } : undefined, +@@ -286,14 +286,14 @@ export class WebClientServer { productConfiguration: >{ rootEndpoint: base, + embedderIdentifier: 'server-distro', - extensionsGallery: this._webExtensionResourceUrlTemplate ? { + extensionsGallery: { ...this._productService.extensionsGallery, diff --git a/patches/node-version.diff b/patches/node-version.diff index a3e58f51..9ee48e87 100644 --- a/patches/node-version.diff +++ b/patches/node-version.diff @@ -11,7 +11,7 @@ Index: code-server/lib/vscode/build/gulpfile.reh.js =================================================================== --- code-server.orig/lib/vscode/build/gulpfile.reh.js +++ code-server/lib/vscode/build/gulpfile.reh.js -@@ -122,9 +122,7 @@ const serverWithWebEntryPoints = [ +@@ -124,9 +124,7 @@ const serverWithWebEntryPoints = [ ]; function getNodeVersion() { @@ -71,7 +71,7 @@ Index: code-server/lib/vscode/build/lib/util.ts =================================================================== --- code-server.orig/lib/vscode/build/lib/util.ts +++ code-server/lib/vscode/build/lib/util.ts -@@ -371,9 +371,7 @@ export function streamToPromise(stream: +@@ -371,9 +371,7 @@ export function streamToPromise(stream: } export function getElectronVersion(): string { @@ -91,10 +91,11 @@ Index: code-server/lib/vscode/remote/.yarnrc =================================================================== --- code-server.orig/lib/vscode/remote/.yarnrc +++ /dev/null -@@ -1,3 +0,0 @@ +@@ -1,4 +0,0 @@ -disturl "http://nodejs.org/dist" -target "14.16.0" -runtime "node" +-build_from_source "true" Index: code-server/lib/vscode/.yarnrc =================================================================== --- code-server.orig/lib/vscode/.yarnrc diff --git a/patches/proposed-api.diff b/patches/proposed-api.diff index 015f43ba..5971d714 100644 --- a/patches/proposed-api.diff +++ b/patches/proposed-api.diff @@ -9,7 +9,7 @@ Index: code-server/lib/vscode/src/vs/workbench/services/extensions/common/abstra =================================================================== --- code-server.orig/lib/vscode/src/vs/workbench/services/extensions/common/abstractExtensionService.ts +++ code-server/lib/vscode/src/vs/workbench/services/extensions/common/abstractExtensionService.ts -@@ -1134,7 +1134,7 @@ class ProposedApiController { +@@ -1163,7 +1163,7 @@ class ProposedApiController { this._envEnabledExtensions = new Set((_environmentService.extensionEnabledProposedApi ?? []).map(id => ExtensionIdentifier.toKey(id))); @@ -22,7 +22,7 @@ Index: code-server/lib/vscode/src/vs/workbench/services/extensions/common/extens =================================================================== --- code-server.orig/lib/vscode/src/vs/workbench/services/extensions/common/extensions.ts +++ code-server/lib/vscode/src/vs/workbench/services/extensions/common/extensions.ts -@@ -135,10 +135,7 @@ export interface IExtensionHost { +@@ -134,10 +134,7 @@ export interface IExtensionHost { } export function isProposedApiEnabled(extension: IExtensionDescription, proposal: ApiProposalName): boolean { diff --git a/patches/proxy-uri.diff b/patches/proxy-uri.diff index 9a960a79..b46d733d 100644 --- a/patches/proxy-uri.diff +++ b/patches/proxy-uri.diff @@ -73,9 +73,9 @@ Index: code-server/lib/vscode/src/vs/server/node/webClientServer.ts updateEndpoint: !this._environmentService.args['disable-update-check'] ? base + '/update/check' : undefined, logoutEndpoint: this._environmentService.args['auth'] ? base + '/logout' : undefined, + proxyEndpointTemplate: base + '/proxy/{{port}}', + embedderIdentifier: 'server-distro', extensionsGallery: { ...this._productService.extensionsGallery, - 'resourceUrlTemplate': this._webExtensionResourceUrlTemplate ? this._webExtensionResourceUrlTemplate.with({ Index: code-server/lib/vscode/src/vs/workbench/browser/web.main.ts =================================================================== --- code-server.orig/lib/vscode/src/vs/workbench/browser/web.main.ts @@ -93,7 +93,7 @@ Index: code-server/lib/vscode/src/vs/workbench/contrib/terminal/common/terminalE =================================================================== --- code-server.orig/lib/vscode/src/vs/workbench/contrib/terminal/common/terminalEnvironment.ts +++ code-server/lib/vscode/src/vs/workbench/contrib/terminal/common/terminalEnvironment.ts -@@ -388,7 +388,7 @@ export function createTerminalEnvironmen +@@ -390,7 +390,7 @@ export function createTerminalEnvironmen // Sanitize the environment, removing any undesirable VS Code and Electron environment // variables diff --git a/patches/series b/patches/series index d812592b..87e8f394 100644 --- a/patches/series +++ b/patches/series @@ -16,6 +16,5 @@ post-install.diff log-level.diff local-storage.diff service-worker.diff -last-opened.diff connection-type.diff sourcemaps.diff diff --git a/patches/service-worker.diff b/patches/service-worker.diff index 20055553..18cdc6c9 100644 --- a/patches/service-worker.diff +++ b/patches/service-worker.diff @@ -21,10 +21,10 @@ Index: code-server/lib/vscode/src/vs/server/node/webClientServer.ts =================================================================== --- code-server.orig/lib/vscode/src/vs/server/node/webClientServer.ts +++ code-server/lib/vscode/src/vs/server/node/webClientServer.ts -@@ -296,6 +296,10 @@ export class WebClientServer { - updateEndpoint: !this._environmentService.args['disable-update-check'] ? base + '/update/check' : undefined, +@@ -297,6 +297,10 @@ export class WebClientServer { logoutEndpoint: this._environmentService.args['auth'] ? base + '/logout' : undefined, proxyEndpointTemplate: base + '/proxy/{{port}}', + embedderIdentifier: 'server-distro', + serviceWorker: { + scope: vscodeBase + '/', + path: base + '/_static/out/browser/serviceWorker.js', diff --git a/patches/sourcemaps.diff b/patches/sourcemaps.diff index fe0e2607..cb2367e6 100644 --- a/patches/sourcemaps.diff +++ b/patches/sourcemaps.diff @@ -10,7 +10,7 @@ Index: code-server/lib/vscode/build/gulpfile.reh.js =================================================================== --- code-server.orig/lib/vscode/build/gulpfile.reh.js +++ code-server/lib/vscode/build/gulpfile.reh.js -@@ -195,8 +195,7 @@ function packageTask(type, platform, arc +@@ -197,8 +197,7 @@ function packageTask(type, platform, arc const src = gulp.src(sourceFolderName + '/**', { base: '.' }) .pipe(rename(function (path) { path.dirname = path.dirname.replace(new RegExp('^' + sourceFolderName), 'out'); })) @@ -20,7 +20,7 @@ Index: code-server/lib/vscode/build/gulpfile.reh.js const workspaceExtensionPoints = ['debuggers', 'jsonValidation']; const isUIExtension = (manifest) => { -@@ -235,9 +234,9 @@ function packageTask(type, platform, arc +@@ -237,9 +236,9 @@ function packageTask(type, platform, arc .map(name => `.build/extensions/${name}/**`); const extensions = gulp.src(extensionPaths, { base: '.build', dot: true }); @@ -32,7 +32,7 @@ Index: code-server/lib/vscode/build/gulpfile.reh.js let version = packageJson.version; const quality = product.quality; -@@ -363,7 +362,7 @@ function packageTask(type, platform, arc +@@ -374,7 +373,7 @@ function tweakProductForServerWeb(produc const minifyTask = task.define(`minify-vscode-${type}`, task.series( optimizeTask, util.rimraf(`out-vscode-${type}-min`), diff --git a/patches/unique-db.diff b/patches/unique-db.diff index 5ea2fac3..ca3cc1af 100644 --- a/patches/unique-db.diff +++ b/patches/unique-db.diff @@ -21,7 +21,7 @@ Index: code-server/lib/vscode/src/vs/platform/storage/browser/storageService.ts @@ -13,6 +13,7 @@ import { InMemoryStorageDatabase, isStor import { ILogService } from 'vs/platform/log/common/log'; import { AbstractStorageService, IS_NEW_KEY, StorageScope, StorageTarget } from 'vs/platform/storage/common/storage'; - import { IWorkspaceInitializationPayload } from 'vs/platform/workspaces/common/workspaces'; + import { IAnyWorkspaceIdentifier } from 'vs/platform/workspace/common/workspace'; +import { hash } from 'vs/base/common/hash'; export class BrowserStorageService extends AbstractStorageService { diff --git a/patches/update-check.diff b/patches/update-check.diff index f9720da6..ccfd39d1 100644 --- a/patches/update-check.diff +++ b/patches/update-check.diff @@ -105,9 +105,9 @@ Index: code-server/lib/vscode/src/vs/server/node/webClientServer.ts productConfiguration: >{ rootEndpoint: base, + updateEndpoint: !this._environmentService.args['disable-update-check'] ? base + '/update/check' : undefined, + embedderIdentifier: 'server-distro', extensionsGallery: { ...this._productService.extensionsGallery, - 'resourceUrlTemplate': this._webExtensionResourceUrlTemplate ? this._webExtensionResourceUrlTemplate.with({ Index: code-server/lib/vscode/src/vs/server/node/serverEnvironmentService.ts =================================================================== --- code-server.orig/lib/vscode/src/vs/server/node/serverEnvironmentService.ts diff --git a/patches/webview.diff b/patches/webview.diff index c104034b..a4690114 100644 --- a/patches/webview.diff +++ b/patches/webview.diff @@ -10,7 +10,7 @@ Index: code-server/lib/vscode/src/vs/workbench/services/environment/browser/envi =================================================================== --- code-server.orig/lib/vscode/src/vs/workbench/services/environment/browser/environmentService.ts +++ code-server/lib/vscode/src/vs/workbench/services/environment/browser/environmentService.ts -@@ -240,7 +240,7 @@ export class BrowserWorkbenchEnvironment +@@ -176,7 +176,7 @@ export class BrowserWorkbenchEnvironment @memoize get webviewExternalEndpoint(): string { @@ -31,11 +31,11 @@ Index: code-server/lib/vscode/src/vs/server/node/webClientServer.ts _wrapWebWorkerExtHostInIframe, developmentOptions: { enableSmokeTestDriver: this._environmentService.driverHandle === 'web' ? true : undefined }, settingsSyncOptions: !this._environmentService.isBuilt && this._environmentService.args['enable-sync'] ? { enabled: true } : undefined, -Index: code-server/lib/vscode/src/vs/workbench/api/common/shared/webview.ts +Index: code-server/lib/vscode/src/vs/workbench/common/webview.ts =================================================================== ---- code-server.orig/lib/vscode/src/vs/workbench/api/common/shared/webview.ts -+++ code-server/lib/vscode/src/vs/workbench/api/common/shared/webview.ts -@@ -25,7 +25,7 @@ export const webviewResourceBaseHost = ' +--- code-server.orig/lib/vscode/src/vs/workbench/common/webview.ts ++++ code-server/lib/vscode/src/vs/workbench/common/webview.ts +@@ -24,7 +24,7 @@ export const webviewResourceBaseHost = ' export const webviewRootResourceAuthority = `vscode-resource.${webviewResourceBaseHost}`;