fix(telemetry): report real VS Code platform and honor usage opt-out
The VS Code bridge re-mapped the already-mapped platform value from the webview, collapsing every install to platform "web"; it also sent the installId even when usage reporting was disabled. The remote-instance update poll in the header and the post-update wait poll now send reportUsage=false so status checks no longer count as activity.
This commit is contained in:
@@ -77,10 +77,13 @@ const getOrCreateInstallId = (scope: string): string => {
|
||||
return installId;
|
||||
};
|
||||
|
||||
const mapNodePlatformToApiPlatform = (value: string): 'macos' | 'windows' | 'linux' | 'web' => {
|
||||
const mapNodePlatformToApiPlatform = (value: string): 'macos' | 'windows' | 'linux' | 'android' | 'ios' | 'web' => {
|
||||
// The webview already sends API-shaped values; Node's os.platform() is the fallback source.
|
||||
if (value === 'macos' || value === 'windows' || value === 'linux' || value === 'android' || value === 'ios' || value === 'web') {
|
||||
return value;
|
||||
}
|
||||
if (value === 'darwin') return 'macos';
|
||||
if (value === 'win32') return 'windows';
|
||||
if (value === 'linux') return 'linux';
|
||||
return 'web';
|
||||
};
|
||||
|
||||
@@ -315,7 +318,6 @@ export async function handleSystemBridgeMessage(
|
||||
: os.arch();
|
||||
const reportUsage = body.reportUsage !== false;
|
||||
|
||||
const installId = getOrCreateInstallId('vscode');
|
||||
const requestBody = {
|
||||
appType: 'vscode',
|
||||
deviceClass,
|
||||
@@ -323,7 +325,7 @@ export async function handleSystemBridgeMessage(
|
||||
arch: mapNodeArchToApiArch(archRaw),
|
||||
channel: 'stable',
|
||||
currentVersion,
|
||||
installId,
|
||||
...(reportUsage ? { installId: getOrCreateInstallId('vscode') } : {}),
|
||||
instanceMode,
|
||||
reportUsage,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user