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:
@@ -950,7 +950,8 @@ export const Header: React.FC<HeaderProps> = ({
|
|||||||
setRemoteUpdateChecking(true);
|
setRemoteUpdateChecking(true);
|
||||||
setRemoteUpdateError(null);
|
setRemoteUpdateError(null);
|
||||||
try {
|
try {
|
||||||
const params = new URLSearchParams({ appType: 'web', instanceMode: 'remote' });
|
// Status-only poll: must not count as usage on the remote server's install id.
|
||||||
|
const params = new URLSearchParams({ appType: 'web', instanceMode: 'remote', reportUsage: 'false' });
|
||||||
const response = await runtimeFetch(`/api/openchamber/update-check?${params.toString()}`, {
|
const response = await runtimeFetch(`/api/openchamber/update-check?${params.toString()}`, {
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
headers: { Accept: 'application/json' },
|
headers: { Accept: 'application/json' },
|
||||||
|
|||||||
@@ -161,7 +161,8 @@ async function waitForUpdateApplied(
|
|||||||
): Promise<boolean> {
|
): Promise<boolean> {
|
||||||
for (let i = 0; i < maxAttempts; i++) {
|
for (let i = 0; i < maxAttempts; i++) {
|
||||||
try {
|
try {
|
||||||
const response = await runtimeFetch('/api/openchamber/update-check', {
|
// Status-only poll while waiting for the update to apply; not a usage report.
|
||||||
|
const response = await runtimeFetch('/api/openchamber/update-check?reportUsage=false', {
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
headers: { Accept: 'application/json' },
|
headers: { Accept: 'application/json' },
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -77,10 +77,13 @@ const getOrCreateInstallId = (scope: string): string => {
|
|||||||
return installId;
|
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 === 'darwin') return 'macos';
|
||||||
if (value === 'win32') return 'windows';
|
if (value === 'win32') return 'windows';
|
||||||
if (value === 'linux') return 'linux';
|
|
||||||
return 'web';
|
return 'web';
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -315,7 +318,6 @@ export async function handleSystemBridgeMessage(
|
|||||||
: os.arch();
|
: os.arch();
|
||||||
const reportUsage = body.reportUsage !== false;
|
const reportUsage = body.reportUsage !== false;
|
||||||
|
|
||||||
const installId = getOrCreateInstallId('vscode');
|
|
||||||
const requestBody = {
|
const requestBody = {
|
||||||
appType: 'vscode',
|
appType: 'vscode',
|
||||||
deviceClass,
|
deviceClass,
|
||||||
@@ -323,7 +325,7 @@ export async function handleSystemBridgeMessage(
|
|||||||
arch: mapNodeArchToApiArch(archRaw),
|
arch: mapNodeArchToApiArch(archRaw),
|
||||||
channel: 'stable',
|
channel: 'stable',
|
||||||
currentVersion,
|
currentVersion,
|
||||||
installId,
|
...(reportUsage ? { installId: getOrCreateInstallId('vscode') } : {}),
|
||||||
instanceMode,
|
instanceMode,
|
||||||
reportUsage,
|
reportUsage,
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user