tkserver 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.
- package/index.js +11 -3
- package/mongo.js +8 -1
- package/package.json +2 -2
package/index.js
CHANGED
|
@@ -36,6 +36,7 @@ const {
|
|
|
36
36
|
preCheckSpam,
|
|
37
37
|
checkTurnstileCaptcha,
|
|
38
38
|
checkGeeTestCaptcha,
|
|
39
|
+
checkCapCaptcha,
|
|
39
40
|
getConfig,
|
|
40
41
|
getConfigForAdmin,
|
|
41
42
|
validate
|
|
@@ -756,16 +757,17 @@ async function checkCaptcha (comment, request) {
|
|
|
756
757
|
CAPTCHA_PROVIDER: config.CAPTCHA_PROVIDER,
|
|
757
758
|
TURNSTILE_SITE_KEY: config.TURNSTILE_SITE_KEY,
|
|
758
759
|
GEETEST_CAPTCHA_ID: config.GEETEST_CAPTCHA_ID,
|
|
759
|
-
GEETEST_CAPTCHA_KEY: config.GEETEST_CAPTCHA_KEY ? '***' : undefined
|
|
760
|
+
GEETEST_CAPTCHA_KEY: config.GEETEST_CAPTCHA_KEY ? '***' : undefined,
|
|
761
|
+
CAP_API_ENDPOINT: config.CAP_API_ENDPOINT
|
|
760
762
|
})
|
|
761
763
|
const provider = config.CAPTCHA_PROVIDER
|
|
762
|
-
if (
|
|
764
|
+
if (provider === 'Turnstile' && config.TURNSTILE_SITE_KEY && config.TURNSTILE_SECRET_KEY) {
|
|
763
765
|
await checkTurnstileCaptcha({
|
|
764
766
|
ip: getIp(request),
|
|
765
767
|
turnstileToken: comment.turnstileToken,
|
|
766
768
|
turnstileTokenSecretKey: config.TURNSTILE_SECRET_KEY
|
|
767
769
|
})
|
|
768
|
-
} else if (
|
|
770
|
+
} else if (provider === 'Geetest' && config.GEETEST_CAPTCHA_ID && config.GEETEST_CAPTCHA_KEY) {
|
|
769
771
|
await checkGeeTestCaptcha({
|
|
770
772
|
geeTestCaptchaId: config.GEETEST_CAPTCHA_ID,
|
|
771
773
|
geeTestCaptchaKey: config.GEETEST_CAPTCHA_KEY,
|
|
@@ -774,6 +776,12 @@ async function checkCaptcha (comment, request) {
|
|
|
774
776
|
geeTestPassToken: comment.geeTestPassToken,
|
|
775
777
|
geeTestGenTime: comment.geeTestGenTime
|
|
776
778
|
})
|
|
779
|
+
} else if (provider === 'Cap' && config.CAP_API_ENDPOINT && config.CAP_SECRET_KEY) {
|
|
780
|
+
await checkCapCaptcha({
|
|
781
|
+
capToken: comment.capToken,
|
|
782
|
+
capSecretKey: config.CAP_SECRET_KEY,
|
|
783
|
+
capApiEndpoint: config.CAP_API_ENDPOINT
|
|
784
|
+
})
|
|
777
785
|
}
|
|
778
786
|
}
|
|
779
787
|
|
package/mongo.js
CHANGED
|
@@ -33,6 +33,7 @@ const {
|
|
|
33
33
|
preCheckSpam,
|
|
34
34
|
checkTurnstileCaptcha,
|
|
35
35
|
checkGeeTestCaptcha,
|
|
36
|
+
checkCapCaptcha,
|
|
36
37
|
getConfig,
|
|
37
38
|
getConfigForAdmin,
|
|
38
39
|
validate
|
|
@@ -737,7 +738,7 @@ async function limitFilter (request) {
|
|
|
737
738
|
|
|
738
739
|
async function checkCaptcha (comment, request) {
|
|
739
740
|
const provider = config.CAPTCHA_PROVIDER
|
|
740
|
-
if (
|
|
741
|
+
if (provider === 'Turnstile' && config.TURNSTILE_SITE_KEY && config.TURNSTILE_SECRET_KEY) {
|
|
741
742
|
await checkTurnstileCaptcha({
|
|
742
743
|
ip: getIp(request),
|
|
743
744
|
turnstileToken: comment.turnstileToken,
|
|
@@ -752,6 +753,12 @@ async function checkCaptcha (comment, request) {
|
|
|
752
753
|
geeTestPassToken: comment.geeTestPassToken,
|
|
753
754
|
geeTestGenTime: comment.geeTestGenTime
|
|
754
755
|
})
|
|
756
|
+
} else if (provider === 'Cap' && config.CAP_API_ENDPOINT && config.CAP_SECRET_KEY) {
|
|
757
|
+
await checkCapCaptcha({
|
|
758
|
+
capToken: comment.capToken,
|
|
759
|
+
capSecretKey: config.CAP_SECRET_KEY,
|
|
760
|
+
capApiEndpoint: config.CAP_API_ENDPOINT
|
|
761
|
+
})
|
|
755
762
|
}
|
|
756
763
|
}
|
|
757
764
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tkserver",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.5",
|
|
4
4
|
"description": "A simple comment system.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"twikoo",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"get-user-ip": "^1.0.1",
|
|
32
32
|
"lokijs": "^1.5.12",
|
|
33
33
|
"mongodb": "^6.3.0",
|
|
34
|
-
"twikoo-func": "1.7.
|
|
34
|
+
"twikoo-func": "1.7.5",
|
|
35
35
|
"uuid": "^8.3.2"
|
|
36
36
|
}
|
|
37
37
|
}
|