Skip to content

Commit

Permalink
🤖 adds CAPTCHA support - reCAPTCHA, Cloudflare Turnstile, hCaptcha
Browse files Browse the repository at this point in the history
  • Loading branch information
dylanmcgowan committed Jan 27, 2024
1 parent 46c21bc commit c8ff060
Show file tree
Hide file tree
Showing 6 changed files with 581 additions and 403 deletions.
5 changes: 5 additions & 0 deletions .changeset/perfect-otters-clap.md
@@ -0,0 +1,5 @@
---
"submitjson": minor
---

🤖 adds CAPTCHA support - reCAPTCHA, Cloudflare Turnstile, hCaptcha
6 changes: 5 additions & 1 deletion README.md
Expand Up @@ -65,6 +65,9 @@ console.log('Submission', data)
emailBranding?: boolean
submissionFormat?: 'pretty' | 'raw'
submissionSound?: 'none' | 'beep' | 'blip' | 'block' | 'coin' | 'ding' | 'dink' | 'honk' | 'jump' | 'ping' | 'pong' | 'snare'
recaptchaToken?: string
turnstileToken?: string
hcaptchaToken?: string
}

class SubmitJSON {
Expand Down Expand Up @@ -133,7 +136,8 @@ console.log('Submission', data)
emailSubject: 'My custom subject line',
submissionFormat: 'pretty',
submissionSound: 'ping',
}, 'YyYyYyYyY') // this overrides the endpoint set in the configuration
recaptchaToken: 'xxxxxxxxxxx'
}, 'YyYyYyYyY') // overrides the endpoint set in the configuration
console.log('Submission', data)
```
Expand Down
2 changes: 2 additions & 0 deletions index.ts
Expand Up @@ -19,6 +19,8 @@ interface SubmitOptions {
emailBranding?: boolean
submissionFormat?: 'raw' | 'pretty'
submissionSound?: 'none' | 'beep' | 'blip' | 'block' | 'coin' | 'ding' | 'dink' | 'honk' | 'jump' | 'ping' | 'pong' | 'snare'
recaptchaToken?: string
turnstileToken?: string
}

type RequestOptions = components['schemas']['SubmissionInput']['options']
Expand Down
12 changes: 6 additions & 6 deletions package.json
Expand Up @@ -21,15 +21,15 @@
"test:ts": "tsc --noEmit"
},
"dependencies": {
"openapi-fetch": "^0.8.1"
"openapi-fetch": "^0.8.2"
},
"devDependencies": {
"@antfu/eslint-config": "^1.1.0",
"@changesets/cli": "^2.26.2",
"@types/node": "^20.9.0",
"eslint": "^8.53.0",
"@antfu/eslint-config": "^1.2.1",
"@changesets/cli": "^2.27.1",
"@types/node": "^20.11.7",
"eslint": "^8.56.0",
"openapi-typescript": "7.0.0-next.5",
"tsup": "^8.0.1",
"typescript": "^5.2.2"
"typescript": "^5.3.3"
}
}

0 comments on commit c8ff060

Please sign in to comment.