2022-03-22 23:07:14 +03: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 00:51:46 +03: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-22 23:07:14 +03:00
|
|
|
This can be tested by setting EXTENSIONS_GALLERY set to:
|
|
|
|
|
2023-10-05 02:44:54 +03:00
|
|
|
'{"serviceUrl": "https://my-extensions/api"}'
|
2022-03-22 23:07:14 +03:00
|
|
|
|
|
|
|
|
|
|
|
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-12-22 20:25:28 +03:00
|
|
|
@@ -47,6 +47,16 @@ else if (globalThis._VSCODE_PRODUCT_JSON
|
2022-10-18 02:30:39 +03:00
|
|
|
version: pkg.version
|
|
|
|
});
|
2022-03-22 23:07:14 +03:00
|
|
|
}
|
2022-10-18 02:30:39 +03:00
|
|
|
+
|
|
|
|
+ Object.assign(product, {
|
2022-03-22 23:07:14 +03: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 02:30:39 +03:00
|
|
|
+ })
|
|
|
|
+ });
|
2022-03-22 23:07:14 +03:00
|
|
|
}
|
|
|
|
|
2022-10-18 02:30:39 +03:00
|
|
|
// Web environment or unknown
|
2022-03-22 23:07:14 +03: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
|
2024-11-01 23:32:25 +03:00
|
|
|
@@ -115,7 +115,7 @@ export class WebClientServer {
|
2024-04-06 01:20:28 +03:00
|
|
|
|
2022-06-22 00:51:46 +03:00
|
|
|
this._staticRoute = `${serverRootPath}/static`;
|
|
|
|
this._callbackRoute = `${serverRootPath}/callback`;
|
|
|
|
- this._webExtensionRoute = `${serverRootPath}/web-extension-resource`;
|
|
|
|
+ this._webExtensionRoute = `/web-extension-resource`;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2024-11-01 23:32:25 +03:00
|
|
|
@@ -313,14 +313,7 @@ export class WebClientServer {
|
2023-05-16 02:44:03 +03:00
|
|
|
codeServerVersion: this._productService.codeServerVersion,
|
|
|
|
rootEndpoint: base,
|
|
|
|
embedderIdentifier: 'server-distro',
|
2024-06-07 02:02:13 +03:00
|
|
|
- extensionsGallery: this._webExtensionResourceUrlTemplate && this._productService.extensionsGallery ? {
|
2023-05-16 02:44:03 +03:00
|
|
|
- ...this._productService.extensionsGallery,
|
2024-06-07 02:02:13 +03:00
|
|
|
- resourceUrlTemplate: this._webExtensionResourceUrlTemplate.with({
|
2023-05-16 02:44:03 +03:00
|
|
|
- scheme: 'http',
|
|
|
|
- authority: remoteAuthority,
|
|
|
|
- path: `${this._webExtensionRoute}/${this._webExtensionResourceUrlTemplate.authority}${this._webExtensionResourceUrlTemplate.path}`
|
|
|
|
- }).toString(true)
|
|
|
|
- } : undefined
|
|
|
|
+ extensionsGallery: this._productService.extensionsGallery,
|
2024-06-07 02:02:13 +03:00
|
|
|
} satisfies Partial<IProductConfiguration>;
|
2023-05-16 02:44:03 +03:00
|
|
|
|
|
|
|
if (!this._environmentService.isBuilt) {
|
2022-11-10 01:10:03 +03:00
|
|
|
Index: code-server/lib/vscode/src/vs/platform/extensionResourceLoader/common/extensionResourceLoader.ts
|
2022-06-22 00:51:46 +03:00
|
|
|
===================================================================
|
2022-11-10 01:10:03 +03:00
|
|
|
--- code-server.orig/lib/vscode/src/vs/platform/extensionResourceLoader/common/extensionResourceLoader.ts
|
|
|
|
+++ code-server/lib/vscode/src/vs/platform/extensionResourceLoader/common/extensionResourceLoader.ts
|
2024-10-18 07:31:28 +03:00
|
|
|
@@ -15,7 +15,6 @@ import { getServiceMachineId } from '../
|
|
|
|
import { IStorageService } from '../../storage/common/storage.js';
|
|
|
|
import { TelemetryLevel } from '../../telemetry/common/telemetry.js';
|
|
|
|
import { getTelemetryLevel, supportsTelemetry } from '../../telemetry/common/telemetryUtils.js';
|
|
|
|
-import { RemoteAuthorities } from '../../../base/common/network.js';
|
|
|
|
import { TargetPlatform } from '../../extensions/common/extensions.js';
|
2024-08-16 08:33:21 +03:00
|
|
|
|
|
|
|
const WEB_EXTENSION_RESOURCE_END_POINT_SEGMENT = '/web-extension-resource/';
|
|
|
|
@@ -140,9 +139,9 @@ export abstract class AbstractExtensionR
|
2024-04-06 01:20:28 +03:00
|
|
|
}
|
2022-06-22 00:51:46 +03:00
|
|
|
|
2024-04-06 01:20:28 +03:00
|
|
|
protected _isWebExtensionResourceEndPoint(uri: URI): boolean {
|
|
|
|
- const uriPath = uri.path, serverRootPath = RemoteAuthorities.getServerRootPath();
|
|
|
|
- // test if the path starts with the server root path followed by the web extension resource end point segment
|
|
|
|
- return uriPath.startsWith(serverRootPath) && uriPath.startsWith(WEB_EXTENSION_RESOURCE_END_POINT_SEGMENT, serverRootPath.length);
|
|
|
|
+ const uriPath = uri.path;
|
|
|
|
+ // test if the path starts with the web extension resource end point segment
|
|
|
|
+ return uriPath.startsWith(WEB_EXTENSION_RESOURCE_END_POINT_SEGMENT);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|