import { requireUser } from "../../utils/auth"; import { usePrisma } from "../../utils/prisma"; /** * POST /api/protection/mark-active * * Räumt den `protectionDisabledAt`-Anti-Auto-Reactivation-Guard ab. * Vom Frontend zu callen NACHDEM eine User-initiierte Reaktivierung des * Schutzes erfolgreich war (native NEFilter/VPN ist wieder live). * * Side-effects: * - profile.protection_disabled_at = NULL * - Damit wird /api/protection/state.protectionShouldBeActive wieder true * → Frontend-enforceProtection kann wieder Bypass-Detection machen * * Idempotent. Wenn schon NULL → kein-op. */ export default defineEventHandler(async (event) => { const user = await requireUser(event); const db = usePrisma(); await db.profile.update({ where: { id: user.id }, data: { protectionDisabledAt: null }, }); return { success: true }; });