Merge from vscode 708b019bb4e20f07cf89df9f1d943af3d38d7a70 (#9657)

This commit is contained in:
Anthony Dresser
2020-03-17 22:35:18 -07:00
committed by GitHub
parent 5ee7454793
commit 61831d8642
71 changed files with 5191 additions and 372 deletions

View File

@@ -26,6 +26,7 @@ import { IProductService } from 'vs/platform/product/common/productService';
import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage';
import { find } from 'vs/base/common/arrays';
import { getServiceMachineId } from 'vs/platform/serviceMachineId/common/serviceMachineId';
import { optional } from 'vs/platform/instantiation/common/instantiation';
interface IRawGalleryExtensionFile {
assetType: string;
@@ -387,12 +388,12 @@ export class ExtensionGalleryService implements IExtensionGalleryService {
@IConfigurationService private configurationService: IConfigurationService, // {{SQL CARBON EDIT}}
@IFileService private readonly fileService: IFileService,
@IProductService private readonly productService: IProductService,
@IStorageService private readonly storageService: IStorageService,
@optional(IStorageService) storageService: IStorageService,
) {
const config = productService.extensionsGallery;
this.extensionsGalleryUrl = config && config.serviceUrl;
this.extensionsControlUrl = config && config.controlUrl;
this.commonHeadersPromise = resolveMarketplaceHeaders(productService.version, this.environmentService, this.fileService, this.storageService);
this.commonHeadersPromise = resolveMarketplaceHeaders(productService.version, this.environmentService, this.fileService, storageService);
}
private api(path = ''): string {
@@ -928,12 +929,14 @@ export class ExtensionGalleryService implements IExtensionGalleryService {
export async function resolveMarketplaceHeaders(version: string, environmentService: IEnvironmentService, fileService: IFileService, storageService: {
get: (key: string, scope: StorageScope) => string | undefined,
store: (key: string, value: string, scope: StorageScope) => void
}): Promise<{ [key: string]: string; }> {
} | undefined): Promise<{ [key: string]: string; }> {
const headers: IHeaders = {
'X-Market-Client-Id': `VSCode ${version}`,
'User-Agent': `VSCode ${version}`
};
const uuid: string = await getServiceMachineId(environmentService, fileService, storageService);
headers['X-Market-User-Id'] = uuid;
const uuid = await getServiceMachineId(environmentService, fileService, storageService);
if (uuid) {
headers['X-Market-User-Id'] = uuid;
}
return headers;
}