@@ -3,6 +3,13 @@ Add Open VSX default and an env var for marketplace, fix old marketplace
33Our old marketplace only supports `serviceUrl` but this causes the marketplace
44to be disabled entirely so this moves the template var check to fix that.
55
6+ This also removes serverRootPath from the web extension route because that will
7+ include the commit. When you update code-server (including this update) the web
8+ extension will continue using the old path since it is stored in the browser but
9+ the path will 404 because the commit no longer matches. This change is only to
10+ support current installations though because this patch also removes the
11+ in-between and has web extensions install directly from the marketplace.
12+
613This can be tested by setting EXTENSIONS_GALLERY set to:
714
815 '{"serviceUrl": "https://extensions.coder.com/api"}'
@@ -32,22 +39,41 @@ Index: code-server/lib/vscode/src/vs/server/node/webClientServer.ts
3239===================================================================
3340--- code-server.orig/lib/vscode/src/vs/server/node/webClientServer.ts
3441+++ code-server/lib/vscode/src/vs/server/node/webClientServer.ts
35- @@ -308,14 +308,14 @@ export class WebClientServer {
42+ @@ -111,7 +111,7 @@ export class WebClientServer {
43+ const serverRootPath = getRemoteServerRootPath(_productService);
44+ this._staticRoute = `${serverRootPath}/static`;
45+ this._callbackRoute = `${serverRootPath}/callback`;
46+ - this._webExtensionRoute = `${serverRootPath}/web-extension-resource`;
47+ + this._webExtensionRoute = `/web-extension-resource`;
48+ }
49+
50+ /**
51+ @@ -308,14 +308,7 @@ export class WebClientServer {
3652 codeServerVersion: this._productService.codeServerVersion,
3753 rootEndpoint: base,
3854 embedderIdentifier: 'server-distro',
3955- extensionsGallery: this._webExtensionResourceUrlTemplate ? {
40- + extensionsGallery: {
41- ...this._productService.extensionsGallery,
56+ - ...this._productService.extensionsGallery,
4257- 'resourceUrlTemplate': this._webExtensionResourceUrlTemplate.with({
43- + 'resourceUrlTemplate': this._webExtensionResourceUrlTemplate ? this._webExtensionResourceUrlTemplate.with({
44- scheme: 'http',
45- authority: remoteAuthority,
46- path: `${this._webExtensionRoute}/${this._webExtensionResourceUrlTemplate.authority}${this._webExtensionResourceUrlTemplate.path}`
58+ - scheme: 'http',
59+ - authority: remoteAuthority,
60+ - path: `${this._webExtensionRoute}/${this._webExtensionResourceUrlTemplate.authority}${this._webExtensionResourceUrlTemplate.path}`
4761- }).toString(true)
4862- } : undefined
49- + }).toString(true) : undefined
50- + }
63+ + extensionsGallery: this._productService.extensionsGallery,
5164 },
5265 callbackRoute: this._callbackRoute
5366 };
67+ Index: code-server/lib/vscode/src/vs/workbench/services/extensionResourceLoader/common/extensionResourceLoader.ts
68+ ===================================================================
69+ --- code-server.orig/lib/vscode/src/vs/workbench/services/extensionResourceLoader/common/extensionResourceLoader.ts
70+ +++ code-server/lib/vscode/src/vs/workbench/services/extensionResourceLoader/common/extensionResourceLoader.ts
71+ @@ -60,7 +60,7 @@ export abstract class AbstractExtensionR
72+ private readonly _environmentService: IEnvironmentService,
73+ private readonly _configurationService: IConfigurationService,
74+ ) {
75+ - this._webExtensionResourceEndPoint = `${getRemoteServerRootPath(_productService)}/${WEB_EXTENSION_RESOURCE_END_POINT}/`;
76+ + this._webExtensionResourceEndPoint = `/${WEB_EXTENSION_RESOURCE_END_POINT}/`;
77+ if (_productService.extensionsGallery) {
78+ this._extensionGalleryResourceUrlTemplate = _productService.extensionsGallery.resourceUrlTemplate;
79+ this._extensionGalleryAuthority = this._extensionGalleryResourceUrlTemplate ? this._getExtensionGalleryAuthority(URI.parse(this._extensionGalleryResourceUrlTemplate)) : undefined;
0 commit comments