feat: add daily product intelligence and versioned site assets (#64)
Adds privacy-safe aggregate product intelligence, reviewed/versioned website assets, and a dispatch-only rollout until the dedicated Sentry token is verified. Independent review blockers were fixed in 8bc47e4; app checks, website production build, Android CI, and iOS CI are green. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
44
website/app/api/beta-signup/route.ts
Normal file
44
website/app/api/beta-signup/route.ts
Normal file
@@ -0,0 +1,44 @@
|
||||
import { NextRequest, NextResponse } from 'next/server'
|
||||
|
||||
export const runtime = 'edge'
|
||||
|
||||
export async function POST(request: NextRequest) {
|
||||
try {
|
||||
const { email } = await request.json()
|
||||
|
||||
if (!email || typeof email !== 'string') {
|
||||
return NextResponse.json({ error: 'Email is required' }, { status: 400 })
|
||||
}
|
||||
|
||||
const normalized = email.trim().toLowerCase()
|
||||
if (!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(normalized)) {
|
||||
return NextResponse.json({ error: 'Invalid email address' }, { status: 400 })
|
||||
}
|
||||
|
||||
// Log for Vercel Function Logs (always available)
|
||||
console.log(JSON.stringify({
|
||||
event: 'beta_signup',
|
||||
email: normalized,
|
||||
timestamp: new Date().toISOString(),
|
||||
ip: request.headers.get('x-forwarded-for') || request.headers.get('x-real-ip'),
|
||||
}))
|
||||
|
||||
// If a webhook URL is configured, forward the signup there
|
||||
const webhookUrl = process.env.BETA_SIGNUP_WEBHOOK_URL
|
||||
if (webhookUrl) {
|
||||
try {
|
||||
await fetch(webhookUrl, {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ email: normalized, source: 'opencode-mobile-beta' }),
|
||||
})
|
||||
} catch (e) {
|
||||
console.error('[beta-signup] Webhook failed:', e)
|
||||
}
|
||||
}
|
||||
|
||||
return NextResponse.json({ message: 'Signed up successfully' })
|
||||
} catch {
|
||||
return NextResponse.json({ error: 'Invalid request' }, { status: 400 })
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user