Files
botsmann/lib/request.ts
T
g-butandClaude Opus 4.5 84298dce51 feat: add missing platform pages and demo components
- Add /api/quick-chat endpoint for professional chat demos
- Add /create page for building custom bots
- Add /enterprise page for B2B landing
- Add /my-data page for user document management
- Add /personal page for memorial/companion bots
- Add demo components (DemoSection, DemoChat, DemoIntake, etc.)
- Add shared components (HowItWorks, PrivacySection, EnterpriseSection)
- Add bot templates and demo configurations

These files enable the professional demo chats and the
full platform experience with custom bot creation.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-20 14:35:25 +01:00

19 lines
507 B
TypeScript

import type { NextRequest } from 'next/server';
// Extract a best-effort client IP for rate limiting and logging
export function getClientIp(req: NextRequest): string {
const xff = req.headers.get('x-forwarded-for');
if (xff) {
const first = xff.split(',')[0]?.trim();
if (first) return first;
}
const realIp = req.headers.get('x-real-ip');
if (realIp) return realIp;
try {
const url = new URL(req.url);
return url.hostname || 'unknown';
} catch {
return 'unknown';
}
}