Node status checking

This commit is contained in:
2025-12-29 19:49:37 +01:00
parent 98c8e86872
commit 4d18edcffe
10 changed files with 59 additions and 95 deletions
+15 -6
View File
@@ -1,12 +1,21 @@
"use server";
import axios from "axios";
import { Node } from "@/lib/types";
import { Docker, Node } from "@/lib/types";
import { verifySession } from "./auth/session";
export async function getDocker(node: Node): Promise<{ version: string }> {
return await (
await axios.get(`http://${node.ip}:3000/api/get-docker`, {
headers: { Authorization: `ApiKey ${node.key}` },
export async function getDocker(nodes: Node[]): Promise<Docker[]> {
if (await verifySession()) return [];
return await Promise.all(
nodes.map(async (node) => {
const data = await (
await axios.get(`http://${node.ip}:3000/api/get-docker`, {
headers: { Authorization: `ApiKey ${node.key}` },
})
).data;
return { ...node, containers: data.containers, version: data.version };
})
).data;
);
}