-
-
Notifications
You must be signed in to change notification settings - Fork 6
feat: Add captcha #666
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Add captcha #666
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds CAPTCHA support across the API and UI, integrating a new useCaptcha hook, middleware, request headers, and documentation updates.
- Introduce
captchaconfig invitnode.config.tsand application entrypoints - Implement
captchaMiddlewareand integrate it inbuildRoute - Add
useCaptchaReact hook and wire CAPTCHA throughAutoForm, sign-up, and sign-in flows - Update fetchers to pass CAPTCHA tokens via
x-vitnode-captcha-tokenheader - Revise documentation to cover CAPTCHA setup and usage
Reviewed Changes
Copilot reviewed 33 out of 35 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/vitnode/src/hooks/use-captcha.ts | Implements CAPTCHA widget loader and token retrieval |
| packages/vitnode/src/components/form/auto-form.tsx | Wires CAPTCHA into AutoForm and submit flow |
| packages/vitnode/src/api/lib/route.ts | Conditionally adds captchaMiddleware via withCaptcha |
| packages/vitnode/src/api/middlewares/captcha.middleware.ts | New middleware to verify CAPTCHA tokens |
| packages/vitnode/src/vitnode.config.ts | Adds captcha settings to API config interface |
| packages/vitnode/src/views/auth/sign-up/… | Passes CAPTCHA config and token into sign-up forms |
| packages/vitnode/src/views/auth/sign-in/… | Prepares sign-in form to accept CAPTCHA (if needed) |
| apps/docs/content/docs/guides/captcha/** | Adds comprehensive guides for Google and Cloudflare |
| apps/web/src/vitnode.api.config.ts | Configures CAPTCHA provider (reCAPTCHA v3) |
Comments suppressed due to low confidence (2)
packages/vitnode/src/views/auth/sign-in/form/use-form.ts:6
- [nitpick] Consider using the
@/components/form/auto-formalias instead of a deep relative path for consistency with other modules and better maintainability.
import type { AutoFormOnSubmit } from '../../../../components/form/auto-form';
| }); | ||
|
|
||
| const onSubmit = async (values: z.infer<typeof formSchema>) => { | ||
| const onSubmit: AutoFormOnSubmit<typeof formSchema> = async values => { |
Copilot
AI
Jun 29, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The AutoFormOnSubmit signature expects (values, form, options) but the handler only takes values. Update to async (values, form, options) => { … } to match the type.
| const onSubmit: AutoFormOnSubmit<typeof formSchema> = async values => { | |
| const onSubmit: AutoFormOnSubmit<typeof formSchema> = async (values, form, options) => { |
Improving Documentation
pnpm lint:fixto fix formatting issues before opening the PR.Description
What?
Why?
How?