2022-03-23 04:07:14 +08:00
|
|
|
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.
|
|
|
|
|
2022-06-22 05:51:46 +08:00
|
|
|
This also removes serverRootPath from the web extension route because that will
|
|
|
|
include the commit. When you update code-server (including this update) the web
|
|
|
|
extension will continue using the old path since it is stored in the browser but
|
|
|
|
the path will 404 because the commit no longer matches. This change is only to
|
|
|
|
support current installations though because this patch also removes the
|
|
|
|
in-between and has web extensions install directly from the marketplace.
|
|
|
|
|
2022-03-23 04:07:14 +08:00
|
|
|
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
|
2022-10-18 07:30:39 +08:00
|
|
|
@@ -53,6 +53,16 @@ else if (typeof require?.__$__nodeRequir
|
|
|
|
version: pkg.version
|
|
|
|
});
|
2022-03-23 04:07:14 +08:00
|
|
|
}
|
2022-10-18 07:30:39 +08:00
|
|
|
+
|
|
|
|
+ Object.assign(product, {
|
2022-03-23 04:07:14 +08:00
|
|
|
+ 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: "",
|
2022-10-18 07:30:39 +08:00
|
|
|
+ })
|
|
|
|
+ });
|
2022-03-23 04:07:14 +08:00
|
|
|
}
|
|
|
|
|
2022-10-18 07:30:39 +08:00
|
|
|
// Web environment or unknown
|
2022-03-23 04:07:14 +08:00
|
|
|
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
|
2022-06-22 05:51:46 +08:00
|
|
|
@@ -111,7 +111,7 @@ export class WebClientServer {
|
|
|
|
const serverRootPath = getRemoteServerRootPath(_productService);
|
|
|
|
this._staticRoute = `${serverRootPath}/static`;
|
|
|
|
this._callbackRoute = `${serverRootPath}/callback`;
|
|
|
|
- this._webExtensionRoute = `${serverRootPath}/web-extension-resource`;
|
|
|
|
+ this._webExtensionRoute = `/web-extension-resource`;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2022-08-17 09:26:19 +08:00
|
|
|
@@ -312,14 +312,7 @@ export class WebClientServer {
|
2022-06-22 05:51:46 +08:00
|
|
|
codeServerVersion: this._productService.codeServerVersion,
|
|
|
|
rootEndpoint: base,
|
|
|
|
embedderIdentifier: 'server-distro',
|
|
|
|
- extensionsGallery: this._webExtensionResourceUrlTemplate ? {
|
|
|
|
- ...this._productService.extensionsGallery,
|
|
|
|
- 'resourceUrlTemplate': this._webExtensionResourceUrlTemplate.with({
|
|
|
|
- scheme: 'http',
|
|
|
|
- authority: remoteAuthority,
|
|
|
|
- path: `${this._webExtensionRoute}/${this._webExtensionResourceUrlTemplate.authority}${this._webExtensionResourceUrlTemplate.path}`
|
|
|
|
- }).toString(true)
|
|
|
|
- } : undefined
|
|
|
|
+ extensionsGallery: this._productService.extensionsGallery,
|
|
|
|
},
|
|
|
|
callbackRoute: this._callbackRoute
|
|
|
|
};
|
2022-11-04 05:21:39 +08:00
|
|
|
Index: code-server/lib/vscode/src/vs/platform/extensionResourceLoader/common/extensionResourceLoader.ts
|
2022-06-22 05:51:46 +08:00
|
|
|
===================================================================
|
2022-11-04 05:21:39 +08:00
|
|
|
--- code-server.orig/lib/vscode/src/vs/platform/extensionResourceLoader/common/extensionResourceLoader.ts
|
|
|
|
+++ code-server/lib/vscode/src/vs/platform/extensionResourceLoader/common/extensionResourceLoader.ts
|
2022-06-22 05:51:46 +08:00
|
|
|
@@ -16,7 +16,6 @@ import { getServiceMachineId } from 'vs/
|
|
|
|
import { IStorageService } from 'vs/platform/storage/common/storage';
|
|
|
|
import { TelemetryLevel } from 'vs/platform/telemetry/common/telemetry';
|
|
|
|
import { getTelemetryLevel, supportsTelemetry } from 'vs/platform/telemetry/common/telemetryUtils';
|
|
|
|
-import { getRemoteServerRootPath } from 'vs/platform/remote/common/remoteHosts';
|
|
|
|
|
|
|
|
export const WEB_EXTENSION_RESOURCE_END_POINT = 'web-extension-resource';
|
|
|
|
|
|
|
|
@@ -60,7 +59,7 @@ export abstract class AbstractExtensionR
|
|
|
|
private readonly _environmentService: IEnvironmentService,
|
|
|
|
private readonly _configurationService: IConfigurationService,
|
|
|
|
) {
|
|
|
|
- this._webExtensionResourceEndPoint = `${getRemoteServerRootPath(_productService)}/${WEB_EXTENSION_RESOURCE_END_POINT}/`;
|
2022-11-09 01:48:34 +08:00
|
|
|
+ this._webExtensionResourceEndPoint = `/${WEB_EXTENSION_RESOURCE_END_POINT}/`;
|
2022-06-22 05:51:46 +08:00
|
|
|
if (_productService.extensionsGallery) {
|
|
|
|
this._extensionGalleryResourceUrlTemplate = _productService.extensionsGallery.resourceUrlTemplate;
|
|
|
|
this._extensionGalleryAuthority = this._extensionGalleryResourceUrlTemplate ? this._getExtensionGalleryAuthority(URI.parse(this._extensionGalleryResourceUrlTemplate)) : undefined;
|