|
5 | 5 | Play, Square, RotateCcw, ArrowLeft, Loader2, |
6 | 6 | Monitor, Fingerprint, AppWindow, Shield, Terminal, ScrollText, Info, Zap |
7 | 7 | } from 'lucide-react' |
8 | | -import { getDevice, startDevice, stopDevice, restartDevice, executeShell } from '../api/client' |
| 8 | +import { getDevice, startDevice, stopDevice, restartDevice, executeShell, getFingerprintFull } from '../api/client' |
9 | 9 | import { useWebSocket, useDeviceH264 } from '../hooks/useWebSocket' |
10 | 10 | import DeviceScreen from '../components/DeviceScreen' |
11 | 11 | import FingerprintEditor from '../components/FingerprintEditor' |
@@ -37,6 +37,96 @@ const TABS: { id: Tab; label: string; icon: React.ReactNode }[] = [ |
37 | 37 | { id: 'logs', label: 'Logs', icon: <ScrollText className="w-4 h-4" /> }, |
38 | 38 | ] |
39 | 39 |
|
| 40 | +function SamsungCard({ fp }: { fp: { device_model?: string | null; manufacturer?: string | null; android_version?: string | null; sdk_version?: number | null; ap_version?: string | null; csc_version?: string | null; extended?: Record<string, unknown> } }) { |
| 41 | + const exynos = fp.extended?.exynos as { soc?: string; cores?: number; specs?: { big_cores?: { name: string; count: number; frequency_mhz: number }; little_cores?: { name: string; count: number; frequency_mhz: number }; gpu?: { model: string; frequency_mhz: number }; memory?: { total_mb: number } } } | undefined |
| 42 | + const ANDROID_TO_ONEUI: Record<string, string> = { '15': '7.0', '14': '6.0', '13': '5.1', '12': '4.1', '11': '3.1' } |
| 43 | + const oneUiStr = ANDROID_TO_ONEUI[fp.android_version || ''] || '' |
| 44 | + |
| 45 | + return ( |
| 46 | + <div className="card space-y-4"> |
| 47 | + <div className="flex items-center gap-2 mb-1"> |
| 48 | + <span className="text-blue-400 font-bold text-sm tracking-widest uppercase">Samsung</span> |
| 49 | + <span className="bg-blue-900/40 text-blue-300 text-xs px-2 py-0.5 rounded">{fp.device_model}</span> |
| 50 | + {oneUiStr && <span className="bg-indigo-900/40 text-indigo-300 text-xs px-2 py-0.5 rounded">One UI {oneUiStr}</span>} |
| 51 | + <span className="bg-green-900/40 text-green-300 text-xs px-2 py-0.5 rounded">Knox ✓</span> |
| 52 | + </div> |
| 53 | + |
| 54 | + <div className="grid grid-cols-1 md:grid-cols-3 gap-4"> |
| 55 | + {/* Firmware info */} |
| 56 | + <div className="space-y-2"> |
| 57 | + <p className="text-xs text-gray-500 uppercase tracking-wider">Firmware</p> |
| 58 | + {[ |
| 59 | + ['Model', fp.device_model], |
| 60 | + ['Android', fp.android_version ? `Android ${fp.android_version} (API ${fp.sdk_version})` : '—'], |
| 61 | + ['AP Version', fp.ap_version || '—'], |
| 62 | + ['CSC Version', fp.csc_version || '—'], |
| 63 | + ].map(([k, v]) => ( |
| 64 | + <div key={String(k)} className="flex justify-between text-sm"> |
| 65 | + <span className="text-gray-400">{k}</span> |
| 66 | + <span className="text-gray-200 font-mono text-xs">{String(v || '—')}</span> |
| 67 | + </div> |
| 68 | + ))} |
| 69 | + </div> |
| 70 | + |
| 71 | + {/* Exynos CPU */} |
| 72 | + <div className="space-y-2"> |
| 73 | + <p className="text-xs text-gray-500 uppercase tracking-wider">Exynos Processor</p> |
| 74 | + {exynos ? ( |
| 75 | + <> |
| 76 | + {[ |
| 77 | + ['SoC', exynos.soc], |
| 78 | + ['Total Cores', exynos.cores], |
| 79 | + ['Big Cores', exynos.specs?.big_cores ? `${exynos.specs.big_cores.count}x ${exynos.specs.big_cores.name} @ ${exynos.specs.big_cores.frequency_mhz} MHz` : '—'], |
| 80 | + ['Little Cores', exynos.specs?.little_cores ? `${exynos.specs.little_cores.count}x ${exynos.specs.little_cores.name} @ ${exynos.specs.little_cores.frequency_mhz} MHz` : '—'], |
| 81 | + ].map(([k, v]) => ( |
| 82 | + <div key={String(k)} className="flex justify-between text-sm"> |
| 83 | + <span className="text-gray-400">{k}</span> |
| 84 | + <span className="text-gray-200 font-mono text-xs">{String(v ?? '—')}</span> |
| 85 | + </div> |
| 86 | + ))} |
| 87 | + </> |
| 88 | + ) : ( |
| 89 | + <p className="text-xs text-gray-600">No Exynos data — create device with firmware preset</p> |
| 90 | + )} |
| 91 | + </div> |
| 92 | + |
| 93 | + {/* GPU */} |
| 94 | + <div className="space-y-2"> |
| 95 | + <p className="text-xs text-gray-500 uppercase tracking-wider">GPU / Memory</p> |
| 96 | + {exynos?.specs ? ( |
| 97 | + <> |
| 98 | + {[ |
| 99 | + ['GPU', exynos.specs.gpu ? `${exynos.specs.gpu.model} @ ${exynos.specs.gpu.frequency_mhz} MHz` : '—'], |
| 100 | + ['RAM', exynos.specs.memory ? `${exynos.specs.memory.total_mb} MB` : '—'], |
| 101 | + ['Knox', 'Active ✓'], |
| 102 | + ['One UI', oneUiStr || '—'], |
| 103 | + ].map(([k, v]) => ( |
| 104 | + <div key={String(k)} className="flex justify-between text-sm"> |
| 105 | + <span className="text-gray-400">{k}</span> |
| 106 | + <span className="text-gray-200 font-mono text-xs">{String(v ?? '—')}</span> |
| 107 | + </div> |
| 108 | + ))} |
| 109 | + </> |
| 110 | + ) : ( |
| 111 | + <> |
| 112 | + {[ |
| 113 | + ['Knox', 'Active ✓'], |
| 114 | + ['One UI', oneUiStr || '—'], |
| 115 | + ['Manufacturer', fp.manufacturer || '—'], |
| 116 | + ].map(([k, v]) => ( |
| 117 | + <div key={String(k)} className="flex justify-between text-sm"> |
| 118 | + <span className="text-gray-400">{k}</span> |
| 119 | + <span className="text-gray-200 font-mono text-xs">{String(v ?? '—')}</span> |
| 120 | + </div> |
| 121 | + ))} |
| 122 | + </> |
| 123 | + )} |
| 124 | + </div> |
| 125 | + </div> |
| 126 | + </div> |
| 127 | + ) |
| 128 | +} |
| 129 | + |
40 | 130 | function ADBConsole({ deviceId, isRunning }: { deviceId: number; isRunning: boolean }) { |
41 | 131 | const [input, setInput] = useState('') |
42 | 132 | const [history, setHistory] = useState<{ cmd: string; output: string; ts: number }[]>([]) |
@@ -119,6 +209,12 @@ export default function DeviceDetail() { |
119 | 209 | refetchInterval: 10_000, |
120 | 210 | }) |
121 | 211 |
|
| 212 | + const { data: fpFull } = useQuery({ |
| 213 | + queryKey: ['fingerprint-full', deviceId], |
| 214 | + queryFn: () => getFingerprintFull(deviceId), |
| 215 | + enabled: !!device, |
| 216 | + }) |
| 217 | + |
122 | 218 | const liveStatus: DeviceStatus = (currentStatus || device?.status || 'created') as DeviceStatus |
123 | 219 | const isRunning = liveStatus === 'running' |
124 | 220 |
|
@@ -269,41 +365,48 @@ export default function DeviceDetail() { |
269 | 365 |
|
270 | 366 | {/* Tab Content */} |
271 | 367 | {activeTab === 'overview' && ( |
272 | | - <div className="grid grid-cols-1 md:grid-cols-2 gap-4"> |
273 | | - <div className="card space-y-3"> |
274 | | - <h3 className="font-semibold text-gray-200 mb-3">Device Info</h3> |
275 | | - {[ |
276 | | - ['ID', device.id], |
277 | | - ['Status', liveStatus], |
278 | | - ['AVD Name', device.avd_name || '—'], |
279 | | - ['ADB Serial', device.adb_serial || '—'], |
280 | | - ['ADB Port', device.adb_port ? `:${device.adb_port}` : '—'], |
281 | | - ['Console Port', device.console_port ? `:${device.console_port}` : '—'], |
282 | | - ['PID', device.pid || '—'], |
283 | | - ].map(([k, v]) => ( |
284 | | - <div key={String(k)} className="flex justify-between text-sm"> |
285 | | - <span className="text-gray-400">{k}</span> |
286 | | - <span className="text-gray-200 font-mono">{String(v)}</span> |
287 | | - </div> |
288 | | - ))} |
289 | | - </div> |
290 | | - <div className="card space-y-3"> |
291 | | - <h3 className="font-semibold text-gray-200 mb-3">Hardware</h3> |
292 | | - {[ |
293 | | - ['API Level', `Android API ${device.api_level}`], |
294 | | - ['Architecture', device.arch], |
295 | | - ['RAM', `${device.ram_mb} MB`], |
296 | | - ['CPU Cores', device.cpu_cores], |
297 | | - ['Owner ID', device.owner_id], |
298 | | - ['Created', new Date(device.created_at).toLocaleString()], |
299 | | - ['Updated', new Date(device.updated_at).toLocaleString()], |
300 | | - ].map(([k, v]) => ( |
301 | | - <div key={String(k)} className="flex justify-between text-sm"> |
302 | | - <span className="text-gray-400">{k}</span> |
303 | | - <span className="text-gray-200 font-mono">{String(v)}</span> |
304 | | - </div> |
305 | | - ))} |
| 368 | + <div className="space-y-4"> |
| 369 | + <div className="grid grid-cols-1 md:grid-cols-2 gap-4"> |
| 370 | + <div className="card space-y-3"> |
| 371 | + <h3 className="font-semibold text-gray-200 mb-3">Device Info</h3> |
| 372 | + {[ |
| 373 | + ['ID', device.id], |
| 374 | + ['Status', liveStatus], |
| 375 | + ['AVD Name', device.avd_name || '—'], |
| 376 | + ['ADB Serial', device.adb_serial || '—'], |
| 377 | + ['ADB Port', device.adb_port ? `:${device.adb_port}` : '—'], |
| 378 | + ['Console Port', device.console_port ? `:${device.console_port}` : '—'], |
| 379 | + ['PID', device.pid || '—'], |
| 380 | + ].map(([k, v]) => ( |
| 381 | + <div key={String(k)} className="flex justify-between text-sm"> |
| 382 | + <span className="text-gray-400">{k}</span> |
| 383 | + <span className="text-gray-200 font-mono">{String(v)}</span> |
| 384 | + </div> |
| 385 | + ))} |
| 386 | + </div> |
| 387 | + <div className="card space-y-3"> |
| 388 | + <h3 className="font-semibold text-gray-200 mb-3">Hardware</h3> |
| 389 | + {[ |
| 390 | + ['API Level', `Android API ${device.api_level}`], |
| 391 | + ['Architecture', device.arch], |
| 392 | + ['RAM', `${device.ram_mb} MB`], |
| 393 | + ['CPU Cores', device.cpu_cores], |
| 394 | + ['Owner ID', device.owner_id], |
| 395 | + ['Created', new Date(device.created_at).toLocaleString()], |
| 396 | + ['Updated', new Date(device.updated_at).toLocaleString()], |
| 397 | + ].map(([k, v]) => ( |
| 398 | + <div key={String(k)} className="flex justify-between text-sm"> |
| 399 | + <span className="text-gray-400">{k}</span> |
| 400 | + <span className="text-gray-200 font-mono">{String(v)}</span> |
| 401 | + </div> |
| 402 | + ))} |
| 403 | + </div> |
306 | 404 | </div> |
| 405 | + |
| 406 | + {/* Samsung card — only shown for Samsung devices */} |
| 407 | + {fpFull?.device_model?.startsWith('SM-') && ( |
| 408 | + <SamsungCard fp={fpFull} /> |
| 409 | + )} |
307 | 410 | </div> |
308 | 411 | )} |
309 | 412 |
|
|
0 commit comments