import { getSession } from '@/lib/session' import { verifyTurnstile } from '@/lib/turnstile' import { listDeletedItems } from '@/lib/restore-items' /** Lista los ítems borrados recuperables de un personaje (cooldown 8 h). */ export async function POST(request: Request) { const session = await getSession() if (!session.accountId || !session.username) { return Response.json({ success: false, error: 'notAuthenticated' }, { status: 401 }) } let body: Record = {} try { body = await request.json() } catch { return Response.json({ success: false, error: 'invalidRequest' }, { status: 400 }) } const ip = (request.headers.get('x-forwarded-for') || '').split(',')[0].trim() || undefined if (!(await verifyTurnstile(String(body.turnstile ?? ''), ip))) { return Response.json({ success: false, error: 'captcha' }) } return Response.json(await listDeletedItems(session.accountId, String(body.character ?? '').trim())) }