From 477b85e311ac0756d13cfe1984a3d031131279af Mon Sep 17 00:00:00 2001 From: yousefed Date: Thu, 5 Feb 2026 14:21:53 +0100 Subject: [PATCH 1/3] fix search, build and captcha --- docs/.env.local.example | 4 +- docs/components/AuthenticationPage.tsx | 19 +- .../components/fumadocs/layout/home/index.tsx | 28 ++- docs/lib/auth.ts | 6 + docs/package.json | 13 +- pnpm-lock.yaml | 203 +++++++----------- 6 files changed, 136 insertions(+), 137 deletions(-) diff --git a/docs/.env.local.example b/docs/.env.local.example index cb90db5a97..a2dba36b4b 100644 --- a/docs/.env.local.example +++ b/docs/.env.local.example @@ -30,4 +30,6 @@ BETTER_AUTH_URL=http://localhost:3000 # SENTRY_AUTH_TOKEN= NEXT_PUBLIC_BLOCKNOTE_AI_SERVER_API_KEY= -NEXT_PUBLIC_BLOCKNOTE_AI_SERVER_BASE_URL= \ No newline at end of file +NEXT_PUBLIC_BLOCKNOTE_AI_SERVER_BASE_URL= + +TURNSTILE_SECRET_KEY= \ No newline at end of file diff --git a/docs/components/AuthenticationPage.tsx b/docs/components/AuthenticationPage.tsx index ebe79ff888..d68c0cf50e 100644 --- a/docs/components/AuthenticationPage.tsx +++ b/docs/components/AuthenticationPage.tsx @@ -1,6 +1,7 @@ "use client"; import { authClient, signIn, signUp } from "@/lib/auth-client"; +import { Turnstile } from "@marsidev/react-turnstile"; import * as Sentry from "@sentry/nextjs"; import { track } from "@vercel/analytics"; import { useRouter, useSearchParams } from "next/navigation"; @@ -53,6 +54,7 @@ function AuthenticationBox(props: { const [name, setName] = useState(""); const [email, setEmail] = useState(""); const [password, setPassword] = useState(""); + const [turnstileToken, setTurnstileToken] = useState(""); const [signingInState, setSigningInState] = useState< | { state: "init" } @@ -130,7 +132,7 @@ function AuthenticationBox(props: { }, }, ); - } else { + } else if (props.variant === "register") { track("click-sign-up", { type: "email" }); Sentry.captureEvent({ message: "click-sign-up", @@ -147,6 +149,9 @@ function AuthenticationBox(props: { callbackURL: "/pricing", }, { + headers: { + "x-captcha-response": turnstileToken, + }, onSuccess() { setSigningInState({ state: "done", @@ -172,6 +177,9 @@ function AuthenticationBox(props: { }, }, ); + } else { + const variant = props.variant satisfies never; + throw new Error("Invalid authentication variant " + variant); } }; @@ -213,6 +221,13 @@ function AuthenticationBox(props: { onChange={(e) => setPassword(e.target.value)} /> )} + {props.variant === "register" && ( + + )}