twikoo-vercel 1.7.22 → 1.7.23
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/api/index.js +5 -5
- package/package.json +2 -2
package/api/index.js
CHANGED
|
@@ -325,7 +325,7 @@ async function commentGet (event, accessToken) {
|
|
|
325
325
|
url: { $in: getUrlQuery(event.url) },
|
|
326
326
|
rid: { $in: ['', null] }
|
|
327
327
|
}
|
|
328
|
-
//
|
|
328
|
+
// 按当前用户和配置查询可见评论
|
|
329
329
|
query = getCommentQuery({ condition, uid, isAdminUser })
|
|
330
330
|
// 读取总条数
|
|
331
331
|
const count = await db
|
|
@@ -365,10 +365,7 @@ async function commentGet (event, accessToken) {
|
|
|
365
365
|
let top = []
|
|
366
366
|
if (!config.TOP_DISABLED && !event.before) {
|
|
367
367
|
// 查询置顶评论
|
|
368
|
-
query = {
|
|
369
|
-
...condition,
|
|
370
|
-
top: true
|
|
371
|
-
}
|
|
368
|
+
query = getCommentQuery({ condition: { ...condition, top: true }, uid, isAdminUser })
|
|
372
369
|
top = await db
|
|
373
370
|
.collection('comment')
|
|
374
371
|
.find(query)
|
|
@@ -456,6 +453,9 @@ async function commentSearch (event, accessToken) {
|
|
|
456
453
|
}
|
|
457
454
|
|
|
458
455
|
function getCommentQuery ({ condition, uid, isAdminUser }) {
|
|
456
|
+
if (config.HIDE_SPAM === 'true') {
|
|
457
|
+
return { ...condition, isSpam: { $ne: true } }
|
|
458
|
+
}
|
|
459
459
|
return {
|
|
460
460
|
$or: [
|
|
461
461
|
{ ...condition, isSpam: { $ne: isAdminUser ? 'imaegoo' : true } },
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "twikoo-vercel",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.23",
|
|
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.
|
|
16
|
+
"twikoo-func": "1.7.23",
|
|
17
17
|
"uuid": "^8.3.2"
|
|
18
18
|
}
|
|
19
19
|
}
|