- 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>
18 lines
789 B
TypeScript
18 lines
789 B
TypeScript
import { NextRequest } from "next/server";
|
|
import { db } from "@/server/db";
|
|
import { verifySessionToken, SESSION_COOKIE } from "@/server/session";
|
|
import { env } from "@/server/env";
|
|
import { ok, fail, handle } from "@/server/api";
|
|
|
|
export async function GET(req: NextRequest) {
|
|
return handle(async () => {
|
|
const session = await verifySessionToken(env.sessionSecret, req.cookies.get(SESSION_COOKIE)?.value);
|
|
if (!session) return fail("Unauthorized", 401);
|
|
const user = db()
|
|
.prepare("SELECT username, must_change FROM panel_users WHERE username = ?")
|
|
.get(session.u) as { username: string; must_change: number } | undefined;
|
|
if (!user) return fail("Unauthorized", 401);
|
|
return ok({ username: user.username, mustChange: user.must_change === 1 });
|
|
});
|
|
}
|