- docker-compose: itzg/minecraft-server (Fabric, offline mode, whitelist enforced, Modrinth-managed mods), itzg/mc-backup sidecar, custom dashboard - Gated auth for offline mode: approve username -> whitelisted with a short registration window -> EasyAuth /register + /login; auto-revoke on expiry - CraftDeck panel (Next.js 16, zero native deps): live console (SSE), players & stats, lag diagnostics (server TPS vs player ping via spark), performance graphs, Modrinth mod search/manager, backups & restore, sandboxed file browser/editor, .env config editor with compose apply, cron schedules, Discord alerts, scrypt-hashed panel login - scripts/setup.sh generates secrets; docs/ covers auth, mods, updating, backups, networking (Tailscale), troubleshooting Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
33 lines
1021 B
TypeScript
33 lines
1021 B
TypeScript
import { NextRequest } from "next/server";
|
|
import { Readable } from "node:stream";
|
|
import { getBackupStream, deleteBackup } from "@/server/backups";
|
|
import { ok, fail, handle } from "@/server/api";
|
|
|
|
export const dynamic = "force-dynamic";
|
|
|
|
export async function GET(req: NextRequest) {
|
|
const name = req.nextUrl.searchParams.get("name");
|
|
if (!name) return fail("Missing backup name");
|
|
try {
|
|
const { stream, size } = getBackupStream(name);
|
|
return new Response(Readable.toWeb(stream) as ReadableStream, {
|
|
headers: {
|
|
"Content-Type": "application/gzip",
|
|
"Content-Length": String(size),
|
|
"Content-Disposition": `attachment; filename="${name}"`,
|
|
},
|
|
});
|
|
} catch (err) {
|
|
return fail((err as Error).message, 404);
|
|
}
|
|
}
|
|
|
|
export async function DELETE(req: NextRequest) {
|
|
return handle(async () => {
|
|
const name = req.nextUrl.searchParams.get("name");
|
|
if (!name) return fail("Missing backup name");
|
|
deleteBackup(name);
|
|
return ok({ deleted: name });
|
|
});
|
|
}
|