@waline/vercel 1.23.1 → 1.23.3

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.23.1",
3
+ "version": "1.23.3",
4
4
  "description": "vercel server for waline comment system",
5
5
  "keywords": [
6
6
  "waline",
@@ -33,7 +33,7 @@
33
33
  "markdown-it-sup": "1.0.0",
34
34
  "mathjax-full": "3.2.2",
35
35
  "node-fetch": "2.6.7",
36
- "nodemailer": "6.7.8",
36
+ "nodemailer": "6.8.0",
37
37
  "nunjucks": "3.2.3",
38
38
  "phpass": "0.1.1",
39
39
  "prismjs": "1.29.0",
@@ -78,7 +78,10 @@ module.exports = class extends BaseRest {
78
78
 
79
79
  const ret = await this.modelInstance.update(
80
80
  (counter) => ({
81
- [type]: action === 'desc' ? counter[type] - 1 : counter[type] + 1,
81
+ [type]:
82
+ action === 'desc'
83
+ ? (counter[type] || 1) - 1
84
+ : (counter[type] || 0) + 1,
82
85
  }),
83
86
  { objectId: ['IN', resp.map(({ objectId }) => objectId)] }
84
87
  );
@@ -533,8 +533,8 @@ module.exports = class extends BaseRest {
533
533
  think.logger.debug(`Comment post frequence check OK!`);
534
534
 
535
535
  /** Akismet */
536
- const { COMMENT_AUDIT, AUTHOR_EMAIL, BLOGGER_EMAIL } = process.env;
537
- const AUTHOR = AUTHOR_EMAIL || BLOGGER_EMAIL;
536
+ const { COMMENT_AUDIT, AUTHOR_EMAIL } = process.env;
537
+ const AUTHOR = AUTHOR_EMAIL;
538
538
  const isAuthorComment = AUTHOR
539
539
  ? data.mail.toLowerCase() === AUTHOR.toLowerCase()
540
540
  : false;
@@ -21,7 +21,7 @@ module.exports = class extends Base {
21
21
  string: true,
22
22
  in: ['inc', 'desc'],
23
23
  default: 'inc',
24
- }
24
+ },
25
25
  };
26
26
  }
27
27
  };
@@ -26,7 +26,7 @@ module.exports = class extends think.Service {
26
26
  } else {
27
27
  config.host = SMTP_HOST;
28
28
  config.port = parseInt(SMTP_PORT);
29
- config.secure = SMTP_SECURE !== 'false';
29
+ config.secure = SMTP_SECURE && SMTP_SECURE !== 'false';
30
30
  }
31
31
  this.transporter = nodemailer.createTransport(config);
32
32
  }
@@ -379,10 +379,10 @@ module.exports = class extends think.Service {
379
379
  }
380
380
 
381
381
  async run(comment, parent, disableAuthorNotify = false) {
382
- const { AUTHOR_EMAIL, BLOGGER_EMAIL, DISABLE_AUTHOR_NOTIFY } = process.env;
382
+ const { AUTHOR_EMAIL, DISABLE_AUTHOR_NOTIFY } = process.env;
383
383
  const { mailSubject, mailTemplate, mailSubjectAdmin, mailTemplateAdmin } =
384
384
  think.config();
385
- const AUTHOR = AUTHOR_EMAIL || BLOGGER_EMAIL;
385
+ const AUTHOR = AUTHOR_EMAIL;
386
386
 
387
387
  const mailList = [];
388
388
  const isAuthorComment = AUTHOR
@@ -47,7 +47,7 @@ module.exports = class extends Base {
47
47
  return (lastKey - Math.round(Math.random() * 100)).toString();
48
48
  }
49
49
 
50
- where(where) {
50
+ parseWhere(where) {
51
51
  if (think.isEmpty(where)) {
52
52
  return;
53
53
  }
@@ -122,6 +122,29 @@ module.exports = class extends Base {
122
122
  return this.complex(conditions, _isArrayKeys);
123
123
  }
124
124
 
125
+ where(where) {
126
+ const filter = this.parseWhere(where);
127
+
128
+ if (!where._complex) {
129
+ return filter;
130
+ }
131
+
132
+ const filters = [];
133
+
134
+ for (const k in where._complex) {
135
+ if (k === '_logic') {
136
+ continue;
137
+ }
138
+ filters.push({
139
+ ...this.parseWhere({ [k]: where._complex[k] }),
140
+ ...filter,
141
+ });
142
+ }
143
+
144
+ // just support OR logic for deta
145
+ return filters;
146
+ }
147
+
125
148
  async select(where, { limit, offset, field } = {}) {
126
149
  const conditions = this.where(where);
127
150
 
@@ -44,7 +44,7 @@ module.exports = class extends Base {
44
44
 
45
45
  instance.where(this.parseWhere(where));
46
46
  if (desc) {
47
- instance.order(`"${desc}" DESC`);
47
+ instance.order({ [desc]: 'DESC' });
48
48
  }
49
49
  if (limit || offset) {
50
50
  instance.limit(offset || 0, limit);