@waline/vercel 1.34.2 → 1.35.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/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 production
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 Asia/Shanghai
12
- ENV NODE_ENV production
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 production
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 Asia/Shanghai
12
- ENV NODE_ENV production
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@waline/vercel",
3
- "version": "1.34.2",
3
+ "version": "1.35.1",
4
4
  "description": "vercel server for waline comment system",
5
5
  "keywords": [
6
6
  "waline",
@@ -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 || (isVercelPostgres ? '5432' : '3211'),
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' || isVercelPostgres
121
+ (PG_SSL || POSTGRES_SSL) == 'true' ||
122
+ POSTGRES_URL?.includes('sslmode=require')
124
123
  ? {
125
124
  rejectUnauthorized: false,
126
125
  }
@@ -244,7 +244,7 @@ module.exports = class extends think.Service {
244
244
 
245
245
  return fetch(`${qmsgHost}/send/${QMSG_KEY}`, {
246
246
  method: 'POST',
247
- header: form.getHeaders(),
247
+ headers: form.getHeaders(),
248
248
  body: form,
249
249
  }).then((resp) => resp.json());
250
250
  }
@@ -288,7 +288,7 @@ module.exports = class extends think.Service {
288
288
  \`\`\`
289
289
  {{-self.commentLink}}
290
290
  *邮箱:*\`{{self.mail}}\`
291
- *审核:*{{self.status}}
291
+ *审核:*{{self.status}}
292
292
 
293
293
  仅供评论预览,点击[查看完整內容]({{site.postUrl}})`;
294
294
 
@@ -306,18 +306,18 @@ module.exports = class extends think.Service {
306
306
  },
307
307
  };
308
308
 
309
- const form = new FormData();
310
-
311
- form.append('text', this.controller.locale(contentTG, data));
312
- form.append('chat_id', TG_CHAT_ID);
313
- form.append('parse_mode', 'MarkdownV2');
314
-
315
309
  const resp = await fetch(
316
310
  `https://api.telegram.org/bot${TG_BOT_TOKEN}/sendMessage`,
317
311
  {
318
312
  method: 'POST',
319
- header: form.getHeaders(),
320
- body: form,
313
+ headers: {
314
+ 'Content-Type': 'application/json',
315
+ },
316
+ body: JSON.stringify({
317
+ chat_id: TG_CHAT_ID,
318
+ text: this.controller.locale(contentTG, data),
319
+ parse_mode: 'MarkdownV2',
320
+ }),
321
321
  },
322
322
  ).then((resp) => resp.json());
323
323
 
@@ -367,7 +367,7 @@ module.exports = class extends think.Service {
367
367
 
368
368
  return fetch(`http://www.pushplus.plus/send/${PUSH_PLUS_KEY}`, {
369
369
  method: 'POST',
370
- header: form.getHeaders(),
370
+ headers: form.getHeaders(),
371
371
  body: form,
372
372
  }).then((resp) => resp.json());
373
373
  }
@@ -406,7 +406,7 @@ module.exports = class extends think.Service {
406
406
 
407
407
  return fetch(DISCORD_WEBHOOK, {
408
408
  method: 'POST',
409
- header: form.getHeaders(),
409
+ headers: form.getHeaders(),
410
410
  body: form,
411
411
  }).then((resp) => resp.statusText);
412
412
  // Expected return value: No Content