All checks were successful
CI / test-go-consent (push) Successful in 27s
CI / test-python-voice (push) Successful in 25s
CI / test-bqas (push) Successful in 27s
CI / Deploy (push) Successful in 6s
CI / go-lint (push) Has been skipped
CI / python-lint (push) Has been skipped
CI / nodejs-lint (push) Has been skipped
Adds investor-facing access controls, persistence, and PWA support to the pitch deck: - Passwordless magic-link auth (jose JWT + nodemailer SMTP) - Per-investor audit logging (logins, slide views, assumption changes, chat) - Financial model snapshot persistence (auto-save/restore per investor) - PWA support (manifest, service worker, offline caching, branded icons) - Safeguards: email watermark overlay, security headers, content protection, rate limiting, IP/new-IP detection, single active session per investor - Admin API: invite, list investors, revoke, query audit logs - pitch-deck service added to docker-compose.coolify.yml Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
27 lines
954 B
TypeScript
27 lines
954 B
TypeScript
import { NextRequest, NextResponse } from 'next/server'
|
|
import { getSessionFromCookie, logAudit } from '@/lib/auth'
|
|
|
|
export async function POST(request: NextRequest) {
|
|
const session = await getSessionFromCookie()
|
|
if (!session) {
|
|
return NextResponse.json({ error: 'Not authenticated' }, { status: 401 })
|
|
}
|
|
|
|
const body = await request.json()
|
|
const { action, details, slide_id } = body
|
|
|
|
if (!action || typeof action !== 'string') {
|
|
return NextResponse.json({ error: 'action required' }, { status: 400 })
|
|
}
|
|
|
|
// Only allow known client-side actions
|
|
const allowedActions = ['slide_viewed', 'assumption_changed', 'chat_message_sent', 'snapshot_saved', 'snapshot_restored']
|
|
if (!allowedActions.includes(action)) {
|
|
return NextResponse.json({ error: 'Invalid action' }, { status: 400 })
|
|
}
|
|
|
|
await logAudit(session.sub, action, details || {}, request, slide_id, session.sessionId)
|
|
|
|
return NextResponse.json({ success: true })
|
|
}
|