e0e1ac49d9
- New invites table: token-gated signup, optional email lock, role/tier override, single-use, expiry. - SIGNUPS_DISABLED site setting toggle at /admin/settings. - databaseHooks.user.create gate in auth/server.ts blocks new account creation (email + Google OAuth) when disabled unless a valid invite cookie is present; applies invite role/tier and marks it consumed. - /admin/invites: create/list/revoke shareable invite links. - /admin/users: "Create user" dialog — admin sets email/role/tier, account is pre-verified, user gets a set-password email (admin never sees a password). - Signup page reads ?invite=, validates via public /api/v1/invites/[token], locks the form when signups are closed and no valid invite is present. - proxy.ts: allowlist /api/v1/invites/ for anonymous invite checks. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
48 lines
1.7 KiB
TypeScript
48 lines
1.7 KiB
TypeScript
import type { Metadata } from "next";
|
||
import { getAllSiteSettings, isSignupsDisabled } from "@/lib/site-settings";
|
||
import { AdminSettingsForm } from "@/components/admin/admin-settings-form";
|
||
import { SignupsToggle } from "@/components/admin/signups-toggle";
|
||
|
||
export const metadata: Metadata = { title: "Site Settings – Admin" };
|
||
|
||
const SETTING_GROUPS = [
|
||
{
|
||
title: "AI Provider Keys",
|
||
description: "Override the environment variable API keys at runtime. Values are encrypted at rest.",
|
||
keys: ["OPENAI_API_KEY", "ANTHROPIC_API_KEY", "OPENROUTER_API_KEY"] as const,
|
||
},
|
||
{
|
||
title: "AI Configuration",
|
||
description: "Provider routing and model defaults.",
|
||
keys: ["OPENROUTER_DEFAULT_MODEL", "OLLAMA_BASE_URL"] as const,
|
||
},
|
||
{
|
||
title: "Push Notifications (VAPID)",
|
||
description: "Keys for web push notifications. Generate with: npx web-push generate-vapid-keys",
|
||
keys: ["NEXT_PUBLIC_VAPID_PUBLIC_KEY", "VAPID_PRIVATE_KEY"] as const,
|
||
},
|
||
];
|
||
|
||
export default async function AdminSettingsPage() {
|
||
const settings = await getAllSiteSettings();
|
||
const signupsDisabled = await isSignupsDisabled();
|
||
|
||
return (
|
||
<div className="space-y-8">
|
||
<div>
|
||
<h1 className="text-2xl font-bold tracking-tight">Site Settings</h1>
|
||
<p className="text-muted-foreground text-sm mt-1">
|
||
Override .env values at runtime. DB values take precedence over environment variables.
|
||
Clear a value to fall back to the environment variable.
|
||
</p>
|
||
</div>
|
||
|
||
<SignupsToggle initialDisabled={signupsDisabled} />
|
||
|
||
{SETTING_GROUPS.map((group) => (
|
||
<AdminSettingsForm key={group.title} group={group} settings={settings} />
|
||
))}
|
||
</div>
|
||
);
|
||
}
|