WIP 1.51.15: privacy and admin on v2

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ls1vMdg2GYqbnKZmPaX1ot
This commit is contained in:
2026-10-30 08:19:24 +02:00
co-authored by Claude Opus 5.5
parent 7b20ffbe08
commit 68c6559136
39 changed files with 10287 additions and 138 deletions
+7 -10
View File
@@ -2,13 +2,13 @@
import React, { useEffect, useState } from "react";
import { useRouter } from "next/navigation";
import { apiFetch } from "@/lib/api";
import { ColorPickerField } from "@/components/admin/ColorPickerField";
import { BrandingPreviewPanel } from "@/components/admin/BrandingPreviewPanel";
import { extractDominantColors } from "@/lib/extractColors";
import { errorMessage } from "@/lib/utils";
import { ConnectForm } from "@/components/admin/LicenceTab";
import { uploadImage } from "@/lib/eventSetup";
import { apiV2Data } from "@/lib/apiV2";
type Step = 1 | 2 | 3 | 4 | 5 | 6;
@@ -103,7 +103,7 @@ export default function SetupPage() {
// Check setup isn't already done
useEffect(() => {
apiFetch<{ needsSetup: boolean }>("/api/settings/needs-setup")
(apiV2Data("get", "/setup/needed") as Promise<{ needsSetup: boolean }>)
.then((d) => { if (!d?.needsSetup) router.replace("/login"); })
.catch(() => {});
}, [router]);
@@ -144,10 +144,9 @@ export default function SetupPage() {
if (adminPassword !== adminConfirm) { setError("Passwords do not match."); return; }
setLoading(true);
try {
const res = await apiFetch<{ token: string }>("/api/setup/register", {
method: "POST",
const res = await (apiV2Data("post", "/setup/register", {
body: { adminName, adminEmail, adminPassword },
});
}) as Promise<{ token: string }>);
setSetupToken(res.token);
next();
} catch (e) {
@@ -166,8 +165,7 @@ export default function SetupPage() {
setSmtpTesting(true);
setSmtpTestResult(null);
try {
const res = await apiFetch<{ ok: boolean; message?: string }>("/api/settings/test-smtp", {
method: "POST",
const res = await (apiV2Data("post", "/settings/test-smtp", {
authToken: setupToken,
body: {
host: smtpHost.trim(),
@@ -177,7 +175,7 @@ export default function SetupPage() {
user: smtpUser.trim() || undefined,
pass: smtpPass || undefined,
},
});
}) as Promise<{ ok: boolean; message?: string }>);
setSmtpTestResult({ ok: true, message: res.message || "Connection successful." });
} catch (e) {
setSmtpTestResult({ ok: false, message: errorMessage(e) || "Connection failed." });
@@ -235,8 +233,7 @@ export default function SetupPage() {
if (smtpPass.trim()) settings.smtp_pass = smtpPass.trim();
}
await apiFetch("/api/setup", {
method: "POST",
await apiV2Data("post", "/setup", {
authToken: setupToken,
body: { settings },
});