Next.js 16 + Tailwind v4 + shadcn v4 dashboard for managing a modded Forge 1.20.1 server. Includes server controls, player management, mod manager with Modrinth search and dependency resolution, world backups, snapshots, analytics, logs, and chat bridge. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
28 lines
776 B
TypeScript
28 lines
776 B
TypeScript
import { NextRequest, NextResponse } from "next/server";
|
|
import { auth } from "@/lib/auth";
|
|
import { resolveDependencies } from "@/lib/modrinth";
|
|
|
|
export async function POST(req: NextRequest) {
|
|
const session = await auth();
|
|
if (!session) {
|
|
return NextResponse.json({ error: "Unauthorized" }, { status: 403 });
|
|
}
|
|
|
|
const { projectIds, titles } = await req.json();
|
|
if (!Array.isArray(projectIds) || projectIds.length === 0) {
|
|
return NextResponse.json(
|
|
{ error: "No mods selected" },
|
|
{ status: 400 }
|
|
);
|
|
}
|
|
|
|
try {
|
|
const result = await resolveDependencies(projectIds, titles || {});
|
|
return NextResponse.json(result);
|
|
} catch (e) {
|
|
return NextResponse.json(
|
|
{ error: (e as Error).message },
|
|
{ status: 500 }
|
|
);
|
|
}
|
|
}
|