UNPKG

sussudio

Version:

An unofficial VS Code Internal API

17 lines (16 loc) 1.01 kB
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ import { isMacintosh } from "../../../base/common/platform.mjs"; import { getMachineId } from "../../../base/node/id.mjs"; import { machineIdKey } from "../common/telemetry.mjs"; export async function resolveMachineId(stateService) { // We cache the machineId for faster lookups // and resolve it only once initially if not cached or we need to replace the macOS iBridge device let machineId = stateService.getItem(machineIdKey); if (typeof machineId !== 'string' || (isMacintosh && machineId === '6c9d2bc8f91b89624add29c0abeae7fb42bf539fa1cdb2e3e57cd668fa9bcead')) { machineId = await getMachineId(); } return machineId; }