- Tab system: Schnellanalyse (single page) + Website-Scan (multi-page) - ScanResult component: service comparison table, severity-colored findings - Expandable correction suggestions with copy button (pre-launch mode) - API proxy route for /agent/scan endpoint Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
39 lines
1.1 KiB
TypeScript
39 lines
1.1 KiB
TypeScript
/**
|
|
* Agent Scan API Proxy
|
|
* POST /api/sdk/v1/agent/scan → backend-compliance /api/compliance/agent/scan
|
|
*/
|
|
|
|
import { NextRequest, NextResponse } from 'next/server'
|
|
|
|
const BACKEND_URL = process.env.BACKEND_API_URL || 'http://backend-compliance:8002'
|
|
|
|
export async function POST(request: NextRequest) {
|
|
try {
|
|
const body = await request.text()
|
|
|
|
const response = await fetch(`${BACKEND_URL}/api/compliance/agent/scan`, {
|
|
method: 'POST',
|
|
headers: { 'Content-Type': 'application/json' },
|
|
body,
|
|
signal: AbortSignal.timeout(180000), // 3 min — multi-page scan + LLM
|
|
})
|
|
|
|
if (!response.ok) {
|
|
const errorText = await response.text()
|
|
return NextResponse.json(
|
|
{ error: `Backend: ${response.status}`, detail: errorText },
|
|
{ status: response.status }
|
|
)
|
|
}
|
|
|
|
const data = await response.json()
|
|
return NextResponse.json(data)
|
|
} catch (error) {
|
|
console.error('Agent scan proxy error:', error)
|
|
return NextResponse.json(
|
|
{ error: 'Scan fehlgeschlagen oder Timeout' },
|
|
{ status: 503 }
|
|
)
|
|
}
|
|
}
|