提交 d5a55ef7 编写于 作者: S Sandeep Somavarapu

Fix #83215

上级 404f66c1
......@@ -63,8 +63,7 @@ export interface IEnvironmentService {
// --- misc
disableTelemetry: boolean;
// TODO@sandeep move into node layer (https://github.com/microsoft/vscode/issues/94504)
serviceMachineIdResource?: URI;
serviceMachineIdResource: URI;
/**
* @deprecated use IRemotePathService#userHome instead (https://github.com/microsoft/vscode/issues/94506)
......
......@@ -769,8 +769,6 @@ export async function resolveMarketplaceHeaders(version: string, environmentServ
'User-Agent': `VSCode ${version}`
};
const uuid = await getServiceMachineId(environmentService, fileService, storageService);
if (uuid) {
headers['X-Market-User-Id'] = uuid;
}
return headers;
}
......@@ -12,12 +12,11 @@ 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
} | undefined): Promise<string | null> {
} | undefined): Promise<string> {
let uuid: string | null = storageService ? storageService.get('storage.serviceMachineId', StorageScope.GLOBAL) || null : null;
if (uuid) {
return uuid;
}
if (environmentService.serviceMachineIdResource) {
try {
const contents = await fileService.readFile(environmentService.serviceMachineIdResource);
const value = contents.value.toString();
......@@ -34,8 +33,7 @@ export async function getServiceMachineId(environmentService: IEnvironmentServic
//noop
}
}
}
if (uuid && storageService) {
if (storageService) {
storageService.store('storage.serviceMachineId', uuid, StorageScope.GLOBAL);
}
return uuid;
......
......@@ -43,9 +43,7 @@ export class UserDataSyncStoreService extends Disposable implements IUserDataSyn
const headers: IHeaders = {
'X-Sync-Client-Id': productService.version,
};
if (uuid) {
headers['X-Sync-Machine-Id'] = uuid;
}
return headers;
});
}
......
......@@ -134,6 +134,9 @@ export class BrowserWorkbenchEnvironmentService implements IWorkbenchEnvironment
@memoize
get untitledWorkspacesHome(): URI { return joinPath(this.userRoamingDataHome, 'Workspaces'); }
@memoize
get serviceMachineIdResource(): URI { return joinPath(this.userRoamingDataHome, 'machineid'); }
private _extensionHostDebugEnvironment: IExtensionHostDebugEnvironment | undefined = undefined;
get debugExtensionHost(): IExtensionHostDebugParams {
if (!this._extensionHostDebugEnvironment) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册