mirror of
https://github.com/coder/code-server.git
synced 2024-12-05 07:13:06 +08:00
54 lines
2.4 KiB
Diff
54 lines
2.4 KiB
Diff
Add Open VSX default and an env var for marketplace, fix old marketplace
|
|
|
|
Our old marketplace only supports `serviceUrl` but this causes the marketplace
|
|
to be disabled entirely so this moves the template var check to fix that.
|
|
|
|
This can be tested by setting EXTENSIONS_GALLERY set to:
|
|
|
|
'{"serviceUrl": "https://extensions.coder.com/api"}'
|
|
|
|
|
|
Index: code-server/lib/vscode/src/vs/platform/product/common/product.ts
|
|
===================================================================
|
|
--- code-server.orig/lib/vscode/src/vs/platform/product/common/product.ts
|
|
+++ code-server/lib/vscode/src/vs/platform/product/common/product.ts
|
|
@@ -45,7 +45,14 @@ else if (typeof require?.__$__nodeRequir
|
|
}
|
|
|
|
Object.assign(product, {
|
|
- version: pkg.version
|
|
+ version: pkg.version,
|
|
+ extensionsGallery: env.EXTENSIONS_GALLERY ? JSON.parse(env.EXTENSIONS_GALLERY) : (product.extensionsGallery || {
|
|
+ serviceUrl: "https://open-vsx.org/vscode/gallery",
|
|
+ itemUrl: "https://open-vsx.org/vscode/item",
|
|
+ resourceUrlTemplate: "https://open-vsx.org/vscode/asset/{publisher}/{name}/{version}/Microsoft.VisualStudio.Code.WebResources/{path}",
|
|
+ controlUrl: "",
|
|
+ recommendationsUrl: "",
|
|
+ }),
|
|
});
|
|
}
|
|
|
|
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
|
|
@@ -293,14 +293,14 @@ export class WebClientServer {
|
|
rootEndpoint: base,
|
|
codeServerVersion: this._productService.codeServerVersion,
|
|
embedderIdentifier: 'server-distro',
|
|
- extensionsGallery: this._webExtensionResourceUrlTemplate ? {
|
|
+ extensionsGallery: {
|
|
...this._productService.extensionsGallery,
|
|
- 'resourceUrlTemplate': this._webExtensionResourceUrlTemplate.with({
|
|
+ 'resourceUrlTemplate': this._webExtensionResourceUrlTemplate ? this._webExtensionResourceUrlTemplate.with({
|
|
scheme: 'http',
|
|
authority: remoteAuthority,
|
|
path: `web-extension-resource/${this._webExtensionResourceUrlTemplate.authority}${this._webExtensionResourceUrlTemplate.path}`
|
|
- }).toString(true)
|
|
- } : undefined
|
|
+ }).toString(true) : undefined
|
|
+ },
|
|
}
|
|
})))
|
|
.replace('{{WORKBENCH_AUTH_SESSION}}', () => authSessionInfo ? escapeAttribute(JSON.stringify(authSessionInfo)) : '')
|