import { appSettings } from "@minecraft-account-manager/database"; import { eq } from "drizzle-orm"; import { DEFAULT_ADMISSION_MESSAGES } from "@/lib/admission-settings"; import { db } from "@/lib/database"; import { saveAdmissionSettings } from "../actions"; export const dynamic = "force-dynamic"; export default async function SettingsPage({ searchParams, }: { searchParams: Promise<{ saved?: string; error?: string }>; }) { const query = await searchParams; const [settings] = await db.select().from(appSettings).where(eq(appSettings.id, "default")).limit(1); const messages = { registrationMessage: settings?.registrationMessage ?? DEFAULT_ADMISSION_MESSAGES.registrationMessage, groupAccessDeniedMessage: settings?.groupAccessDeniedMessage ?? DEFAULT_ADMISSION_MESSAGES.groupAccessDeniedMessage, vpnDeniedMessage: settings?.vpnDeniedMessage ?? DEFAULT_ADMISSION_MESSAGES.vpnDeniedMessage, scheduledAccessDeniedMessage: settings?.scheduledAccessDeniedMessage ?? DEFAULT_ADMISSION_MESSAGES.scheduledAccessDeniedMessage, }; const guildId = process.env.DISCORD_GUILD_ID?.trim(); const inviteUrl = process.env.DISCORD_INVITE_URL?.trim(); return (

System settings

Server gate

The Discord guild and invite are deployment environment settings. Operators can adjust the message shown to denied Minecraft players here.

Guild ID
{guildId ?? "Missing"}
Invite URL
{inviteUrl ? {inviteUrl} (opens in a new tab) : "Missing"}
{query.saved &&

Settings saved

} {query.error &&

Check the configuration value and try again.

}
Minecraft denial messages

Each plain-text template is returned for one admission outcome. Messages must be between 10 and 500 characters. Registration, group, and network templates support {"{player}"} and {"{group}"}.

); } function AdmissionMessageField({ description, label, name, value, }: { description: string; label: string; name: "registrationMessage" | "groupAccessDeniedMessage" | "scheduledAccessDeniedMessage" | "vpnDeniedMessage"; value: string; }) { const descriptionId = `${name}-description`; return (

{description}