twikoo-func 1.6.0-beta.1 → 1.6.1
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 +1 -1
- package/package.json +2 -2
- package/utils/import.js +6 -0
- package/utils/lib.js +1 -1
package/index.js
CHANGED
|
@@ -63,7 +63,7 @@ const requestTimes = {}
|
|
|
63
63
|
// 云函数入口点 / entry point
|
|
64
64
|
exports.main = async (event, context) => {
|
|
65
65
|
console.log('请求 IP:', auth.getClientIP())
|
|
66
|
-
console.log('
|
|
66
|
+
console.log('请求函数:', event.event)
|
|
67
67
|
console.log('请求参数:', event)
|
|
68
68
|
let res = {}
|
|
69
69
|
try {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "twikoo-func",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.1",
|
|
4
4
|
"description": "A simple comment system.",
|
|
5
5
|
"author": "imaegoo <hello@imaegoo.com> (https://github.com/imaegoo)",
|
|
6
6
|
"license": "MIT",
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
"dependencies": {
|
|
14
14
|
"@cloudbase/manager-node": "^3.9.0",
|
|
15
15
|
"@cloudbase/node-sdk": "^2.5.0",
|
|
16
|
+
"@imaegoo/node-ip2region": "^2.1.1",
|
|
16
17
|
"akismet-api": "^5.1.0",
|
|
17
18
|
"axios": "^0.21.1",
|
|
18
19
|
"blueimp-md5": "^2.18.0",
|
|
@@ -20,7 +21,6 @@
|
|
|
20
21
|
"cheerio": "1.0.0-rc.5",
|
|
21
22
|
"crypto-js": "^4.0.0",
|
|
22
23
|
"dompurify": "^2.2.6",
|
|
23
|
-
"dy-node-ip2region": "^1.0.1",
|
|
24
24
|
"form-data": "^4.0.0",
|
|
25
25
|
"jsdom": "^16.4.0",
|
|
26
26
|
"marked": "^4.0.12",
|
package/utils/import.js
CHANGED
|
@@ -196,6 +196,12 @@ const fn = {
|
|
|
196
196
|
// 解决 id 历史数据问题
|
|
197
197
|
parsed._id = comment._id.$oid
|
|
198
198
|
}
|
|
199
|
+
if (comment.pid === null) {
|
|
200
|
+
delete comment.pid
|
|
201
|
+
}
|
|
202
|
+
if (comment.rid === null) {
|
|
203
|
+
delete comment.rid
|
|
204
|
+
}
|
|
199
205
|
comments.push(parsed)
|
|
200
206
|
log(`${comment._id} 解析成功`)
|
|
201
207
|
} catch (e) {
|
package/utils/lib.js
CHANGED
|
@@ -6,7 +6,7 @@ const { JSDOM } = require('jsdom') // document.window 服务器版
|
|
|
6
6
|
const axios = require('axios') // 发送 REST 请求
|
|
7
7
|
const bowser = require('bowser') // UserAgent 格式化
|
|
8
8
|
const createDOMPurify = require('dompurify') // 反 XSS
|
|
9
|
-
const ipToRegion = require('
|
|
9
|
+
const ipToRegion = require('@imaegoo/node-ip2region') // IP 属地查询
|
|
10
10
|
const marked = require('marked') // Markdown 解析
|
|
11
11
|
const md5 = require('blueimp-md5') // MD5 加解密
|
|
12
12
|
const nodemailer = require('nodemailer') // 发送邮件
|