@waline/vercel 1.18.3 → 1.18.6

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 CHANGED
@@ -1,5 +1,5 @@
1
- const os = require('node:os');
2
- const path = require('node:path');
1
+ const os = require('os');
2
+ const path = require('path');
3
3
  const Application = require('thinkjs');
4
4
  const Loader = require('thinkjs/lib/loader');
5
5
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@waline/vercel",
3
- "version": "1.18.3",
3
+ "version": "1.18.6",
4
4
  "description": "vercel server for waline comment system",
5
5
  "keywords": [
6
6
  "waline",
@@ -15,38 +15,39 @@
15
15
  "license": "MIT",
16
16
  "author": "lizheming <i@imnerd.org>",
17
17
  "dependencies": {
18
- "@cloudbase/node-sdk": "^2.9.0",
19
- "@koa/cors": "^3.3.0",
20
- "akismet": "^2.0.7",
21
- "deta": "^1.1.0",
22
- "dompurify": "^2.3.6",
23
- "dy-node-ip2region": "^1.0.1",
24
- "fast-csv": "^4.3.6",
25
- "jsdom": "^19.0.0",
26
- "jsonwebtoken": "^8.5.1",
27
- "katex": "^0.15.3",
28
- "leancloud-storage": "^4.12.2",
29
- "markdown-it": "^13.0.1",
30
- "markdown-it-emoji": "^2.0.2",
31
- "markdown-it-sub": "^1.0.0",
32
- "markdown-it-sup": "^1.0.0",
33
- "mathjax-full": "^3.2.0",
34
- "nodemailer": "^6.7.5",
35
- "nunjucks": "^3.2.3",
36
- "phpass": "^0.1.1",
37
- "prismjs": "^1.28.0",
38
- "request": "^2.88.2",
39
- "request-promise-native": "^1.0.9",
40
- "speakeasy": "^2.0.0",
41
- "think-logger3": "^1.3.1",
42
- "think-model": "^1.5.4",
43
- "think-model-mysql": "^1.1.7",
18
+ "@cloudbase/node-sdk": "2.9.1",
19
+ "@koa/cors": "3.3.0",
20
+ "akismet": "2.0.7",
21
+ "deta": "1.1.0",
22
+ "dompurify": "2.3.8",
23
+ "dy-node-ip2region": "1.0.1",
24
+ "fast-csv": "4.3.6",
25
+ "jsdom": "19.0.0",
26
+ "jsonwebtoken": "8.5.1",
27
+ "katex": "0.15.6",
28
+ "leancloud-storage": "4.12.2",
29
+ "markdown-it": "13.0.1",
30
+ "markdown-it-emoji": "2.0.2",
31
+ "markdown-it-sub": "1.0.0",
32
+ "markdown-it-sup": "1.0.0",
33
+ "mathjax-full": "3.2.1",
34
+ "nodemailer": "6.7.5",
35
+ "nunjucks": "3.2.3",
36
+ "phpass": "0.1.1",
37
+ "prismjs": "1.28.0",
38
+ "request": "2.88.2",
39
+ "request-promise-native": "1.0.9",
40
+ "speakeasy": "2.0.0",
41
+ "think-helper": "^1.1.3",
42
+ "think-logger3": "1.3.1",
43
+ "think-model": "1.5.4",
44
+ "think-model-mysql": "1.1.7",
44
45
  "think-model-postgresql": "1.1.6",
45
- "think-model-sqlite": "^1.2.3",
46
- "think-mongo": "^2.2.1",
47
- "think-router-rest": "^1.0.5",
48
- "thinkjs": "^3.2.14",
49
- "ua-parser-js": "^1.0.2"
46
+ "think-model-sqlite": "1.2.3",
47
+ "think-mongo": "2.2.1",
48
+ "think-router-rest": "1.0.5",
49
+ "thinkjs": "3.2.14",
50
+ "ua-parser-js": "1.0.2"
50
51
  },
51
52
  "engines": {
52
53
  "node": ">=14"
@@ -92,7 +92,7 @@ const markdown = {
92
92
 
93
93
  if (isFalse(MARKDOWN_HIGHLIGHT)) markdown.config.highlight = false;
94
94
 
95
- let avatarProxy = 'https://avatar.75cdn.workers.dev/';
95
+ let avatarProxy = '';
96
96
  if (AVATAR_PROXY) {
97
97
  avatarProxy = !isFalse(AVATAR_PROXY) ? AVATAR_PROXY : '';
98
98
  }
@@ -556,7 +556,12 @@ module.exports = class extends BaseRest {
556
556
 
557
557
  if (comment.status !== 'spam') {
558
558
  const notify = this.service('notify');
559
- await notify.run({ ...resp, rawComment: comment }, parentComment);
559
+ await notify.run(
560
+ { ...resp, comment: markdownParser(resp.comment), rawComment: comment },
561
+ parentComment
562
+ ? { ...parentComment, comment: markdownParser(parentComment.comment) }
563
+ : undefined
564
+ );
560
565
  }
561
566
 
562
567
  think.logger.debug(`Comment notify done!`);
@@ -616,7 +621,11 @@ module.exports = class extends BaseRest {
616
621
  pComment = pComment[0];
617
622
 
618
623
  const notify = this.service('notify');
619
- await notify.run(newData, pComment, true);
624
+ await notify.run(
625
+ { ...newData, comment: markdownParser(newData.comment) },
626
+ { ...pComment, comment: markdownParser(pComment.comment) },
627
+ true
628
+ );
620
629
  }
621
630
 
622
631
  await this.hook('postUpdate', data);
@@ -631,7 +640,14 @@ module.exports = class extends BaseRest {
631
640
  return this.fail(preDeleteResp);
632
641
  }
633
642
 
634
- await this.modelInstance.delete({ objectId: this.id });
643
+ await this.modelInstance.delete({
644
+ _complex: {
645
+ _logic: 'or',
646
+ objectId: this.id,
647
+ pid: this.id,
648
+ rid: this.id,
649
+ },
650
+ });
635
651
  await this.hook('postDelete', this.id);
636
652
 
637
653
  return this.success();
@@ -1,5 +1,5 @@
1
- const fs = require('node:fs');
2
- const util = require('node:util');
1
+ const fs = require('fs');
2
+ const util = require('util');
3
3
  const BaseRest = require('./rest');
4
4
 
5
5
  const readFileAsync = util.promisify(fs.readFile);
@@ -1,4 +1,4 @@
1
- const qs = require('node:querystring');
1
+ const qs = require('querystring');
2
2
  const jwt = require('jsonwebtoken');
3
3
  const { PasswordHash } = require('phpass');
4
4
  const request = require('request-promise-native');
@@ -1,4 +1,4 @@
1
- const path = require('node:path');
1
+ const path = require('path');
2
2
 
3
3
  module.exports = class extends think.Controller {
4
4
  static get _REST() {
@@ -1,4 +1,4 @@
1
- const qs = require('node:querystring');
1
+ const qs = require('querystring');
2
2
  const { PasswordHash } = require('phpass');
3
3
  const BaseRest = require('./rest');
4
4
 
@@ -1,4 +1,4 @@
1
- const path = require('node:path');
1
+ const path = require('path');
2
2
  const { parseString, writeToString } = require('fast-csv');
3
3
  const request = require('request-promise-native');
4
4
  const Base = require('./base');
@@ -13,6 +13,11 @@ module.exports = class extends Base {
13
13
  continue;
14
14
  }
15
15
 
16
+ if (k === '_complex') {
17
+ where[k] = this.parseWhere(filter[k]);
18
+ continue;
19
+ }
20
+
16
21
  if (filter[k] === undefined) {
17
22
  where[k] = null;
18
23
  continue;
package/vanilla.js CHANGED
@@ -1,4 +1,4 @@
1
- const path = require('node:path');
1
+ const path = require('path');
2
2
  const Application = require('thinkjs');
3
3
 
4
4
  const instance = new Application({