Container stats and actions

This commit is contained in:
2025-12-30 13:40:36 +01:00
parent baddd5e4a2
commit 7dd0dca73c
7 changed files with 198 additions and 24 deletions
+24
View File
@@ -0,0 +1,24 @@
import { NextRequest, NextResponse } from "next/server";
import testAuth from "../auth";
import { StatusCodes } from "http-status-codes";
import { getDocker } from "@/core/server/docker";
import { Docker } from "@/lib/types";
export async function GET(req: NextRequest): Promise<NextResponse> {
const auth = await testAuth(req);
if (auth) {
return NextResponse.json(
{ message: auth },
{ status: StatusCodes.UNAUTHORIZED }
);
}
const docker = await getDocker();
return NextResponse.json({
message: "ok",
version: docker.version.Version,
containers: docker.containers,
} as Docker);
}