Files
eSIM-Tools/netlify/functions/public-config.js
Abner 3148a3564c ♻️ refactor: 移除 Turnstile 验证码、修复 CSP 和 Netlify 构建警告
- 移除 Turnstile 验证码逻辑,仅保留 reCAPTCHA 作为可选 fallback
- 修复 Google Fonts CSP 违规:style-src 添加 fonts.googleapis.com
- 移除 netlify.toml 中 /.netlify/functions/* 无效重定向规则
- 为 Giffgaff 和 Simyo 添加调试日志(环境信息 + 操作步骤)
- 简化 bff-proxy.js,移除验证码校验逻辑
2026-05-18 20:16:34 +08:00

29 lines
758 B
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
const DEFAULT_PROVIDER = 'off';
const handler = async () => {
const providerEnv = (process.env.CAPTCHA_PROVIDER || DEFAULT_PROVIDER).toLowerCase();
const provider = ['recaptcha', 'off'].includes(providerEnv) ? providerEnv : DEFAULT_PROVIDER;
const payload = {
provider,
recaptchaSiteKey: process.env.RECAPTCHA_SITE_KEY || ''
};
// 如果未提供 site key则降级为 off
if (payload.provider === 'recaptcha' && !payload.recaptchaSiteKey) {
payload.provider = 'off';
}
return {
statusCode: 200,
headers: {
'Content-Type': 'application/json',
'Access-Control-Allow-Origin': '*',
'Cache-Control': 'public, max-age=300'
},
body: JSON.stringify(payload)
};
};
module.exports = { handler };