@waline/vercel 1.24.0 → 1.24.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@waline/vercel",
3
- "version": "1.24.0",
3
+ "version": "1.24.1",
4
4
  "description": "vercel server for waline comment system",
5
5
  "keywords": [
6
6
  "waline",
@@ -16,7 +16,7 @@
16
16
  "author": "lizheming <i@imnerd.org>",
17
17
  "dependencies": {
18
18
  "@cloudbase/node-sdk": "2.9.1",
19
- "@koa/cors": "3.4.2",
19
+ "@koa/cors": "4.0.0",
20
20
  "akismet": "2.0.7",
21
21
  "deta": "1.1.0",
22
22
  "dompurify": "2.4.0",
@@ -32,7 +32,6 @@
32
32
  "markdown-it-sub": "1.0.0",
33
33
  "markdown-it-sup": "1.0.0",
34
34
  "mathjax-full": "3.2.2",
35
- "mongodb": "4.10.0",
36
35
  "node-fetch": "2.6.7",
37
36
  "nodemailer": "6.8.0",
38
37
  "nunjucks": "3.2.3",
@@ -48,7 +47,7 @@
48
47
  "think-mongo": "2.2.1",
49
48
  "think-router-rest": "1.0.5",
50
49
  "thinkjs": "3.2.14",
51
- "ua-parser-js": "1.0.2"
50
+ "ua-parser-js": "1.0.32"
52
51
  },
53
52
  "engines": {
54
53
  "node": ">=14"
@@ -57,6 +57,11 @@ async function formatCmt(
57
57
  }
58
58
  comment.comment = markdownParser(comment.comment);
59
59
  comment.like = Number(comment.like) || 0;
60
+
61
+ // compat sql storage return number flag to string
62
+ if (typeof comment.sticky === 'string') {
63
+ comment.sticky = Boolean(Number(comment.sticky));
64
+ }
60
65
 
61
66
  return comment;
62
67
  }
@@ -17,5 +17,3 @@
17
17
  "MAIL_SUBJECT_ADMIN": "{{site.name | safe}} 上有新评论了",
18
18
  "MAIL_TEMPLATE_ADMIN": "<div style='border-top:2px solid #12ADDB;box-shadow:0 1px 3px #AAAAAA;line-height:180%;padding:0 15px 12px;margin:50px auto;font-size:12px;'> <h2 style='border-bottom:1px solid #DDD;font-size:14px;font-weight:normal;padding:13px 0 10px 8px;'> 您在<a style='text-decoration:none;color: #12ADDB;' href='{{site.url}}' target='_blank'>{{site.name}}</a>上的文章有了新的评论 </h2> <p><strong>{{self.nick}}</strong>回复说:</p><div style='background-color: #f5f5f5;padding: 10px 15px;margin:18px 0;word-wrap:break-word;'>{{self.comment | safe}}</div><p>您可以点击<a style='text-decoration:none; color:#12addb' href='{{site.postUrl}}' target='_blank'>查看回复的完整內容</a></p><br/> </div>"
19
19
  }
20
-
21
-
@@ -16,5 +16,4 @@
16
16
  "MAIL_TEMPLATE": "<div style='border-top:2px solid #12ADDB;box-shadow:0 1px 3px #AAAAAA;line-height:180%;padding:0 15px 12px;margin:50px auto;font-size:12px;'> <h2 style='border-bottom:1px solid #DDD;font-size:14px;font-weight:normal;padding:13px 0 10px 8px;'> 您在<a style='text-decoration:none;color: #12ADDB;' href='{{site.url}}' target='_blank'>{{site.name}}</a>上的品論有新的回復 </h2>{{parent.nick}}同學,您層發表評論: <div style='padding:0 12px 0 12px;margin-top:18px'> <div style='background-color: #f5f5f5;padding: 10px 15px;margin:18px 0;word-wrap:break-word;'>{{parent.comment | safe}}</div><p><strong>{{self.nick}}</strong>回復說:</p><div style='background-color: #f5f5f5;padding: 10px 15px;margin:18px 0;word-wrap:break-word;'>{{self.comment | safe}}</div><p>您可以點擊<a style='text-decoration:none; color:#12addb' href='{{site.postUrl}}' target='_blank'>查看回復的完整內容</a>,歡迎再次光臨<a style='text-decoration:none; color:#12addb' href='{{site.url}}' target='_blank'>{{site.name}}</a>。</p><br/> </div></div>",
17
17
  "MAIL_SUBJECT_ADMIN": "{{site.name | safe}} 上有新評論了",
18
18
  "MAIL_TEMPLATE_ADMIN": "<div style='border-top:2px solid #12ADDB;box-shadow:0 1px 3px #AAAAAA;line-height:180%;padding:0 15px 12px;margin:50px auto;font-size:12px;'> <h2 style='border-bottom:1px solid #DDD;font-size:14px;font-weight:normal;padding:13px 0 10px 8px;'> 您在<a style='text-decoration:none;color: #12ADDB;' href='{{site.url}}' target='_blank'>{{site.name}}</a>上的文章有新評論了 </h2> <p><strong>{{self.nick}}</strong>回復說:</p><div style='background-color: #f5f5f5;padding: 10px 15px;margin:18px 0;word-wrap:break-word;'>{{self.comment | safe}}</div><p>您可以點擊<a style='text-decoration:none; color:#12addb' href='{{site.postUrl}}' target='_blank'>查看回復的完整內容</a></p><br/> </div>"
19
-
20
19
  }
@@ -287,11 +287,18 @@ module.exports = class extends think.Service {
287
287
  form.append('chat_id', TG_CHAT_ID);
288
288
  form.append('parse_mode', 'MarkdownV2');
289
289
 
290
- return fetch(`https://api.telegram.org/bot${TG_BOT_TOKEN}/sendMessage`, {
291
- method: 'POST',
292
- header: form.getHeaders(),
293
- body: form,
294
- }).then((resp) => resp.json());
290
+ const resp = await fetch(
291
+ `https://api.telegram.org/bot${TG_BOT_TOKEN}/sendMessage`,
292
+ {
293
+ method: 'POST',
294
+ header: form.getHeaders(),
295
+ body: form,
296
+ }
297
+ ).then((resp) => resp.json());
298
+
299
+ if (!resp.ok) {
300
+ throw new Error(resp.description);
301
+ }
295
302
  }
296
303
 
297
304
  async pushplus({ title, content }, self, parent) {
@@ -1,4 +1,4 @@
1
- const { ObjectId } = require('mongodb');
1
+ const { ObjectID: ObjectId } = require('think-mongo/lib/model');
2
2
  const Base = require('./base');
3
3
 
4
4
  module.exports = class extends Base {