From 9186a44860004717f67ed86f4c3650278348d817 Mon Sep 17 00:00:00 2001 From: MacRimi Date: Mon, 13 Oct 2025 15:06:03 +0200 Subject: [PATCH] Update AppImage --- AppImage/components/storage-overview.tsx | 15 +++++++++++++- AppImage/components/system-overview.tsx | 25 ++++++++++++++++++------ AppImage/components/virtual-machines.tsx | 15 +++++++++++++- AppImage/scripts/flask_server.py | 22 +++++++++++++-------- 4 files changed, 61 insertions(+), 16 deletions(-) diff --git a/AppImage/components/storage-overview.tsx b/AppImage/components/storage-overview.tsx index ac03448..2191fed 100644 --- a/AppImage/components/storage-overview.tsx +++ b/AppImage/components/storage-overview.tsx @@ -66,6 +66,19 @@ interface ProxmoxStorageData { error?: string } +const formatStorage = (sizeInGB: number): string => { + if (sizeInGB < 1) { + // Less than 1 GB, show in MB + return `${(sizeInGB * 1024).toFixed(1)} MB` + } else if (sizeInGB < 1024) { + // Less than 1024 GB, show in GB + return `${sizeInGB.toFixed(1)} GB` + } else { + // 1024 GB or more, show in TB + return `${(sizeInGB / 1024).toFixed(1)} TB` + } +} + export function StorageOverview() { const [storageData, setStorageData] = useState(null) const [proxmoxStorage, setProxmoxStorage] = useState(null) @@ -257,7 +270,7 @@ export function StorageOverview() { -
{totalProxmoxUsed.toFixed(1)} GB
+
{formatStorage(totalProxmoxUsed)}

{usagePercent}% used

diff --git a/AppImage/components/system-overview.tsx b/AppImage/components/system-overview.tsx index b36a870..bbdabe2 100644 --- a/AppImage/components/system-overview.tsx +++ b/AppImage/components/system-overview.tsx @@ -383,6 +383,19 @@ export function SystemOverview() { return (bytes / 1024 ** 3).toFixed(2) } + const formatStorage = (sizeInGB: number): string => { + if (sizeInGB < 1) { + // Less than 1 GB, show in MB + return `${(sizeInGB * 1024).toFixed(1)} MB` + } else if (sizeInGB < 1024) { + // Less than 1024 GB, show in GB + return `${sizeInGB.toFixed(1)} GB` + } else { + // 1024 GB or more, show in TB + return `${(sizeInGB / 1024).toFixed(1)} TB` + } + } + const tempStatus = getTemperatureStatus(systemData.temperature) const localStorage = proxmoxStorageData?.storage.find( @@ -623,15 +636,15 @@ export function SystemOverview() {
- Data Sent: - - {(networkData.traffic.bytes_sent / 1024 ** 3).toFixed(2)} GB + Received: + + ↓ {formatStorage(networkData.traffic.bytes_recv / 1024 ** 3)}
- Data Received: - - {(networkData.traffic.bytes_recv / 1024 ** 3).toFixed(2)} GB + Sent: + + ↑ {formatStorage(networkData.traffic.bytes_sent / 1024 ** 3)}
diff --git a/AppImage/components/virtual-machines.tsx b/AppImage/components/virtual-machines.tsx index 7282439..7e0d6d7 100644 --- a/AppImage/components/virtual-machines.tsx +++ b/AppImage/components/virtual-machines.tsx @@ -114,6 +114,19 @@ const extractIPFromConfig = (config?: VMConfig): string => { return "DHCP" } +const formatStorage = (sizeInGB: number): string => { + if (sizeInGB < 1) { + // Less than 1 GB, show in MB + return `${(sizeInGB * 1024).toFixed(1)} MB` + } else if (sizeInGB < 1024) { + // Less than 1024 GB, show in GB + return `${sizeInGB.toFixed(1)} GB` + } else { + // 1024 GB or more, show in TB + return `${(sizeInGB / 1024).toFixed(1)} TB` + } +} + export function VirtualMachines() { const { data: vmData, @@ -419,7 +432,7 @@ export function VirtualMachines() {
- {(safeVMData.reduce((sum, vm) => sum + (vm.maxdisk || 0), 0) / 1024 ** 3).toFixed(1)} GB + {formatStorage(safeVMData.reduce((sum, vm) => sum + (vm.maxdisk || 0), 0) / 1024 ** 3)}

Allocated disk space

diff --git a/AppImage/scripts/flask_server.py b/AppImage/scripts/flask_server.py index 16ea34a..d6415f7 100644 --- a/AppImage/scripts/flask_server.py +++ b/AppImage/scripts/flask_server.py @@ -3672,8 +3672,7 @@ def api_backups(): # Get content of storage content_result = subprocess.run( ['pvesh', 'get', f'/nodes/localhost/storage/{storage_id}/content', '--output-format', 'json'], - capture_output=True, text=True, timeout=10 - ) + capture_output=True, text=True, timeout=10) if content_result.returncode == 0: contents = json.loads(content_result.stdout) @@ -4097,8 +4096,7 @@ def api_vm_details(vmid): # Get detailed config config_result = subprocess.run( ['pvesh', 'get', f'/nodes/{node}/{vm_type}/{vmid}/config', '--output-format', 'json'], - capture_output=True, text=True, timeout=10 - ) + capture_output=True, text=True, timeout=10) config = {} if config_result.returncode == 0: @@ -4143,8 +4141,7 @@ def api_vm_logs(vmid): # Get real logs from the container/VM (last 1000 lines) log_result = subprocess.run( ['pvesh', 'get', f'/nodes/{node}/{vm_type}/{vmid}/log', '--start', '0', '--limit', '1000'], - capture_output=True, text=True, timeout=10 - ) + capture_output=True, text=True, timeout=10) logs = [] if log_result.returncode == 0: @@ -4198,8 +4195,7 @@ def api_vm_control(vmid): # Execute action control_result = subprocess.run( ['pvesh', 'create', f'/nodes/{node}/{vm_type}/{vmid}/status/{action}'], - capture_output=True, text=True, timeout=30 - ) + capture_output=True, text=True, timeout=30) if control_result.returncode == 0: return jsonify({ @@ -4222,8 +4218,18 @@ def api_vm_control(vmid): if __name__ == '__main__': # API endpoints available at: /api/system, /api/system-info, /api/storage, /api/proxmox-storage, /api/network, /api/vms, /api/logs, /api/health, /api/hardware + import sys import logging + + # Silence werkzeug logger log = logging.getLogger('werkzeug') log.setLevel(logging.ERROR) + # Silence Flask CLI banner (removes "Serving Flask app", "Debug mode", "WARNING" messages) + cli = sys.modules['flask.cli'] + cli.show_server_banner = lambda *x: None + + # Print only essential information + print("API endpoints available at: /api/system, /api/system-info, /api/storage, /api/proxmox-storage, /api/network, /api/vms, /api/logs, /api/health, /api/hardware") + app.run(host='0.0.0.0', port=8008, debug=False)