The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
bugfix: slack integration (#35916)
Stephen Morganf67d32750d49
diff --git a/apps/www/app/api-v2/opt-out/[ref]/route.ts b/apps/www/app/api-v2/opt-out/[ref]/route.tsindex a78adc73f45..1c5bc982d8b 100644--- a/apps/www/app/api-v2/opt-out/[ref]/route.ts+++ b/apps/www/app/api-v2/opt-out/[ref]/route.ts@@ -31,6 +31,12 @@ export async function POST(req: NextRequest, { params }: { params: { ref: stringconst ref = params.refconst { reason, email, captchaToken } = await req.json()+ // Validate reason+ const allowedReasons = ['phishing', 'advertisement', 'malware', 'scam', 'other']+ if (!allowedReasons.includes(reason)) {+ return NextResponse.json({ error: 'Bad Request: Invalid reason provided.' }, { status: 400 })+ }+const supabase = createClient(supabaseUrl, supabaseServiceKey)if (!ref) {@@ -76,12 +82,7 @@ export async function POST(req: NextRequest, { params }: { params: { ref: stringconst response = await fetch(process.env.EMAIL_REPORT_SLACK_WEBHOOK as string, {method: 'POST',headers: { 'Content-Type': 'application/json' },- body: JSON.stringify({- blocks: [- { type: 'section', text: { type: 'plain_text', text: `New report from: ${ref}` } },- { type: 'section', text: { type: 'plain_text', text: reason } },- ],- }),+ body: JSON.stringify({ text: `New report from: ${ref} \n\n ${reason}` }),})if (!response.ok) throw new Error('Failed to send to Slack')