@waline/vercel 1.32.7 → 1.33.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 +5 -5
- package/src/controller/article.js +1 -1
- package/src/controller/oauth.js +19 -14
- package/src/controller/user.js +4 -1
- package/src/extend/think.js +2 -2
- package/src/locales/index.js +3 -0
- package/src/locales/it.json +19 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@waline/vercel",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.33.0",
|
|
4
4
|
"description": "vercel server for waline comment system",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"waline",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"dev": "node development.js 9090"
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@cloudbase/node-sdk": "^3.
|
|
21
|
+
"@cloudbase/node-sdk": "^3.14.1",
|
|
22
22
|
"@koa/cors": "^5.0.0",
|
|
23
23
|
"@mdit/plugin-katex": "0.23.4-cjs.0",
|
|
24
24
|
"@mdit/plugin-mathjax": "0.23.4-cjs.0",
|
|
@@ -26,18 +26,18 @@
|
|
|
26
26
|
"@mdit/plugin-sup": "0.22.5-cjs.0",
|
|
27
27
|
"akismet": "^2.0.7",
|
|
28
28
|
"deta": "^2.0.0",
|
|
29
|
-
"dompurify": "^3.
|
|
29
|
+
"dompurify": "^3.3.0",
|
|
30
30
|
"dy-node-ip2region": "^1.0.1",
|
|
31
31
|
"fast-csv": "^5.0.5",
|
|
32
32
|
"form-data": "^4.0.4",
|
|
33
|
-
"jsdom": "^
|
|
33
|
+
"jsdom": "^19.0.0",
|
|
34
34
|
"jsonwebtoken": "^9.0.2",
|
|
35
35
|
"koa-compose": "^4.1.0",
|
|
36
36
|
"leancloud-storage": "^4.15.2",
|
|
37
37
|
"markdown-it": "^14.1.0",
|
|
38
38
|
"markdown-it-emoji": "^3.0.0",
|
|
39
39
|
"mathjax-full": "^3.2.2",
|
|
40
|
-
"nodemailer": "^7.0.
|
|
40
|
+
"nodemailer": "^7.0.10",
|
|
41
41
|
"nunjucks": "^3.2.4",
|
|
42
42
|
"phpass": "^0.1.1",
|
|
43
43
|
"prismjs": "^1.30.0",
|
|
@@ -84,7 +84,7 @@ module.exports = class extends BaseRest {
|
|
|
84
84
|
{ access: { read: true, write: true } },
|
|
85
85
|
);
|
|
86
86
|
|
|
87
|
-
return this.jsonOrSuccess(deprecated ? count : [count]);
|
|
87
|
+
return this.jsonOrSuccess(deprecated ? count : [{ [type]: count }]);
|
|
88
88
|
}
|
|
89
89
|
|
|
90
90
|
const ret = await this.modelInstance.update(
|
package/src/controller/oauth.js
CHANGED
|
@@ -15,12 +15,17 @@ module.exports = class extends think.Controller {
|
|
|
15
15
|
|
|
16
16
|
if (!hasCode) {
|
|
17
17
|
const { serverURL } = this.ctx;
|
|
18
|
-
const redirectUrl = think.buildUrl(`${serverURL}/api/oauth`, {
|
|
18
|
+
const redirectUrl = think.buildUrl(`${serverURL}/api/oauth`, {
|
|
19
|
+
redirect,
|
|
20
|
+
type,
|
|
21
|
+
});
|
|
19
22
|
|
|
20
|
-
return this.redirect(
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
23
|
+
return this.redirect(
|
|
24
|
+
think.buildUrl(`${oauthUrl}/${type}`, {
|
|
25
|
+
redirect: redirectUrl,
|
|
26
|
+
state: this.ctx.state.token || '',
|
|
27
|
+
}),
|
|
28
|
+
);
|
|
24
29
|
}
|
|
25
30
|
|
|
26
31
|
/**
|
|
@@ -30,7 +35,10 @@ module.exports = class extends think.Controller {
|
|
|
30
35
|
|
|
31
36
|
if (type === 'facebook') {
|
|
32
37
|
const { serverURL } = this.ctx;
|
|
33
|
-
const redirectUrl = think.buildUrl(`${serverURL}/api/oauth`, {
|
|
38
|
+
const redirectUrl = think.buildUrl(`${serverURL}/api/oauth`, {
|
|
39
|
+
redirect,
|
|
40
|
+
type,
|
|
41
|
+
});
|
|
34
42
|
|
|
35
43
|
params.state = think.buildUrl(undefined, {
|
|
36
44
|
redirect: redirectUrl,
|
|
@@ -38,15 +46,12 @@ module.exports = class extends think.Controller {
|
|
|
38
46
|
});
|
|
39
47
|
}
|
|
40
48
|
|
|
41
|
-
const user = await fetch(
|
|
42
|
-
|
|
43
|
-
{
|
|
44
|
-
|
|
45
|
-
headers: {
|
|
46
|
-
'user-agent': '@waline',
|
|
47
|
-
},
|
|
49
|
+
const user = await fetch(think.buildUrl(`${oauthUrl}/${type}`, params), {
|
|
50
|
+
method: 'GET',
|
|
51
|
+
headers: {
|
|
52
|
+
'user-agent': '@waline',
|
|
48
53
|
},
|
|
49
|
-
).then((resp) => resp.json());
|
|
54
|
+
}).then((resp) => resp.json());
|
|
50
55
|
|
|
51
56
|
if (!user?.id) {
|
|
52
57
|
return this.fail(user);
|
package/src/controller/user.js
CHANGED
|
@@ -91,7 +91,10 @@ module.exports = class extends BaseRest {
|
|
|
91
91
|
|
|
92
92
|
try {
|
|
93
93
|
const notify = this.service('notify', this);
|
|
94
|
-
const apiUrl = think.buildUrl(this.ctx.serverURL + '/verification', {
|
|
94
|
+
const apiUrl = think.buildUrl(this.ctx.serverURL + '/verification', {
|
|
95
|
+
token,
|
|
96
|
+
email: data.email,
|
|
97
|
+
});
|
|
95
98
|
|
|
96
99
|
await notify.transporter.sendMail({
|
|
97
100
|
from:
|
package/src/extend/think.js
CHANGED
|
@@ -157,7 +157,7 @@ module.exports = {
|
|
|
157
157
|
buildUrl(path, query = {}) {
|
|
158
158
|
const notEmptyQuery = {};
|
|
159
159
|
|
|
160
|
-
for(const key in query) {
|
|
160
|
+
for (const key in query) {
|
|
161
161
|
if (!query[key]) {
|
|
162
162
|
continue;
|
|
163
163
|
}
|
|
@@ -176,5 +176,5 @@ module.exports = {
|
|
|
176
176
|
}
|
|
177
177
|
|
|
178
178
|
return destUrl;
|
|
179
|
-
}
|
|
179
|
+
},
|
|
180
180
|
};
|
package/src/locales/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
const en = require('./en.json');
|
|
2
|
+
const it = require('./it.json');
|
|
2
3
|
const zhCN = require('./zh-CN.json');
|
|
3
4
|
const zhTW = require('./zh-TW.json');
|
|
4
5
|
|
|
@@ -9,4 +10,6 @@ module.exports = {
|
|
|
9
10
|
'en-us': en,
|
|
10
11
|
jp: en,
|
|
11
12
|
'jp-jp': en,
|
|
13
|
+
it,
|
|
14
|
+
'it-it': it,
|
|
12
15
|
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"import data format not support!": "Formato dati di importazione non supportato",
|
|
3
|
+
"USER_EXIST": "L'utente esiste già",
|
|
4
|
+
"USER_NOT_EXIST": "L'utente non esiste",
|
|
5
|
+
"USER_REGISTERED": "L'utente si è registrato",
|
|
6
|
+
"TOKEN_EXPIRED": "Il token è scaduto",
|
|
7
|
+
"TWO_FACTOR_AUTH_ERROR_DETAIL": "Verifica in due passaggi non riuscita",
|
|
8
|
+
"[{{name | safe}}] Registration Confirm Mail": "[{{name | safe}}] Email di conferma registrazione",
|
|
9
|
+
"Please click <a href=\"{{url}}\">{{url}}<a/> to confirm registration, the link is valid for 1 hour. If you are not registering, please ignore this email.": "Clicca su <a href=\"{{url}}\">{{url}}<a/> per confermare la registrazione. Il link è valido per 1 ora. Se non sei stato tu a richiedere la registrazione, ignora questa email.",
|
|
10
|
+
"[{{name | safe}}] Reset Password": "[{{name | safe}}] Reimposta password",
|
|
11
|
+
"Please click <a href=\"{{url}}\">{{url}}</a> to login and change your password as soon as possible!": "Clicca su <a href=\"{{url}}\">{{url}}</a> per effettuare il login e cambiare la password il prima possibile.",
|
|
12
|
+
"Duplicate Content": "Contenuto duplicato",
|
|
13
|
+
"Comment too fast": "Stai commentando troppo velocemente",
|
|
14
|
+
"Registration confirm mail send failed, please {%- if isAdmin -%}check your mail configuration{%- else -%}check your email address and contact administrator{%- endif -%}.": "Impossibile inviare l'e-mail di conferma della registrazione. {%- if isAdmin -%}Controlla la configurazione della tua posta elettronica{%- else -%}Controlla il tuo indirizzo e-mail e contatta l'amministratore{%- endif -%}.",
|
|
15
|
+
"MAIL_SUBJECT": "Il tuo commento {{site.name | safe}} ha ricevuto una risposta",
|
|
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;'> Il tuo commento su <a style='text-decoration:none;color: #12ADDB;' href='{{site.url}}' target='_blank'>{{site.name}}</a> ha ricevuto una risposta </h2>{{parent.nick}}. Tu hai scritto: <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> ha risposto:</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'>Visualizza la risposta completa</a> oppure vai su <a style='text-decoration:none; color:#12addb' href='{{site.url}}' target='_blank'>{{site.name}}</a>.</p><br/> </div></div>",
|
|
17
|
+
"MAIL_SUBJECT_ADMIN": "Nuovo commento su {{site.name | safe}}",
|
|
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;'> Nuovo commento su <a style='text-decoration:none;color: #12ADDB;' href='{{site.url}}' target='_blank'>{{site.name}}</a> </h2> <p><strong>{{self.nick}}</strong> ha scritto:</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'>Vai alla pagina</a></p><br/></div>"
|
|
19
|
+
}
|