twikoo-vercel 1.7.0 → 1.7.2

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 +12 -1
  2. package/package.json +2 -2
package/api/index.js CHANGED
@@ -33,6 +33,7 @@ const {
33
33
  getPasswordStatus,
34
34
  preCheckSpam,
35
35
  checkTurnstileCaptcha,
36
+ checkGeeTestCaptcha,
36
37
  getConfig,
37
38
  getConfigForAdmin,
38
39
  validate
@@ -750,12 +751,22 @@ async function limitFilter (request) {
750
751
  }
751
752
 
752
753
  async function checkCaptcha (comment, request) {
753
- if (config.TURNSTILE_SITE_KEY && config.TURNSTILE_SECRET_KEY) {
754
+ const provider = config.CAPTCHA_PROVIDER
755
+ if ((!provider || provider === 'Turnstile') && config.TURNSTILE_SITE_KEY && config.TURNSTILE_SECRET_KEY) {
754
756
  await checkTurnstileCaptcha({
755
757
  ip: getIp(request),
756
758
  turnstileToken: comment.turnstileToken,
757
759
  turnstileTokenSecretKey: config.TURNSTILE_SECRET_KEY
758
760
  })
761
+ } else if (provider === 'Geetest' && config.GEETEST_CAPTCHA_ID && config.GEETEST_CAPTCHA_KEY) {
762
+ await checkGeeTestCaptcha({
763
+ geeTestCaptchaId: config.GEETEST_CAPTCHA_ID,
764
+ geeTestCaptchaKey: config.GEETEST_CAPTCHA_KEY,
765
+ geeTestLotNumber: comment.geeTestLotNumber,
766
+ geeTestCaptchaOutput: comment.geeTestCaptchaOutput,
767
+ geeTestPassToken: comment.geeTestPassToken,
768
+ geeTestGenTime: comment.geeTestGenTime
769
+ })
759
770
  }
760
771
  }
761
772
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "twikoo-vercel",
3
- "version": "1.7.0",
3
+ "version": "1.7.2",
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.0",
16
+ "twikoo-func": "1.7.2",
17
17
  "uuid": "^8.3.2"
18
18
  }
19
19
  }