fix: use correct Proxmox console URL format from docs
Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -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=103d622c-05a3-4002-9356-f67691e10d40
|
||||
API_POLL_INTERVAL=30000
|
||||
|
||||
@@ -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 */ }
|
||||
|
||||
@@ -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 */ }
|
||||
|
||||
Reference in New Issue
Block a user