|
1 | 1 | import { useEffect, useRef, useState } from 'react' |
2 | 2 | import posthog from 'posthog-js' |
3 | | -import { addBreadcrumb, setTags, setTag, setContext, captureSessionSummary } from '../utils/telemetry' |
| 3 | +import { addBreadcrumb, setTags, setTag, captureSessionSummary } from '../utils/telemetry' |
4 | 4 |
|
5 | 5 | import { FlashManager, StepCode, ErrorCode, DeviceType } from '../utils/manager' |
6 | 6 | import { useImageManager } from '../utils/image' |
@@ -55,38 +55,6 @@ const originalConsole = { log: console.log, warn: console.warn, error: console.e |
55 | 55 | // Unique per-page session id for correlating events |
56 | 56 | const SESSION_ID = (crypto && 'randomUUID' in crypto) ? crypto.randomUUID() : String(Math.random()).slice(2) |
57 | 57 |
|
58 | | -// Helper for building environment metadata |
59 | | -function buildEnvMeta() { |
60 | | - const ua = navigator.userAgent |
61 | | - let os = 'Unknown' |
62 | | - if (ua.includes('Windows NT 10.0')) os = 'Windows 10/11' |
63 | | - else if (ua.includes('Windows NT 6.3')) os = 'Windows 8.1' |
64 | | - else if (ua.includes('Windows NT 6.2')) os = 'Windows 8' |
65 | | - else if (ua.includes('Windows NT 6.1')) os = 'Windows 7' |
66 | | - else if (ua.includes('Mac OS X')) { |
67 | | - const match = ua.match(/Mac OS X (\d+[._]\d+[._]?\d*)/) |
68 | | - os = match ? `macOS ${match[1].replace(/_/g, '.')}` : 'macOS' |
69 | | - } else if (ua.includes('Linux')) { |
70 | | - os = 'Linux' |
71 | | - if (ua.includes('Ubuntu')) os += ' (Ubuntu)' |
72 | | - else if (ua.includes('Fedora')) os += ' (Fedora)' |
73 | | - else if (ua.includes('Debian')) os += ' (Debian)' |
74 | | - } else if (ua.includes('CrOS')) os = 'ChromeOS' |
75 | | - |
76 | | - const sandboxHints = [] |
77 | | - if (ua.includes('snap')) sandboxHints.push('Snap') |
78 | | - if (ua.includes('Flatpak')) sandboxHints.push('Flatpak') |
79 | | - if (navigator.userAgentData?.brands?.some(b => b.brand.includes('snap'))) sandboxHints.push('Snap') |
80 | | - |
81 | | - return { |
82 | | - os, |
83 | | - sandbox: sandboxHints.length ? sandboxHints.join(', ') : 'None detected', |
84 | | - browser: navigator.userAgent, |
85 | | - url: window.location.href, |
86 | | - version: import.meta.env.VITE_PUBLIC_GIT_SHA || 'dev', |
87 | | - } |
88 | | -} |
89 | | - |
90 | 58 | // Debug info component for error reporting |
91 | 59 | function DebugInfo({ error, step, selectedDevice, serial, message, onClose }) { |
92 | 60 | const [copied, setCopied] = useState(false) |
@@ -717,7 +685,6 @@ export default function Flash() { |
717 | 685 | // Telemetry: set static tags/context once |
718 | 686 | useEffect(() => { |
719 | 687 | setTags({ session_id: SESSION_ID }) |
720 | | - setContext('env', buildEnvMeta()) |
721 | 688 | }, []) |
722 | 689 |
|
723 | 690 | // Telemetry: tag device selection |
@@ -751,14 +718,7 @@ export default function Flash() { |
751 | 718 | }) |
752 | 719 |
|
753 | 720 | // Sentry (for errors with full context) |
754 | | - const meta = { |
755 | | - ...buildEnvMeta(), |
756 | | - selectedDevice, |
757 | | - connected, |
758 | | - serial, |
759 | | - step, |
760 | | - message, |
761 | | - } |
| 721 | + const meta = { selectedDevice, serial, step, message } |
762 | 722 | const tail = consoleLogs.slice(-200) |
763 | 723 | captureSessionSummary({ |
764 | 724 | sessionId: SESSION_ID, |
|
0 commit comments