MCP site tools, Turnstile key alert, required 2FA injection, a11y, more tests
- MCP: new get_site_info and list_pages tools (public by design, published
and indexable content only); search results collapse the homepage to root.
New listContent() helper shared with searchContent.
- Dashboard alert when Turnstile is half-configured (it is silently off then).
- twoFactor.plugin is now required; the dynamic-import fallback (which never
worked under Next and caused a Turbopack warning) is gone.
- a11y: cookie category checkboxes are labelled, buttons have type, test-email
input is labelled; tab labels keep localized collection labels.
- IPAL_IP_HEADER: one-time production warning when unset, opt-in
ipalEnvRules({ ipHeader: true }).
- Tests: SEO/robots/sitemap/hreflang, CSP, Markdown, consent, MCP, and a real
Payload + SQLite integration test for forms and the roles guard (74 total).
- Drop unused mongodb-memory-server; dev .env.example for SQLite.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
@@ -20,6 +20,25 @@ export type TurnstileConfig = {
|
||||
|
||||
let warnedPartial = false
|
||||
|
||||
function resolveKeys(integrations: IntegrationsWithTurnstileKeys) {
|
||||
return {
|
||||
secret: integrations.turnstileSecretKey?.trim() || process.env[TURNSTILE_SECRET_ENV]?.trim() || '',
|
||||
siteKey: integrations.turnstileSiteKey?.trim() || process.env[TURNSTILE_SITE_KEY_ENV]?.trim() || '',
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Why Turnstile is half-configured (only one of the two keys set), or null when
|
||||
* it's fully on or fully off. Shown as a dashboard alert by IntegrationAlerts —
|
||||
* the half-configured state silently turns Turnstile OFF, which an editor who
|
||||
* just pasted one key wouldn't expect.
|
||||
*/
|
||||
export function turnstileKeyProblem(integrations: IntegrationsWithTurnstileKeys): null | string {
|
||||
const { secret, siteKey } = resolveKeys(integrations)
|
||||
if (Boolean(siteKey) === Boolean(secret)) {return null}
|
||||
return `${siteKey ? 'Secret key' : 'Site key'} is missing, so Turnstile is OFF — forms are not protected. Fill in both keys (or clear both).`
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether Turnstile is on, and the public key to render it with.
|
||||
*
|
||||
@@ -41,8 +60,7 @@ let warnedPartial = false
|
||||
*/
|
||||
export async function getTurnstileConfig(payload: BasePayload): Promise<TurnstileConfig> {
|
||||
const integrations = await getSiteIntegrations<IntegrationsWithTurnstileKeys>(payload)
|
||||
const siteKey = integrations.turnstileSiteKey?.trim() || process.env[TURNSTILE_SITE_KEY_ENV]?.trim() || ''
|
||||
const secret = integrations.turnstileSecretKey?.trim() || process.env[TURNSTILE_SECRET_ENV]?.trim() || ''
|
||||
const { secret, siteKey } = resolveKeys(integrations)
|
||||
|
||||
if (siteKey && secret) {return { enabled: true, siteKey }}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user