feat(contact): implement Turnstile protection via API proxy

- Add `pages/api/contact.ts` to proxy n8n webhook and verify Turnstile tokens.
- Update `contact-us.astro` form to include Turnstile widget and validation logic.
- Replace hardcoded sitekey with `PUBLIC_TURNSTILE_SITE_KEY` from environment variables.
- Update `dev.vars` to include Cloudflare Turnstile keys.
This commit is contained in:
2026-03-01 14:06:44 +08:00
parent 84b5a498e6
commit df1efb4881
3 changed files with 131 additions and 4 deletions

View File

@@ -3,3 +3,10 @@
# Production Payload CMS URL (for SSR fetch)
PAYLOAD_CMS_URL=https://enchun-admin.anlstudio.cc
# Cloudflare Turnstile
CF_TURNSTILE_SITE_KEY=0x4AAAAAACkOUZK2u7Fo8IZ-
CF_TURNSTILE_SECRET_KEY=0x4AAAAAACkOUV9TDUOwVdcdLUakEVxJjww
# n8n webhook
N8N_WEBHOOK_URL=https://n8n.anlstudio.cc/webhook/contact