From 461f1d55e49664e857e20bcfd3bbd97349178027 Mon Sep 17 00:00:00 2001 From: Rob Bond Date: Thu, 7 May 2026 11:38:46 +0100 Subject: [PATCH] fix: use correct Proxmox console URL format from docs Co-Authored-By: Claude --- .env.example | 1 + src/app/api/lxc/route.js | 5 ++--- src/app/api/vms/route.js | 5 ++--- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/.env.example b/.env.example index 1509060..3ba2020 100644 --- a/.env.example +++ b/.env.example @@ -2,6 +2,7 @@ # Get your token from Proxmox → Datacenter → Permissions → API Tokens PROXMOX_API_URL=http://proxmox.lan:8006/api2/json +PROXMOX_WEB_URL=http://proxmox.lan:8006 PROXMOX_TOKEN_ID=root@pam!monitorapp PROXMOX_TOKEN_SECRET= API_POLL_INTERVAL=30000 diff --git a/src/app/api/lxc/route.js b/src/app/api/lxc/route.js index 8526b74..883bbd6 100644 --- a/src/app/api/lxc/route.js +++ b/src/app/api/lxc/route.js @@ -1,8 +1,7 @@ import { NextResponse } from 'next/server'; import { getNodes, getLXC } from '@/lib/proxmox'; -const PROXMOX_API_URL = process.env.PROXMOX_API_URL || 'https://proxmox:8006/api2/json'; -const PROXMOX_WEBUI = PROXMOX_API_URL.replace('/api2/json', ''); +const PROXMOX_WEB_URL = process.env.PROXMOX_WEB_URL || process.env.PROXMOX_API_URL?.replace('/api2/json', ''); /** @param {import('next').Request} _req */ export async function GET(_req) { @@ -17,7 +16,7 @@ export async function GET(_req) { ...lxcs.map((lxc) => ({ ...lxc, node: node.name, - consoleUrl: `${PROXMOX_WEBUI}/pve/console.html?node=${encodeURIComponent(node.name)}&vmid=${lxc.vmid}`, + consoleUrl: `${PROXMOX_WEB_URL}/?console=lxc&novnc=1&node=${encodeURIComponent(node.name)}&vmid=${lxc.vmid}`, })), ); } catch { /* skip node */ } diff --git a/src/app/api/vms/route.js b/src/app/api/vms/route.js index 1ef5e82..cea4079 100644 --- a/src/app/api/vms/route.js +++ b/src/app/api/vms/route.js @@ -1,8 +1,7 @@ import { NextResponse } from 'next/server'; import { getNodes, getVMs } from '@/lib/proxmox'; -const PROXMOX_API_URL = process.env.PROXMOX_API_URL || 'https://proxmox:8006/api2/json'; -const PROXMOX_WEBUI = PROXMOX_API_URL.replace('/api2/json', ''); +const PROXMOX_WEB_URL = process.env.PROXMOX_WEB_URL || process.env.PROXMOX_API_URL?.replace('/api2/json', ''); /** @param {import('next').Request} _req */ export async function GET(_req) { @@ -17,7 +16,7 @@ export async function GET(_req) { ...vms.map((vm) => ({ ...vm, node: node.name, - consoleUrl: `${PROXMOX_WEBUI}/pve/console.html?node=${encodeURIComponent(node.name)}&vmid=${vm.vmid}`, + consoleUrl: `${PROXMOX_WEB_URL}/?console=qemu&novnc=1&node=${encodeURIComponent(node.name)}&vmid=${vm.vmid}`, })), ); } catch { /* skip node */ }