twikoo-func 1.6.25 → 1.6.26
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/package.json +2 -2
- package/utils/index.js +25 -20
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "twikoo-func",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.26",
|
|
4
4
|
"description": "A simple comment system.",
|
|
5
5
|
"author": "imaegoo <hello@imaegoo.com> (https://github.com/imaegoo)",
|
|
6
6
|
"license": "MIT",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"@cloudbase/node-sdk": "^2.5.0",
|
|
16
16
|
"@imaegoo/node-ip2region": "^2.1.1",
|
|
17
17
|
"akismet-api": "^5.1.0",
|
|
18
|
-
"axios": "^
|
|
18
|
+
"axios": "^1.6.2",
|
|
19
19
|
"blueimp-md5": "^2.18.0",
|
|
20
20
|
"bowser": "^2.11.0",
|
|
21
21
|
"cheerio": "1.0.0-rc.5",
|
package/utils/index.js
CHANGED
|
@@ -77,25 +77,27 @@ const fn = {
|
|
|
77
77
|
}
|
|
78
78
|
},
|
|
79
79
|
fixOS (os) {
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
os.
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
80
|
+
if (!os.versionName) {
|
|
81
|
+
// fix version name of Win 11 & macOS ^11 & Android ^10
|
|
82
|
+
if (os.name === 'Windows' && os.version === 'NT 11.0') {
|
|
83
|
+
os.versionName = '11'
|
|
84
|
+
} else if (os.name === 'macOS') {
|
|
85
|
+
const majorPlatformVersion = os.version.split('.')[0]
|
|
86
|
+
os.versionName = {
|
|
87
|
+
11: 'Big Sur',
|
|
88
|
+
12: 'Monterey',
|
|
89
|
+
13: 'Ventura',
|
|
90
|
+
14: 'Sonoma'
|
|
91
|
+
}[majorPlatformVersion]
|
|
92
|
+
} else if (os.name === 'Android') {
|
|
93
|
+
const majorPlatformVersion = os.version.split('.')[0]
|
|
94
|
+
os.versionName = {
|
|
95
|
+
10: 'Quince Tart',
|
|
96
|
+
11: 'Red Velvet Cake',
|
|
97
|
+
12: 'Snow Cone',
|
|
98
|
+
13: 'Tiramisu',
|
|
99
|
+
14: 'Upside Down Cake'
|
|
100
|
+
}[majorPlatformVersion]
|
|
99
101
|
}
|
|
100
102
|
}
|
|
101
103
|
return os
|
|
@@ -214,8 +216,11 @@ const fn = {
|
|
|
214
216
|
return true
|
|
215
217
|
} else if (config.FORBIDDEN_WORDS) {
|
|
216
218
|
// 违禁词检测
|
|
219
|
+
const commentLowerCase = comment.toLowerCase()
|
|
220
|
+
const nickLowerCase = nick.toLowerCase()
|
|
217
221
|
for (const forbiddenWord of config.FORBIDDEN_WORDS.split(',')) {
|
|
218
|
-
|
|
222
|
+
const forbiddenWordLowerCase = forbiddenWord.trim().toLowerCase()
|
|
223
|
+
if (commentLowerCase.indexOf(forbiddenWordLowerCase) !== -1 || nickLowerCase.indexOf(forbiddenWordLowerCase) !== -1) {
|
|
219
224
|
logger.warn('包含违禁词,直接标记为垃圾评论~')
|
|
220
225
|
return true
|
|
221
226
|
}
|