Stijnus
commited on
Commit
·
d372745
1
Parent(s):
85b0322
Update DebugTab.tsx
Browse filesFix debug information
- app/commit.json +1 -1
- app/components/settings/debug/DebugTab.tsx +116 -3
app/commit.json
CHANGED
@@ -1 +1 @@
|
|
1 |
-
{ "commit": "
|
|
|
1 |
+
{ "commit": "85b0322fd6e9c2760805e6372c487fb0432955de" }
|
app/components/settings/debug/DebugTab.tsx
CHANGED
@@ -21,6 +21,12 @@ interface SystemInfo {
|
|
21 |
timezone: string;
|
22 |
memory: string;
|
23 |
cores: number;
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
}
|
25 |
|
26 |
interface IProviderConfig {
|
@@ -50,14 +56,100 @@ function getSystemInfo(): SystemInfo {
|
|
50 |
return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + ' ' + sizes[i];
|
51 |
};
|
52 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
53 |
return {
|
54 |
-
os:
|
55 |
-
browser:
|
56 |
screen: `${window.screen.width}x${window.screen.height}`,
|
57 |
language: navigator.language,
|
58 |
timezone: Intl.DateTimeFormat().resolvedOptions().timeZone,
|
59 |
-
memory:
|
60 |
cores: navigator.hardwareConcurrency || 0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
61 |
};
|
62 |
}
|
63 |
|
@@ -371,10 +463,31 @@ export default function DebugTab() {
|
|
371 |
<p className="text-xs text-bolt-elements-textSecondary">Operating System</p>
|
372 |
<p className="text-sm font-medium text-bolt-elements-textPrimary">{systemInfo.os}</p>
|
373 |
</div>
|
|
|
|
|
|
|
|
|
374 |
<div>
|
375 |
<p className="text-xs text-bolt-elements-textSecondary">Browser</p>
|
376 |
<p className="text-sm font-medium text-bolt-elements-textPrimary">{systemInfo.browser}</p>
|
377 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
378 |
<div>
|
379 |
<p className="text-xs text-bolt-elements-textSecondary">Screen Resolution</p>
|
380 |
<p className="text-sm font-medium text-bolt-elements-textPrimary">{systemInfo.screen}</p>
|
|
|
21 |
timezone: string;
|
22 |
memory: string;
|
23 |
cores: number;
|
24 |
+
deviceType: string;
|
25 |
+
colorDepth: string;
|
26 |
+
pixelRatio: number;
|
27 |
+
online: boolean;
|
28 |
+
cookiesEnabled: boolean;
|
29 |
+
doNotTrack: boolean;
|
30 |
}
|
31 |
|
32 |
interface IProviderConfig {
|
|
|
56 |
return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + ' ' + sizes[i];
|
57 |
};
|
58 |
|
59 |
+
const getBrowserInfo = (): string => {
|
60 |
+
const ua = navigator.userAgent;
|
61 |
+
let browser = 'Unknown';
|
62 |
+
|
63 |
+
if (ua.includes('Firefox/')) {
|
64 |
+
browser = 'Firefox';
|
65 |
+
} else if (ua.includes('Chrome/')) {
|
66 |
+
if (ua.includes('Edg/')) {
|
67 |
+
browser = 'Edge';
|
68 |
+
} else if (ua.includes('OPR/')) {
|
69 |
+
browser = 'Opera';
|
70 |
+
} else {
|
71 |
+
browser = 'Chrome';
|
72 |
+
}
|
73 |
+
} else if (ua.includes('Safari/')) {
|
74 |
+
if (!ua.includes('Chrome')) {
|
75 |
+
browser = 'Safari';
|
76 |
+
}
|
77 |
+
}
|
78 |
+
|
79 |
+
// Extract version number
|
80 |
+
const match = ua.match(new RegExp(`${browser}\\/([\\d.]+)`));
|
81 |
+
const version = match ? ` ${match[1]}` : '';
|
82 |
+
|
83 |
+
return `${browser}${version}`;
|
84 |
+
};
|
85 |
+
|
86 |
+
const getOperatingSystem = (): string => {
|
87 |
+
const ua = navigator.userAgent;
|
88 |
+
const platform = navigator.platform;
|
89 |
+
|
90 |
+
if (ua.includes('Win')) {
|
91 |
+
return 'Windows';
|
92 |
+
}
|
93 |
+
|
94 |
+
if (ua.includes('Mac')) {
|
95 |
+
if (ua.includes('iPhone') || ua.includes('iPad')) {
|
96 |
+
return 'iOS';
|
97 |
+
}
|
98 |
+
|
99 |
+
return 'macOS';
|
100 |
+
}
|
101 |
+
|
102 |
+
if (ua.includes('Linux')) {
|
103 |
+
return 'Linux';
|
104 |
+
}
|
105 |
+
|
106 |
+
if (ua.includes('Android')) {
|
107 |
+
return 'Android';
|
108 |
+
}
|
109 |
+
|
110 |
+
return platform || 'Unknown';
|
111 |
+
};
|
112 |
+
|
113 |
+
const getDeviceType = (): string => {
|
114 |
+
const ua = navigator.userAgent;
|
115 |
+
|
116 |
+
if (ua.includes('Mobile')) {
|
117 |
+
return 'Mobile';
|
118 |
+
}
|
119 |
+
|
120 |
+
if (ua.includes('Tablet')) {
|
121 |
+
return 'Tablet';
|
122 |
+
}
|
123 |
+
|
124 |
+
return 'Desktop';
|
125 |
+
};
|
126 |
+
|
127 |
+
// Get more detailed memory info if available
|
128 |
+
const getMemoryInfo = (): string => {
|
129 |
+
if ('memory' in performance) {
|
130 |
+
const memory = (performance as any).memory;
|
131 |
+
return `${formatBytes(memory.jsHeapSizeLimit)} (Used: ${formatBytes(memory.usedJSHeapSize)})`;
|
132 |
+
}
|
133 |
+
|
134 |
+
return 'Not available';
|
135 |
+
};
|
136 |
+
|
137 |
return {
|
138 |
+
os: getOperatingSystem(),
|
139 |
+
browser: getBrowserInfo(),
|
140 |
screen: `${window.screen.width}x${window.screen.height}`,
|
141 |
language: navigator.language,
|
142 |
timezone: Intl.DateTimeFormat().resolvedOptions().timeZone,
|
143 |
+
memory: getMemoryInfo(),
|
144 |
cores: navigator.hardwareConcurrency || 0,
|
145 |
+
deviceType: getDeviceType(),
|
146 |
+
|
147 |
+
// Add new fields
|
148 |
+
colorDepth: `${window.screen.colorDepth}-bit`,
|
149 |
+
pixelRatio: window.devicePixelRatio,
|
150 |
+
online: navigator.onLine,
|
151 |
+
cookiesEnabled: navigator.cookieEnabled,
|
152 |
+
doNotTrack: navigator.doNotTrack === '1',
|
153 |
};
|
154 |
}
|
155 |
|
|
|
463 |
<p className="text-xs text-bolt-elements-textSecondary">Operating System</p>
|
464 |
<p className="text-sm font-medium text-bolt-elements-textPrimary">{systemInfo.os}</p>
|
465 |
</div>
|
466 |
+
<div>
|
467 |
+
<p className="text-xs text-bolt-elements-textSecondary">Device Type</p>
|
468 |
+
<p className="text-sm font-medium text-bolt-elements-textPrimary">{systemInfo.deviceType}</p>
|
469 |
+
</div>
|
470 |
<div>
|
471 |
<p className="text-xs text-bolt-elements-textSecondary">Browser</p>
|
472 |
<p className="text-sm font-medium text-bolt-elements-textPrimary">{systemInfo.browser}</p>
|
473 |
</div>
|
474 |
+
<div>
|
475 |
+
<p className="text-xs text-bolt-elements-textSecondary">Display</p>
|
476 |
+
<p className="text-sm font-medium text-bolt-elements-textPrimary">
|
477 |
+
{systemInfo.screen} ({systemInfo.colorDepth}) @{systemInfo.pixelRatio}x
|
478 |
+
</p>
|
479 |
+
</div>
|
480 |
+
<div>
|
481 |
+
<p className="text-xs text-bolt-elements-textSecondary">Connection</p>
|
482 |
+
<p className="text-sm font-medium flex items-center gap-2">
|
483 |
+
<span
|
484 |
+
className={`inline-block w-2 h-2 rounded-full ${systemInfo.online ? 'bg-green-500' : 'bg-red-500'}`}
|
485 |
+
/>
|
486 |
+
<span className={`${systemInfo.online ? 'text-green-600' : 'text-red-600'}`}>
|
487 |
+
{systemInfo.online ? 'Online' : 'Offline'}
|
488 |
+
</span>
|
489 |
+
</p>
|
490 |
+
</div>
|
491 |
<div>
|
492 |
<p className="text-xs text-bolt-elements-textSecondary">Screen Resolution</p>
|
493 |
<p className="text-sm font-medium text-bolt-elements-textPrimary">{systemInfo.screen}</p>
|