Update AppImage

This commit is contained in:
MacRimi
2025-10-05 22:10:24 +02:00
parent 475b96178e
commit 782dc24eba
2 changed files with 156 additions and 51 deletions

View File

@@ -3,7 +3,7 @@
import { Card } from "@/components/ui/card"
import { Badge } from "@/components/ui/badge"
import { Progress } from "@/components/ui/progress"
import { Cpu, MemoryStick, HardDrive, Network, Monitor, Thermometer, Fan, Battery, Server } from "lucide-react"
import { Cpu, MemoryStick, HardDrive, Network, Thermometer, Fan, Battery, Server, CpuIcon } from "lucide-react"
import useSWR from "swr"
const fetcher = (url: string) => fetch(url).then((res) => res.json())
@@ -85,6 +85,14 @@ interface UPSInfo {
line_voltage?: string
}
interface PCIDevice {
slot: string
type: string
vendor: string
device: string
class: string
}
interface HardwareData {
cpu: CPUInfo
motherboard: MotherboardInfo
@@ -92,6 +100,7 @@ interface HardwareData {
storage_devices: StorageDevice[]
network_cards: NetworkCard[]
graphics_cards: GraphicsCard[]
pci_devices: PCIDevice[]
sensors: {
temperatures: TemperatureSensor[]
fans: FanSensor[]
@@ -331,7 +340,7 @@ export default function Hardware() {
</Card>
)}
{/* Storage Summary - Fixed to show TB */}
{/* Storage Summary */}
{hardwareData.storage_devices.length > 0 && (
<Card className="border-border/50 bg-card/50 p-6">
<div className="mb-4 flex items-center gap-2">
@@ -373,54 +382,7 @@ export default function Hardware() {
</Card>
)}
{/* Graphics Cards */}
{hardwareData.graphics_cards.length > 0 && (
<Card className="border-border/50 bg-card/50 p-6">
<div className="mb-4 flex items-center gap-2">
<Monitor className="h-5 w-5 text-primary" />
<h2 className="text-lg font-semibold">Graphics Cards</h2>
<Badge variant="outline" className="ml-auto">
{hardwareData.graphics_cards.length} GPU{hardwareData.graphics_cards.length > 1 ? "s" : ""}
</Badge>
</div>
<div className="grid gap-4 md:grid-cols-2">
{hardwareData.graphics_cards.map((gpu, index) => (
<Card key={index} className="border-border/30 bg-background/50 p-4">
<div className="space-y-2 text-sm">
<div className="font-medium">{gpu.name}</div>
<div className="flex justify-between">
<span className="text-muted-foreground">Vendor</span>
<span className="font-mono">{gpu.vendor}</span>
</div>
{gpu.memory && (
<div className="flex justify-between">
<span className="text-muted-foreground">Memory</span>
<span className="font-mono">{gpu.memory}</span>
</div>
)}
{gpu.temperature && gpu.temperature > 0 && (
<div className="flex justify-between">
<span className="text-muted-foreground">Temperature</span>
<span className={`font-mono font-medium ${getTempColor(gpu.temperature)}`}>
{gpu.temperature}°C
</span>
</div>
)}
{gpu.power_draw && (
<div className="flex justify-between">
<span className="text-muted-foreground">Power Draw</span>
<span className="font-mono">{gpu.power_draw}</span>
</div>
)}
</div>
</Card>
))}
</div>
</Card>
)}
{/* Network Summary - Simplified */}
{/* Network Summary */}
{hardwareData.network_cards.length > 0 && (
<Card className="border-border/50 bg-card/50 p-6">
<div className="mb-4 flex items-center gap-2">
@@ -451,6 +413,39 @@ export default function Hardware() {
</Card>
)}
{/* PCI Devices */}
{hardwareData.pci_devices && hardwareData.pci_devices.length > 0 && (
<Card className="border-border/50 bg-card/50 p-6">
<div className="mb-4 flex items-center gap-2">
<CpuIcon className="h-5 w-5 text-primary" />
<h2 className="text-lg font-semibold">PCI Devices</h2>
<Badge variant="outline" className="ml-auto">
{hardwareData.pci_devices.length} devices
</Badge>
</div>
<div className="space-y-3">
{hardwareData.pci_devices.map((device, index) => (
<div
key={index}
className="flex items-start justify-between rounded-lg border border-border/30 bg-background/50 p-4"
>
<div className="flex-1 space-y-1">
<div className="flex items-center gap-2">
<Badge variant="outline" className="text-xs">
{device.type}
</Badge>
<span className="font-mono text-xs text-muted-foreground">{device.slot}</span>
</div>
<p className="font-medium text-sm">{device.device}</p>
<p className="text-xs text-muted-foreground">{device.vendor}</p>
</div>
</div>
))}
</div>
</Card>
)}
{/* Thermal Monitoring */}
{hardwareData.sensors.temperatures.length > 0 && (
<Card className="border-border/50 bg-card/50 p-6">

View File

@@ -1304,6 +1304,7 @@ def get_hardware_info():
'storage_devices': [],
'network_cards': [],
'graphics_cards': [],
'pci_devices': [],
'sensors': {
'temperatures': [],
'fans': []
@@ -1430,7 +1431,7 @@ def get_hardware_info():
storage_info = get_storage_info()
hardware_data['storage_devices'] = storage_info.get('disks', [])
# Graphics Cards
# Graphics Cards (from lspci - will be duplicated by new PCI device listing, but kept for now)
try:
# Try nvidia-smi first
result = subprocess.run(['nvidia-smi', '--query-gpu=name,memory.total,temperature.gpu,power.draw', '--format=csv,noheader'],
@@ -1485,6 +1486,114 @@ def get_hardware_info():
except Exception as e:
print(f"[v0] Error getting graphics cards: {e}")
try:
print("[v0] Getting all PCI devices...")
result = subprocess.run(['lspci', '-vmm'], capture_output=True, text=True, timeout=10)
if result.returncode == 0:
current_device = {}
for line in result.stdout.split('\n'):
line = line.strip()
if not line:
# Empty line = end of device
if current_device and 'Class' in current_device:
device_class = current_device.get('Class', '')
device_name = current_device.get('Device', '')
vendor = current_device.get('Vendor', '')
# Categorize and add important devices
device_type = 'Other'
include_device = False
# Graphics/Display devices
if any(keyword in device_class for keyword in ['VGA', 'Display', '3D']):
device_type = 'Graphics Card'
include_device = True
# Also add to graphics_cards list
gpu_vendor = 'Unknown'
if 'NVIDIA' in vendor or 'NVIDIA' in device_name:
gpu_vendor = 'NVIDIA'
elif 'AMD' in vendor or 'AMD' in device_name or 'ATI' in vendor:
gpu_vendor = 'AMD'
elif 'Intel' in vendor or 'Intel' in device_name:
gpu_vendor = 'Intel'
# Check if not already in graphics_cards
already_exists = False
for existing_gpu in hardware_data['graphics_cards']:
if device_name in existing_gpu['name'] or existing_gpu['name'] in device_name:
already_exists = True
break
if not already_exists:
hardware_data['graphics_cards'].append({
'name': device_name,
'vendor': gpu_vendor
})
# Storage controllers
elif any(keyword in device_class for keyword in ['SATA', 'RAID', 'Mass storage', 'Non-Volatile memory']):
device_type = 'Storage Controller'
include_device = True
# Network controllers
elif 'Ethernet' in device_class or 'Network' in device_class:
device_type = 'Network Controller'
include_device = True
# Also add to network_cards if not already there
already_exists = False
for existing_nic in hardware_data['network_cards']:
if device_name in existing_nic['name'] or existing_nic['name'] in device_name:
already_exists = True
break
if not already_exists:
hardware_data['network_cards'].append({
'name': device_name,
'type': 'Ethernet' if 'Ethernet' in device_class else 'Network'
})
# USB controllers
elif 'USB' in device_class:
device_type = 'USB Controller'
include_device = True
# Audio devices
elif 'Audio' in device_class or 'Multimedia' in device_class:
device_type = 'Audio Controller'
include_device = True
# Special devices (Coral TPU, etc.)
elif any(keyword in device_name.lower() for keyword in ['coral', 'tpu', 'edge']):
device_type = 'AI Accelerator'
include_device = True
# PCI bridges (usually not interesting for users)
elif 'Bridge' in device_class:
include_device = False
if include_device:
pci_device = {
'slot': current_device.get('Slot', 'Unknown'),
'type': device_type,
'vendor': vendor,
'device': device_name,
'class': device_class
}
hardware_data['pci_devices'].append(pci_device)
print(f"[v0] PCI Device: {device_type} - {device_name}")
current_device = {}
elif ':' in line:
key, value = line.split(':', 1)
current_device[key.strip()] = value.strip()
print(f"[v0] Total PCI devices found: {len(hardware_data['pci_devices'])}")
print(f"[v0] Graphics cards: {len(hardware_data['graphics_cards'])}")
print(f"[v0] Network cards: {len(hardware_data['network_cards'])}")
except Exception as e:
print(f"[v0] Error getting PCI devices: {e}")
# Sensors (Temperature and Fans)
try:
if hasattr(psutil, "sensors_temperatures"):
@@ -1844,3 +1953,4 @@ if __name__ == '__main__':
print("API endpoints available at: /api/system, /api/storage, /api/network, /api/vms, /api/logs, /api/health, /api/hardware")
app.run(host='0.0.0.0', port=8008, debug=False)
.0', port=8008, debug=False)