mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-17 02:51:36 -05:00
Merge from vscode 708b019bb4e20f07cf89df9f1d943af3d38d7a70 (#9657)
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -134,7 +134,7 @@ function storeServiceDependency(id: Function, target: Function, index: number, o
|
||||
}
|
||||
|
||||
/**
|
||||
* A *only* valid way to create a {{ServiceIdentifier}}.
|
||||
* The *only* valid way to create a {{ServiceIdentifier}}.
|
||||
*/
|
||||
export function createDecorator<T>(serviceId: string): ServiceIdentifier<T> {
|
||||
|
||||
|
||||
@@ -12,8 +12,8 @@ import { VSBuffer } from 'vs/base/common/buffer';
|
||||
export async function getServiceMachineId(environmentService: IEnvironmentService, fileService: IFileService, storageService: {
|
||||
get: (key: string, scope: StorageScope, fallbackValue?: string | undefined) => string | undefined,
|
||||
store: (key: string, value: string, scope: StorageScope) => void
|
||||
}): Promise<string> {
|
||||
let uuid: string | null = storageService.get('storage.serviceMachineId', StorageScope.GLOBAL) || null;
|
||||
} | undefined): Promise<string | null> {
|
||||
let uuid: string | null = storageService ? storageService.get('storage.serviceMachineId', StorageScope.GLOBAL) || null : null;
|
||||
if (uuid) {
|
||||
return uuid;
|
||||
}
|
||||
@@ -34,9 +34,9 @@ export async function getServiceMachineId(environmentService: IEnvironmentServic
|
||||
//noop
|
||||
}
|
||||
}
|
||||
} else {
|
||||
uuid = generateUuid();
|
||||
}
|
||||
storageService.store('storage.serviceMachineId', uuid, StorageScope.GLOBAL);
|
||||
if (uuid && storageService) {
|
||||
storageService.store('storage.serviceMachineId', uuid, StorageScope.GLOBAL);
|
||||
}
|
||||
return uuid;
|
||||
}
|
||||
|
||||
@@ -40,10 +40,15 @@ export class UserDataSyncStoreService extends Disposable implements IUserDataSyn
|
||||
super();
|
||||
this.userDataSyncStore = getUserDataSyncStore(productService, configurationService);
|
||||
this.commonHeadersPromise = getServiceMachineId(environmentService, fileService, storageService)
|
||||
.then(uuid => ({
|
||||
'X-Sync-Client-Id': productService.version,
|
||||
'X-Sync-Machine-Id': uuid
|
||||
}));
|
||||
.then(uuid => {
|
||||
const headers: IHeaders = {
|
||||
'X-Sync-Client-Id': productService.version,
|
||||
};
|
||||
if (uuid) {
|
||||
headers['X-Sync-Machine-Id'] = uuid;
|
||||
}
|
||||
return headers;
|
||||
});
|
||||
}
|
||||
|
||||
async getAllRefs(resource: SyncResource): Promise<IResourceRefHandle[]> {
|
||||
|
||||
Reference in New Issue
Block a user