AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.
update(turnstile): Add env to hide turnstile for dev deploy (#10116)
Bently5b324abc7cd2
diff --git a/autogpt_platform/frontend/.env.example b/autogpt_platform/frontend/.env.exampleindex 0eb8872371..675d0ab1fc 100644--- a/autogpt_platform/frontend/.env.example+++ b/autogpt_platform/frontend/.env.example@@ -30,3 +30,4 @@ NEXT_PUBLIC_SHOW_BILLING_PAGE=false## Get these from the Cloudflare Turnstile dashboard: https://dash.cloudflare.com/?to=/:account/turnstile## This is the frontend site keyNEXT_PUBLIC_CLOUDFLARE_TURNSTILE_SITE_KEY=+NEXT_PUBLIC_DISABLE_TURNSTILE=falsediff --git a/autogpt_platform/frontend/src/hooks/useTurnstile.ts b/autogpt_platform/frontend/src/hooks/useTurnstile.tsindex edb7e9b6fa..18bbb06c62 100644--- a/autogpt_platform/frontend/src/hooks/useTurnstile.ts+++ b/autogpt_platform/frontend/src/hooks/useTurnstile.ts@@ -47,10 +47,13 @@ export function useTurnstile({useEffect(() => {const behaveAs = getBehaveAs();const hasTurnstileKey = !!TURNSTILE_SITE_KEY;+ const turnstileDisabled = process.env.NEXT_PUBLIC_DISABLE_TURNSTILE === "true";- setShouldRender(behaveAs === BehaveAs.CLOUD && hasTurnstileKey);+ // Only render Turnstile in cloud environment if not explicitly disabled+ setShouldRender(behaveAs === BehaveAs.CLOUD && hasTurnstileKey && !turnstileDisabled);- if (behaveAs !== BehaveAs.CLOUD || !hasTurnstileKey) {+ // Skip verification if disabled, in local development, or no key+ if (turnstileDisabled || behaveAs !== BehaveAs.CLOUD || !hasTurnstileKey) {setVerified(true);}}, []);diff --git a/autogpt_platform/frontend/src/lib/turnstile.ts b/autogpt_platform/frontend/src/lib/turnstile.tsindex 0301df7d9b..47194ae627 100644--- a/autogpt_platform/frontend/src/lib/turnstile.ts+++ b/autogpt_platform/frontend/src/lib/turnstile.ts@@ -7,6 +7,11 @@ export async function verifyTurnstileToken(token: string,action?: string,): Promise<boolean> {+ // Skip verification if explicitly disabled via environment variable+ if (process.env.NEXT_PUBLIC_DISABLE_TURNSTILE === "true") {+ return true;+ }+// Skip verification in local developmentconst behaveAs = getBehaveAs();if (behaveAs !== BehaveAs.CLOUD) {