New Captcha Package added
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
# WRNexusJS CAPTCHA Fixed 7
|
||||
|
||||
Extract this patch directly into the WRNexusJS repository root and allow files to be replaced.
|
||||
|
||||
## Added
|
||||
|
||||
- `size="compact"`, `size="normal"`, and `size="big"`
|
||||
- Backward-compatible `small`/`sm`, `large`/`lg`, and `compact="true"` aliases
|
||||
- `showListen="true|false"` for the Listen button
|
||||
- Existing `showAudio="true|false"` remains the broader audio-alternative switch
|
||||
- Self-hosted `type="not-robot"` checkbox challenge
|
||||
- Showcase examples and tests for all new behavior
|
||||
- Managed API/OpenAPI support for `not-robot`
|
||||
|
||||
## Usage
|
||||
|
||||
```wrn
|
||||
<Captcha
|
||||
endpoint="/api/captcha/challenge"
|
||||
verifyEndpoint="/api/captcha/verify"
|
||||
type="number"
|
||||
action="compact-example"
|
||||
size="compact"
|
||||
showListen="false"
|
||||
/>
|
||||
```
|
||||
|
||||
```wrn
|
||||
<Captcha
|
||||
endpoint="/api/captcha/challenge"
|
||||
verifyEndpoint="/api/captcha/verify"
|
||||
type="not-robot"
|
||||
action="contact-submit"
|
||||
size="compact"
|
||||
showListen="false"
|
||||
/>
|
||||
```
|
||||
|
||||
The not-robot checkbox is server verified. It uses a one-time challenge, minimum completion time, honeypot, expiry, attempt limits, action binding, optional hostname/session/IP binding, and a single-use response token. It is a low-friction mode; high-risk traffic should escalate to a visual challenge or an external provider.
|
||||
|
||||
## Regenerate and test
|
||||
|
||||
```bash
|
||||
bun run scripts/generate-ui-component-reference.mjs
|
||||
bun run typecheck
|
||||
bun test packages/captcha
|
||||
bun run --cwd examples/captcha-showcase check
|
||||
bun run --cwd examples/captcha-showcase dev
|
||||
```
|
||||
|
||||
Hard-refresh the browser after restarting the development server.
|
||||
Reference in New Issue
Block a user