initial commit

This commit is contained in:
2026-05-07 06:41:36 +01:00
commit 49dd3554f1
23 changed files with 2904 additions and 0 deletions

21
src/app/api/lxc/route.js Normal file
View File

@@ -0,0 +1,21 @@
import { NextResponse } from 'next/server';
import { getNodes, getLXC } from '@/lib/proxmox';
/** @param {import('next').Request} _req */
export async function GET(_req) {
try {
const nodes = await getNodes();
const allLXC = [];
for (const node of nodes) {
try {
const lxcs = await getLXC(node.name);
allLXC.push(...lxcs.map((lxc) => ({ ...lxc, node: node.name })));
} catch { /* skip node */ }
}
return NextResponse.json({ data: allLXC, timestamp: Date.now() });
} catch (error) {
return NextResponse.json({ error: error.message, data: null }, { status: 502 });
}
}

View File

@@ -0,0 +1,12 @@
import { NextResponse } from 'next/server';
import { getNodes } from '@/lib/proxmox';
/** @param {import('next').Request} _req */
export async function GET(_req) {
try {
const data = await getNodes();
return NextResponse.json({ data, timestamp: Date.now() });
} catch (error) {
return NextResponse.json({ error: error.message, data: null }, { status: 502 });
}
}

View File

@@ -0,0 +1,12 @@
import { NextResponse } from 'next/server';
import { getSummary } from '@/lib/proxmox';
/** @param {import('next').Request} _req */
export async function GET(_req) {
try {
const data = await getSummary();
return NextResponse.json({ data, timestamp: Date.now() });
} catch (error) {
return NextResponse.json({ error: error.message, data: null }, { status: 502 });
}
}

21
src/app/api/vms/route.js Normal file
View File

@@ -0,0 +1,21 @@
import { NextResponse } from 'next/server';
import { getNodes, getVMs } from '@/lib/proxmox';
/** @param {import('next').Request} _req */
export async function GET(_req) {
try {
const nodes = await getNodes();
const allVMs = [];
for (const node of nodes) {
try {
const vms = await getVMs(node.name);
allVMs.push(...vms.map((vm) => ({ ...vm, node: node.name })));
} catch { /* skip node */ }
}
return NextResponse.json({ data: allVMs, timestamp: Date.now() });
} catch (error) {
return NextResponse.json({ error: error.message, data: null }, { status: 502 });
}
}