diff --git a/.config/config-schema.json b/.config/config-schema.json index e8a8fa2..1cbd2e5 100644 --- a/.config/config-schema.json +++ b/.config/config-schema.json @@ -137,13 +137,6 @@ "TurnstileConfig": { "additionalProperties": false, "properties": { - "hosts": { - "description": "The hosts to enable Turnstile on", - "items": { - "type": "string" - }, - "type": "array" - }, "secret": { "description": "The Turnstile secret key, used by the backend", "type": "string" diff --git a/src/components/turnstile.tsx b/src/components/turnstile.tsx index 582f67b..e6f973c 100644 --- a/src/components/turnstile.tsx +++ b/src/components/turnstile.tsx @@ -1,14 +1,8 @@ import { getConfig } from "@/lib/config"; import { Turnstile as BaseTurnstile } from "@marsidev/react-turnstile"; -import { headers } from "next/headers"; export default async function Turnstile() { const config = getConfig(); - const headersList = await headers(); - const host = headersList.get("x-forwarded-host") || headersList.get("host"); - if ( - config?.auth.turnstile?.siteKey && - (!config.auth.turnstile.hosts || config.auth.turnstile.hosts.includes(host as string)) - ) { + if (config?.auth.turnstile?.siteKey) { return ; } return null; diff --git a/src/lib/turnstile.ts b/src/lib/turnstile.ts index ef6fea7..4203db7 100644 --- a/src/lib/turnstile.ts +++ b/src/lib/turnstile.ts @@ -1,15 +1,8 @@ -import { headers } from "next/headers"; import { getConfig } from "./config"; export default async function turnstileCheck(data: FormData) { const config = getConfig(); if (!config.auth.turnstile) return true; - const headersList = await headers(); - if ( - config.auth.turnstile.hosts && - !config.auth.turnstile.hosts?.includes(headersList.get("x-forwarded-host") || headersList.get("host") || "") - ) - return true; const key = data.get("cf-turnstile-response")?.toString(); const result = await fetch("https://challenges.cloudflare.com/turnstile/v0/siteverify", { body: JSON.stringify({ diff --git a/src/types/config.d.ts b/src/types/config.d.ts index 533e679..4fa2749 100644 --- a/src/types/config.d.ts +++ b/src/types/config.d.ts @@ -107,8 +107,4 @@ export interface TurnstileConfig { * The Turnstile site key, used by the frontend */ siteKey: string; - /** - * The hosts to enable Turnstile on - */ - hosts?: string[]; }