fix: use correct Proxmox console URL format from docs

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2026-05-07 11:38:46 +01:00
parent aa5a3d637b
commit 461f1d55e4
3 changed files with 5 additions and 6 deletions

View File

@@ -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 */ }