diff --git a/AppImage/components/proxmox-dashboard.tsx b/AppImage/components/proxmox-dashboard.tsx index 09bfa5c..afe2031 100644 --- a/AppImage/components/proxmox-dashboard.tsx +++ b/AppImage/components/proxmox-dashboard.tsx @@ -45,11 +45,24 @@ export function ProxmoxDashboard() { const fetchSystemData = useCallback(async () => { console.log("[v0] Fetching system data from Flask server...") + console.log("[v0] Current window location:", window.location.href) + + // Usar ruta relativa si estamos en el mismo servidor, sino usar localhost:8008 + const apiUrl = + window.location.hostname === "localhost" && window.location.port === "8008" + ? "/api/system" // Ruta relativa cuando estamos en el servidor Flask + : "http://localhost:8008/api/system" // URL completa para desarrollo + + console.log("[v0] API URL:", apiUrl) + try { - const response = await fetch("http://localhost:8008/api/system") + const response = await fetch(apiUrl) + console.log("[v0] Response status:", response.status) + if (!response.ok) { - throw new Error("Server not responding") + throw new Error(`Server responded with status: ${response.status}`) } + const data: FlaskSystemData = await response.json() console.log("[v0] System data received:", data) @@ -70,6 +83,12 @@ export function ProxmoxDashboard() { setIsServerConnected(true) } catch (error) { console.error("[v0] Failed to fetch system data from Flask server:", error) + console.error("[v0] Error details:", { + message: error instanceof Error ? error.message : "Unknown error", + apiUrl, + windowLocation: window.location.href, + }) + setIsServerConnected(false) setSystemStatus((prev) => ({ ...prev, @@ -122,14 +141,25 @@ export function ProxmoxDashboard() {
python3 AppImage/scripts/flask_server.py
-
+ Flask Server Connection Failed
+ • Check that the AppImage is running correctly
+• The Flask server should start automatically on port 8008
++ • Try accessing:{" "} + + http://localhost:8008/api/health + +