twikoo-vercel 1.7.3 → 1.7.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/api/index.js +8 -1
  2. package/package.json +2 -2
package/api/index.js CHANGED
@@ -34,6 +34,7 @@ const {
34
34
  preCheckSpam,
35
35
  checkTurnstileCaptcha,
36
36
  checkGeeTestCaptcha,
37
+ checkCapCaptcha,
37
38
  getConfig,
38
39
  getConfigForAdmin,
39
40
  validate
@@ -752,7 +753,7 @@ async function limitFilter (request) {
752
753
 
753
754
  async function checkCaptcha (comment, request) {
754
755
  const provider = config.CAPTCHA_PROVIDER
755
- if ((!provider || provider === 'Turnstile') && config.TURNSTILE_SITE_KEY && config.TURNSTILE_SECRET_KEY) {
756
+ if (provider === 'Turnstile' && config.TURNSTILE_SITE_KEY && config.TURNSTILE_SECRET_KEY) {
756
757
  await checkTurnstileCaptcha({
757
758
  ip: getIp(request),
758
759
  turnstileToken: comment.turnstileToken,
@@ -767,6 +768,12 @@ async function checkCaptcha (comment, request) {
767
768
  geeTestPassToken: comment.geeTestPassToken,
768
769
  geeTestGenTime: comment.geeTestGenTime
769
770
  })
771
+ } else if (provider === 'Cap' && config.CAP_API_ENDPOINT && config.CAP_SECRET_KEY) {
772
+ await checkCapCaptcha({
773
+ capToken: comment.capToken,
774
+ capSecretKey: config.CAP_SECRET_KEY,
775
+ capApiEndpoint: config.CAP_API_ENDPOINT
776
+ })
770
777
  }
771
778
  }
772
779
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "twikoo-vercel",
3
- "version": "1.7.3",
3
+ "version": "1.7.5",
4
4
  "description": "A simple comment system.",
5
5
  "author": "imaegoo <hello@imaegoo.com> (https://github.com/imaegoo)",
6
6
  "license": "MIT",
@@ -13,7 +13,7 @@
13
13
  "dependencies": {
14
14
  "get-user-ip": "^1.0.1",
15
15
  "mongodb": "^6.3.0",
16
- "twikoo-func": "1.7.3",
16
+ "twikoo-func": "1.7.5",
17
17
  "uuid": "^8.3.2"
18
18
  }
19
19
  }