feat: Add captcha#666
Merged
aXenDeveloper merged 4 commits intocanaryfrom Jun 29, 2025
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
There was a problem hiding this comment.
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 => { |
There was a problem hiding this comment.
The AutoFormOnSubmit signature expects (values, form, options) but the handler only takes values. Update to async (values, form, options) => { … } to match the type.
Suggested change
| const onSubmit: AutoFormOnSubmit<typeof formSchema> = async values => { | |
| const onSubmit: AutoFormOnSubmit<typeof formSchema> = async (values, form, options) => { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Improving Documentation
pnpm lint:fixto fix formatting issues before opening the PR.Description
What?
Why?
How?