Skip to content

Commit 0de7cf5

Browse files
authored
Add configurable authorization header to marketplace API calls (#7596)
1 parent ea9a3a5 commit 0de7cf5

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

patches/marketplace.diff

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,3 +90,18 @@ Index: code-server/lib/vscode/src/vs/platform/extensionResourceLoader/common/ext
9090
}
9191

9292
}
93+
Index: code-server/lib/vscode/src/vs/platform/externalServices/common/marketplace.ts
94+
===================================================================
95+
--- code-server.orig/lib/vscode/src/vs/platform/externalServices/common/marketplace.ts
96+
+++ code-server/lib/vscode/src/vs/platform/externalServices/common/marketplace.ts
97+
@@ -26,6 +26,10 @@ export async function resolveMarketplace
98+
'User-Agent': `VSCode ${version} (${productService.nameShort})`
99+
};
100+
101+
+ if (productService.extensionsGallery?.authorizationHeaderToken) {
102+
+ headers['Authorization'] = `Bearer ${productService.extensionsGallery.authorizationHeaderToken}`;
103+
+ }
104+
+
105+
if (supportsTelemetry(productService, environmentService) && getTelemetryLevel(configurationService) === TelemetryLevel.USAGE) {
106+
const serviceMachineId = await getServiceMachineId(environmentService, fileService, storageService);
107+
headers['X-Market-User-Id'] = serviceMachineId;

patches/update-check.diff

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,14 @@ Index: code-server/lib/vscode/src/vs/base/common/product.ts
101101

102102
readonly version: string;
103103
readonly date?: string;
104+
@@ -112,6 +113,7 @@ export interface IProductConfiguration {
105+
readonly resourceUrlTemplate: string;
106+
readonly nlsBaseUrl: string;
107+
readonly accessSKUs?: string[];
108+
+ readonly authorizationHeaderToken?: string;
109+
};
110+
111+
readonly mcpGallery?: {
104112
Index: code-server/lib/vscode/src/vs/server/node/webClientServer.ts
105113
===================================================================
106114
--- code-server.orig/lib/vscode/src/vs/server/node/webClientServer.ts

0 commit comments

Comments
 (0)