mirror of
https://github.com/coder/code-server.git
synced 2026-09-26 09:12:28 +02:00
* Update Code to 1.139.1 * Bump proxy-addr to 2.0.8 * Add preinstall setup to build Already had this in the release build step, not sure why it is not in the main build step. But we started getting errors building native modules in ci, and this seems to be why. * Fix quick input It types too quickly, before the input is visible.
108 lines
5.9 KiB
Diff
108 lines
5.9 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 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.
|
|
|
|
This can be tested by setting EXTENSIONS_GALLERY set to:
|
|
|
|
'{"serviceUrl": "https://my-extensions/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
|
|
@@ -65,6 +65,17 @@ else if (globalThis._VSCODE_PRODUCT_JSON
|
|
Object.assign(product, { copilotVersions: { runtime: packageConfiguration.copilotRuntimeVersion, sdk } });
|
|
}
|
|
}
|
|
+
|
|
+ Object.assign(product, {
|
|
+ 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",
|
|
+ extensionUrlTemplate: "https://open-vsx.org/vscode/gallery/{publisher}/{name}/latest",
|
|
+ resourceUrlTemplate: "https://open-vsx.org/vscode/asset/{publisher}/{name}/{version}/Microsoft.VisualStudio.Code.WebResources/{path}",
|
|
+ controlUrl: "",
|
|
+ recommendationsUrl: "",
|
|
+ })
|
|
+ });
|
|
}
|
|
|
|
// Web environment or unknown
|
|
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
|
|
@@ -387,7 +387,6 @@ export class WebClientServer {
|
|
|
|
const staticRoute = posix.join(basePath, this._productPath, STATIC_PATH);
|
|
const callbackRoute = posix.join(basePath, this._productPath, CALLBACK_PATH);
|
|
- const webExtensionRoute = posix.join(basePath, this._productPath, WEB_EXTENSION_PATH);
|
|
|
|
const resolveWorkspaceURI = (defaultLocation?: string) => defaultLocation && URI.file(resolve(defaultLocation)).with({ scheme: Schemas.vscodeRemote, authority: remoteAuthority });
|
|
|
|
@@ -404,14 +403,7 @@ export class WebClientServer {
|
|
rootEndpoint: rootBase,
|
|
embedderIdentifier: 'server-distro',
|
|
voiceWsUrl: this._productService.voiceWsUrl,
|
|
- extensionsGallery: this._webExtensionResourceUrlTemplate && this._productService.extensionsGallery ? {
|
|
- ...this._productService.extensionsGallery,
|
|
- resourceUrlTemplate: this._webExtensionResourceUrlTemplate.with({
|
|
- scheme: 'http',
|
|
- authority: remoteAuthority,
|
|
- path: `${webExtensionRoute}/${this._webExtensionResourceUrlTemplate.authority}${this._webExtensionResourceUrlTemplate.path}`
|
|
- }).toString(true)
|
|
- } : undefined
|
|
+ extensionsGallery: this._productService.extensionsGallery,
|
|
};
|
|
|
|
if (!this._environmentService.isBuilt) {
|
|
Index: code-server/lib/vscode/src/vs/platform/extensionResourceLoader/common/extensionResourceLoader.ts
|
|
===================================================================
|
|
--- code-server.orig/lib/vscode/src/vs/platform/extensionResourceLoader/common/extensionResourceLoader.ts
|
|
+++ code-server/lib/vscode/src/vs/platform/extensionResourceLoader/common/extensionResourceLoader.ts
|
|
@@ -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';
|
|
import { ExtensionGalleryResourceType, getExtensionGalleryManifestResourceUri, IExtensionGalleryManifest, IExtensionGalleryManifestService } from '../../extensionManagement/common/extensionGalleryManifest.js';
|
|
import { ILogService } from '../../log/common/log.js';
|
|
@@ -163,9 +162,9 @@ export abstract class AbstractExtensionR
|
|
}
|
|
|
|
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);
|
|
}
|
|
|
|
}
|
|
Index: code-server/lib/vscode/src/vs/platform/externalServices/common/marketplace.ts
|
|
===================================================================
|
|
--- code-server.orig/lib/vscode/src/vs/platform/externalServices/common/marketplace.ts
|
|
+++ code-server/lib/vscode/src/vs/platform/externalServices/common/marketplace.ts
|
|
@@ -26,6 +26,10 @@ export async function resolveMarketplace
|
|
'User-Agent': `VSCode ${version} (${productService.nameShort})`
|
|
};
|
|
|
|
+ if (productService.extensionsGallery?.authorizationHeaderToken) {
|
|
+ headers['Authorization'] = `Bearer ${productService.extensionsGallery.authorizationHeaderToken}`;
|
|
+ }
|
|
+
|
|
if (supportsTelemetry(productService, environmentService) && getTelemetryLevel(configurationService) === TelemetryLevel.USAGE) {
|
|
const serviceMachineId = await getServiceMachineId(environmentService, fileService, storageService);
|
|
headers['X-Market-User-Id'] = serviceMachineId;
|