'use server' import prisma from '@/lib/prisma' import { auth } from '@/auth' import { sendEmail } from '@/lib/mail' import { revalidateTag } from 'next/cache' async function checkAdmin() { const session = await auth() if (!session?.user?.id || (session.user as any).role !== 'ADMIN') { throw new Error('Unauthorized: Admin access required') } return session } export async function testSMTP() { const session = await checkAdmin() const email = session.user?.email if (!email) throw new Error("No admin email found") const result = await sendEmail({ to: email, subject: "Memento SMTP Test", html: "
This is a test email from your Memento instance. SMTP is working!
" }) return result } export async function getSystemConfig() { await checkAdmin() // Reuse the cached version from lib/config const { getSystemConfig: getCachedConfig } = await import('@/lib/config') return getCachedConfig() } export async function updateSystemConfig(data: Record