@waline/vercel 1.4.1 → 1.5.0
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
package/src/config/middleware.js
CHANGED
|
@@ -3,6 +3,8 @@ const routerREST = require('think-router-rest');
|
|
|
3
3
|
const isDev = think.env === 'development';
|
|
4
4
|
const isTcb = think.env === 'cloudbase';
|
|
5
5
|
const isDeta = think.env === 'deta' || process.env.DETA_RUNTIME === 'true';
|
|
6
|
+
const isAliyunFC =
|
|
7
|
+
think.env === 'aliyun-fc' || Boolean(process.env.FC_RUNTIME_VERSION);
|
|
6
8
|
|
|
7
9
|
module.exports = [
|
|
8
10
|
{
|
|
@@ -15,7 +17,7 @@ module.exports = [
|
|
|
15
17
|
options: {
|
|
16
18
|
logRequest: isDev,
|
|
17
19
|
sendResponseTime: isDev,
|
|
18
|
-
requestTimeoutCallback: isTcb || isDeta ? false : () => {},
|
|
20
|
+
requestTimeoutCallback: isTcb || isDeta || isAliyunFC ? false : () => {},
|
|
19
21
|
},
|
|
20
22
|
},
|
|
21
23
|
|
|
@@ -4,6 +4,7 @@ const BaseRest = require('./rest');
|
|
|
4
4
|
const akismet = require('../service/akismet');
|
|
5
5
|
const { getMarkdownParser } = require('../service/markdown');
|
|
6
6
|
|
|
7
|
+
const markdownParser = getMarkdownParser();
|
|
7
8
|
async function formatCmt(
|
|
8
9
|
{ ua, user_id, ...comment },
|
|
9
10
|
users = [],
|
|
@@ -39,6 +40,7 @@ async function formatCmt(
|
|
|
39
40
|
comment.mail ? comment.mail.toLowerCase() : comment.mail
|
|
40
41
|
);
|
|
41
42
|
|
|
43
|
+
comment.comment = markdownParser(comment.comment);
|
|
42
44
|
return comment;
|
|
43
45
|
}
|
|
44
46
|
|
|
@@ -49,8 +51,6 @@ module.exports = class extends BaseRest {
|
|
|
49
51
|
`storage/${this.config('storage')}`,
|
|
50
52
|
'Comment'
|
|
51
53
|
);
|
|
52
|
-
|
|
53
|
-
this.parser = getMarkdownParser();
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
async getAction() {
|
|
@@ -248,17 +248,14 @@ module.exports = class extends BaseRest {
|
|
|
248
248
|
rid,
|
|
249
249
|
ua,
|
|
250
250
|
url,
|
|
251
|
+
comment,
|
|
251
252
|
ip: this.ctx.ip,
|
|
252
253
|
insertedAt: new Date(),
|
|
253
|
-
comment: this.parser(comment),
|
|
254
254
|
user_id: this.ctx.state.userInfo.objectId,
|
|
255
255
|
};
|
|
256
256
|
|
|
257
257
|
if (pid) {
|
|
258
|
-
data.comment = data.comment
|
|
259
|
-
'<p>',
|
|
260
|
-
`<p><a class="at" href="#${pid}">@${at}</a>: `
|
|
261
|
-
);
|
|
258
|
+
data.comment = `[@${at}](#${pid}): ` + data.comment;
|
|
262
259
|
}
|
|
263
260
|
|
|
264
261
|
think.logger.debug('Post Comment initial Data:', data);
|
|
@@ -16,7 +16,8 @@ module.exports = class extends Base {
|
|
|
16
16
|
const parseKey = (k) => (k === 'objectId' ? '_id' : k);
|
|
17
17
|
for (const k in where) {
|
|
18
18
|
if (think.isString(where[k])) {
|
|
19
|
-
_where[parseKey(k)] =
|
|
19
|
+
_where[parseKey(k)] =
|
|
20
|
+
k === 'objectId' ? this.db.ObjectId(where[k]) : where[k];
|
|
20
21
|
continue;
|
|
21
22
|
}
|
|
22
23
|
if (where[k] === undefined) {
|