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

Fix #83215

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