@waline/vercel 1.34.1 → 1.35.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/Dockerfile +3 -3
- package/Dockerfile.alpine +3 -3
- package/package.json +1 -1
- package/src/config/adapter.js +4 -5
- package/src/service/notify.js +17 -17
package/Dockerfile
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
# https://github.com/nodejs/LTS
|
|
2
2
|
FROM node:lts AS build
|
|
3
3
|
WORKDIR /app
|
|
4
|
-
ENV NODE_ENV
|
|
4
|
+
ENV NODE_ENV="production"
|
|
5
5
|
RUN set -eux; \
|
|
6
6
|
# npm config set registry https://registry.npm.taobao.org; \
|
|
7
7
|
npm install --production --silent @waline/vercel
|
|
8
8
|
|
|
9
9
|
FROM node:lts-slim
|
|
10
10
|
WORKDIR /app
|
|
11
|
-
ENV TZ
|
|
12
|
-
ENV NODE_ENV
|
|
11
|
+
ENV TZ="Asia/Shanghai"
|
|
12
|
+
ENV NODE_ENV="production"
|
|
13
13
|
COPY --from=build /app .
|
|
14
14
|
EXPOSE 8360
|
|
15
15
|
CMD ["node", "node_modules/@waline/vercel/vanilla.js"]
|
package/Dockerfile.alpine
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
# https://github.com/nodejs/LTS
|
|
2
2
|
FROM node:lts AS build
|
|
3
3
|
WORKDIR /app
|
|
4
|
-
ENV NODE_ENV
|
|
4
|
+
ENV NODE_ENV="production"
|
|
5
5
|
RUN set -eux; \
|
|
6
6
|
# npm config set registry https://registry.npm.taobao.org; \
|
|
7
7
|
npm install --production --silent @waline/vercel
|
|
8
8
|
|
|
9
9
|
FROM node:lts-alpine
|
|
10
10
|
WORKDIR /app
|
|
11
|
-
ENV TZ
|
|
12
|
-
ENV NODE_ENV
|
|
11
|
+
ENV TZ="Asia/Shanghai"
|
|
12
|
+
ENV NODE_ENV="production"
|
|
13
13
|
RUN set -eux; \
|
|
14
14
|
# sed -i 's/dl-cdn.alpinelinux.org/mirrors.tuna.tsinghua.edu.cn/g' /etc/apk/repositories; \
|
|
15
15
|
apk add --no-cache bash; \
|
package/package.json
CHANGED
package/src/config/adapter.js
CHANGED
|
@@ -46,6 +46,7 @@ const {
|
|
|
46
46
|
POSTGRES_USER,
|
|
47
47
|
PG_SSL,
|
|
48
48
|
POSTGRES_SSL,
|
|
49
|
+
POSTGRES_URL,
|
|
49
50
|
MONGO_AUTHSOURCE,
|
|
50
51
|
MONGO_DB,
|
|
51
52
|
MONGO_HOST,
|
|
@@ -83,9 +84,6 @@ if (MONGO_DB) {
|
|
|
83
84
|
type = 'tidb';
|
|
84
85
|
}
|
|
85
86
|
|
|
86
|
-
const isVercelPostgres =
|
|
87
|
-
type === 'postgresql' && POSTGRES_HOST?.endsWith('vercel-storage.com');
|
|
88
|
-
|
|
89
87
|
exports.model = {
|
|
90
88
|
type,
|
|
91
89
|
common: {
|
|
@@ -116,11 +114,12 @@ exports.model = {
|
|
|
116
114
|
password: PG_PASSWORD || POSTGRES_PASSWORD,
|
|
117
115
|
database: PG_DB || POSTGRES_DATABASE,
|
|
118
116
|
host: PG_HOST || POSTGRES_HOST || '127.0.0.1',
|
|
119
|
-
port: PG_PORT || POSTGRES_PORT ||
|
|
117
|
+
port: PG_PORT || POSTGRES_PORT || '5432',
|
|
120
118
|
connectionLimit: 1,
|
|
121
119
|
prefix: PG_PREFIX || POSTGRES_PREFIX || 'wl_',
|
|
122
120
|
ssl:
|
|
123
|
-
(PG_SSL || POSTGRES_SSL) == 'true' ||
|
|
121
|
+
(PG_SSL || POSTGRES_SSL) == 'true' ||
|
|
122
|
+
POSTGRES_URL?.includes('sslmode=require')
|
|
124
123
|
? {
|
|
125
124
|
rejectUnauthorized: false,
|
|
126
125
|
}
|
package/src/service/notify.js
CHANGED
|
@@ -5,10 +5,10 @@ const nodemailer = require('nodemailer');
|
|
|
5
5
|
const nunjucks = require('nunjucks');
|
|
6
6
|
|
|
7
7
|
module.exports = class extends think.Service {
|
|
8
|
-
constructor(
|
|
9
|
-
super(
|
|
8
|
+
constructor(controller) {
|
|
9
|
+
super(controller);
|
|
10
10
|
|
|
11
|
-
this.
|
|
11
|
+
this.controller = controller;
|
|
12
12
|
const {
|
|
13
13
|
SMTP_USER,
|
|
14
14
|
SMTP_PASS,
|
|
@@ -55,8 +55,8 @@ module.exports = class extends think.Service {
|
|
|
55
55
|
},
|
|
56
56
|
};
|
|
57
57
|
|
|
58
|
-
title = this.
|
|
59
|
-
content = this.
|
|
58
|
+
title = this.controller.locale(title, data);
|
|
59
|
+
content = this.controller.locale(content, data);
|
|
60
60
|
|
|
61
61
|
return this.transporter.sendMail({
|
|
62
62
|
from:
|
|
@@ -94,8 +94,8 @@ module.exports = class extends think.Service {
|
|
|
94
94
|
【内容】:{{self.comment}}
|
|
95
95
|
【地址】:{{site.postUrl}}`;
|
|
96
96
|
|
|
97
|
-
title = this.
|
|
98
|
-
content = this.
|
|
97
|
+
title = this.controller.locale(title, data);
|
|
98
|
+
content = this.controller.locale(contentWechat, data);
|
|
99
99
|
|
|
100
100
|
const form = new FormData();
|
|
101
101
|
|
|
@@ -145,8 +145,8 @@ module.exports = class extends think.Service {
|
|
|
145
145
|
【内容】:{{self.comment}}
|
|
146
146
|
<a href='{{site.postUrl}}'>查看详情</a>`;
|
|
147
147
|
|
|
148
|
-
title = this.
|
|
149
|
-
const desp = this.
|
|
148
|
+
title = this.controller.locale(title, data);
|
|
149
|
+
const desp = this.controller.locale(contentWechat, data);
|
|
150
150
|
|
|
151
151
|
content = desp.replace(/\n/g, '<br/>');
|
|
152
152
|
|
|
@@ -235,7 +235,7 @@ module.exports = class extends think.Service {
|
|
|
235
235
|
|
|
236
236
|
const form = new FormData();
|
|
237
237
|
|
|
238
|
-
form.append('msg', this.
|
|
238
|
+
form.append('msg', this.controller.locale(contentQQ, data));
|
|
239
239
|
form.append('qq', QQ_ID);
|
|
240
240
|
|
|
241
241
|
const qmsgHost = QMSG_HOST
|
|
@@ -308,7 +308,7 @@ module.exports = class extends think.Service {
|
|
|
308
308
|
|
|
309
309
|
const form = new FormData();
|
|
310
310
|
|
|
311
|
-
form.append('text', this.
|
|
311
|
+
form.append('text', this.controller.locale(contentTG, data));
|
|
312
312
|
form.append('chat_id', TG_CHAT_ID);
|
|
313
313
|
form.append('parse_mode', 'MarkdownV2');
|
|
314
314
|
|
|
@@ -352,8 +352,8 @@ module.exports = class extends think.Service {
|
|
|
352
352
|
},
|
|
353
353
|
};
|
|
354
354
|
|
|
355
|
-
title = this.
|
|
356
|
-
content = this.
|
|
355
|
+
title = this.controller.locale(title, data);
|
|
356
|
+
content = this.controller.locale(content, data);
|
|
357
357
|
|
|
358
358
|
const form = new FormData();
|
|
359
359
|
|
|
@@ -389,8 +389,8 @@ module.exports = class extends think.Service {
|
|
|
389
389
|
},
|
|
390
390
|
};
|
|
391
391
|
|
|
392
|
-
title = this.
|
|
393
|
-
content = this.
|
|
392
|
+
title = this.controller.locale(title, data);
|
|
393
|
+
content = this.controller.locale(
|
|
394
394
|
think.config('DiscordTemplate') ||
|
|
395
395
|
`💬 {{site.name|safe}} 有新评论啦
|
|
396
396
|
【评论者昵称】:{{self.nick}}
|
|
@@ -440,7 +440,7 @@ module.exports = class extends think.Service {
|
|
|
440
440
|
|
|
441
441
|
const post = {
|
|
442
442
|
en_us: {
|
|
443
|
-
title: this.
|
|
443
|
+
title: this.controller.locale(title, data),
|
|
444
444
|
content: [
|
|
445
445
|
[
|
|
446
446
|
{
|
|
@@ -532,7 +532,7 @@ module.exports = class extends think.Service {
|
|
|
532
532
|
}
|
|
533
533
|
}
|
|
534
534
|
|
|
535
|
-
const disallowList = this.ctx.state.oauthServices.map(
|
|
535
|
+
const disallowList = this.controller.ctx.state.oauthServices.map(
|
|
536
536
|
({ name }) => 'mail.' + name,
|
|
537
537
|
);
|
|
538
538
|
const fakeMail = new RegExp(`@(${disallowList.join('|')})$`, 'i');
|