@waline/vercel 1.27.0 → 1.27.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/dist/index.js +92 -91
- package/dist/package.json +1 -1
- package/dist/src/config/middleware.js +1 -0
- package/dist/src/controller/token/2fa.js +1 -0
- package/dist/src/controller/token.js +3 -2
- package/dist/src/controller/user/password.js +1 -0
- package/dist/src/controller/user.js +1 -0
- package/dist/src/extend/controller.js +1 -0
- package/dist/src/extend/think.js +2 -1
- package/dist/src/logic/base.js +2 -1
- package/dist/src/service/akismet.js +1 -0
- package/dist/src/service/avatar.js +1 -0
- package/dist/src/service/markdown/index.js +2 -1
- package/dist/src/service/markdown/katex.js +2 -1
- package/dist/src/service/markdown/mathjax.js +4 -4
- package/dist/src/service/notify.js +3 -2
- package/dist/src/service/storage/cloudbase.js +1 -0
- package/dist/src/service/storage/deta.js +3 -1
- package/dist/src/service/storage/github.js +3 -1
- package/dist/src/service/storage/leancloud.js +2 -0
- package/dist/src/service/storage/mongodb.js +1 -0
- package/package.json +1 -4
- package/src/config/middleware.js +7 -1
- package/src/controller/article.js +9 -7
- package/src/controller/comment.js +31 -29
- package/src/controller/oauth.js +2 -2
- package/src/extend/controller.js +3 -0
- package/src/logic/comment.js +7 -7
- package/src/logic/db.js +4 -4
- package/src/logic/oauth.js +1 -1
- package/src/logic/token.js +3 -3
- package/src/logic/user.js +4 -4
- package/src/middleware/dashboard.js +1 -0
- package/src/middleware/prefix-warning.js +19 -0
- package/deta.build.sh +0 -3
package/dist/index.js
CHANGED
|
@@ -8981,7 +8981,7 @@ function parseTokenList (str) {
|
|
|
8981
8981
|
"use strict";
|
|
8982
8982
|
|
|
8983
8983
|
|
|
8984
|
-
const fs = __nccwpck_require__(
|
|
8984
|
+
const fs = __nccwpck_require__(7763)
|
|
8985
8985
|
const path = __nccwpck_require__(1017)
|
|
8986
8986
|
const mkdirpSync = (__nccwpck_require__(586).mkdirsSync)
|
|
8987
8987
|
const utimesSync = (__nccwpck_require__(142).utimesMillisSync)
|
|
@@ -9166,7 +9166,7 @@ module.exports = {
|
|
|
9166
9166
|
"use strict";
|
|
9167
9167
|
|
|
9168
9168
|
|
|
9169
|
-
const fs = __nccwpck_require__(
|
|
9169
|
+
const fs = __nccwpck_require__(7763)
|
|
9170
9170
|
const path = __nccwpck_require__(1017)
|
|
9171
9171
|
const mkdirp = (__nccwpck_require__(586).mkdirs)
|
|
9172
9172
|
const pathExists = (__nccwpck_require__(9086).pathExists)
|
|
@@ -9401,7 +9401,7 @@ module.exports = {
|
|
|
9401
9401
|
|
|
9402
9402
|
|
|
9403
9403
|
const u = (__nccwpck_require__(2469)/* .fromCallback */ .E)
|
|
9404
|
-
const fs = __nccwpck_require__(
|
|
9404
|
+
const fs = __nccwpck_require__(7763)
|
|
9405
9405
|
const path = __nccwpck_require__(1017)
|
|
9406
9406
|
const mkdir = __nccwpck_require__(586)
|
|
9407
9407
|
const remove = __nccwpck_require__(9982)
|
|
@@ -9458,7 +9458,7 @@ module.exports = {
|
|
|
9458
9458
|
|
|
9459
9459
|
const u = (__nccwpck_require__(2469)/* .fromCallback */ .E)
|
|
9460
9460
|
const path = __nccwpck_require__(1017)
|
|
9461
|
-
const fs = __nccwpck_require__(
|
|
9461
|
+
const fs = __nccwpck_require__(7763)
|
|
9462
9462
|
const mkdir = __nccwpck_require__(586)
|
|
9463
9463
|
const pathExists = (__nccwpck_require__(9086).pathExists)
|
|
9464
9464
|
|
|
@@ -9546,7 +9546,7 @@ module.exports = {
|
|
|
9546
9546
|
|
|
9547
9547
|
const u = (__nccwpck_require__(2469)/* .fromCallback */ .E)
|
|
9548
9548
|
const path = __nccwpck_require__(1017)
|
|
9549
|
-
const fs = __nccwpck_require__(
|
|
9549
|
+
const fs = __nccwpck_require__(7763)
|
|
9550
9550
|
const mkdir = __nccwpck_require__(586)
|
|
9551
9551
|
const pathExists = (__nccwpck_require__(9086).pathExists)
|
|
9552
9552
|
|
|
@@ -9614,7 +9614,7 @@ module.exports = {
|
|
|
9614
9614
|
|
|
9615
9615
|
|
|
9616
9616
|
const path = __nccwpck_require__(1017)
|
|
9617
|
-
const fs = __nccwpck_require__(
|
|
9617
|
+
const fs = __nccwpck_require__(7763)
|
|
9618
9618
|
const pathExists = (__nccwpck_require__(9086).pathExists)
|
|
9619
9619
|
|
|
9620
9620
|
/**
|
|
@@ -9720,7 +9720,7 @@ module.exports = {
|
|
|
9720
9720
|
"use strict";
|
|
9721
9721
|
|
|
9722
9722
|
|
|
9723
|
-
const fs = __nccwpck_require__(
|
|
9723
|
+
const fs = __nccwpck_require__(7763)
|
|
9724
9724
|
|
|
9725
9725
|
function symlinkType (srcpath, type, callback) {
|
|
9726
9726
|
callback = (typeof type === 'function') ? type : callback
|
|
@@ -9761,7 +9761,7 @@ module.exports = {
|
|
|
9761
9761
|
|
|
9762
9762
|
const u = (__nccwpck_require__(2469)/* .fromCallback */ .E)
|
|
9763
9763
|
const path = __nccwpck_require__(1017)
|
|
9764
|
-
const fs = __nccwpck_require__(
|
|
9764
|
+
const fs = __nccwpck_require__(7763)
|
|
9765
9765
|
const _mkdirs = __nccwpck_require__(586)
|
|
9766
9766
|
const mkdirs = _mkdirs.mkdirs
|
|
9767
9767
|
const mkdirsSync = _mkdirs.mkdirsSync
|
|
@@ -9832,7 +9832,7 @@ module.exports = {
|
|
|
9832
9832
|
// This is adapted from https://github.com/normalize/mz
|
|
9833
9833
|
// Copyright (c) 2014-2016 Jonathan Ong me@jongleberry.com and Contributors
|
|
9834
9834
|
const u = (__nccwpck_require__(2469)/* .fromCallback */ .E)
|
|
9835
|
-
const fs = __nccwpck_require__(
|
|
9835
|
+
const fs = __nccwpck_require__(7763)
|
|
9836
9836
|
|
|
9837
9837
|
const api = [
|
|
9838
9838
|
'access',
|
|
@@ -10027,7 +10027,7 @@ module.exports = {
|
|
|
10027
10027
|
"use strict";
|
|
10028
10028
|
|
|
10029
10029
|
|
|
10030
|
-
const fs = __nccwpck_require__(
|
|
10030
|
+
const fs = __nccwpck_require__(7763)
|
|
10031
10031
|
const path = __nccwpck_require__(1017)
|
|
10032
10032
|
const mkdir = __nccwpck_require__(586)
|
|
10033
10033
|
const jsonFile = __nccwpck_require__(4747)
|
|
@@ -10110,7 +10110,7 @@ module.exports = {
|
|
|
10110
10110
|
"use strict";
|
|
10111
10111
|
|
|
10112
10112
|
|
|
10113
|
-
const fs = __nccwpck_require__(
|
|
10113
|
+
const fs = __nccwpck_require__(7763)
|
|
10114
10114
|
const path = __nccwpck_require__(1017)
|
|
10115
10115
|
const invalidWin32Path = (__nccwpck_require__(4830).invalidWin32Path)
|
|
10116
10116
|
|
|
@@ -10172,7 +10172,7 @@ module.exports = mkdirsSync
|
|
|
10172
10172
|
"use strict";
|
|
10173
10173
|
|
|
10174
10174
|
|
|
10175
|
-
const fs = __nccwpck_require__(
|
|
10175
|
+
const fs = __nccwpck_require__(7763)
|
|
10176
10176
|
const path = __nccwpck_require__(1017)
|
|
10177
10177
|
const invalidWin32Path = (__nccwpck_require__(4830).invalidWin32Path)
|
|
10178
10178
|
|
|
@@ -10289,7 +10289,7 @@ module.exports = {
|
|
|
10289
10289
|
"use strict";
|
|
10290
10290
|
|
|
10291
10291
|
|
|
10292
|
-
const fs = __nccwpck_require__(
|
|
10292
|
+
const fs = __nccwpck_require__(7763)
|
|
10293
10293
|
const path = __nccwpck_require__(1017)
|
|
10294
10294
|
const copySync = (__nccwpck_require__(6785).copySync)
|
|
10295
10295
|
const removeSync = (__nccwpck_require__(9982).removeSync)
|
|
@@ -10358,7 +10358,7 @@ module.exports = {
|
|
|
10358
10358
|
"use strict";
|
|
10359
10359
|
|
|
10360
10360
|
|
|
10361
|
-
const fs = __nccwpck_require__(
|
|
10361
|
+
const fs = __nccwpck_require__(7763)
|
|
10362
10362
|
const path = __nccwpck_require__(1017)
|
|
10363
10363
|
const copy = (__nccwpck_require__(7154).copy)
|
|
10364
10364
|
const remove = (__nccwpck_require__(9982).remove)
|
|
@@ -10432,7 +10432,7 @@ module.exports = move
|
|
|
10432
10432
|
|
|
10433
10433
|
|
|
10434
10434
|
const u = (__nccwpck_require__(2469)/* .fromCallback */ .E)
|
|
10435
|
-
const fs = __nccwpck_require__(
|
|
10435
|
+
const fs = __nccwpck_require__(7763)
|
|
10436
10436
|
const path = __nccwpck_require__(1017)
|
|
10437
10437
|
const mkdir = __nccwpck_require__(586)
|
|
10438
10438
|
const pathExists = (__nccwpck_require__(9086).pathExists)
|
|
@@ -10516,7 +10516,7 @@ module.exports = {
|
|
|
10516
10516
|
"use strict";
|
|
10517
10517
|
|
|
10518
10518
|
|
|
10519
|
-
const fs = __nccwpck_require__(
|
|
10519
|
+
const fs = __nccwpck_require__(7763)
|
|
10520
10520
|
const path = __nccwpck_require__(1017)
|
|
10521
10521
|
const assert = __nccwpck_require__(9491)
|
|
10522
10522
|
|
|
@@ -10858,7 +10858,7 @@ module.exports = function (size) {
|
|
|
10858
10858
|
"use strict";
|
|
10859
10859
|
|
|
10860
10860
|
|
|
10861
|
-
const fs = __nccwpck_require__(
|
|
10861
|
+
const fs = __nccwpck_require__(7763)
|
|
10862
10862
|
const path = __nccwpck_require__(1017)
|
|
10863
10863
|
|
|
10864
10864
|
const NODE_VERSION_MAJOR_WITH_BIGINT = 10
|
|
@@ -11038,7 +11038,7 @@ module.exports = {
|
|
|
11038
11038
|
"use strict";
|
|
11039
11039
|
|
|
11040
11040
|
|
|
11041
|
-
const fs = __nccwpck_require__(
|
|
11041
|
+
const fs = __nccwpck_require__(7763)
|
|
11042
11042
|
const os = __nccwpck_require__(2037)
|
|
11043
11043
|
const path = __nccwpck_require__(1017)
|
|
11044
11044
|
|
|
@@ -11544,7 +11544,7 @@ module.exports = function GetIntrinsic(name, allowMissing) {
|
|
|
11544
11544
|
|
|
11545
11545
|
/***/ }),
|
|
11546
11546
|
|
|
11547
|
-
/***/
|
|
11547
|
+
/***/ 481:
|
|
11548
11548
|
/***/ ((module) => {
|
|
11549
11549
|
|
|
11550
11550
|
"use strict";
|
|
@@ -11575,13 +11575,13 @@ function clone (obj) {
|
|
|
11575
11575
|
|
|
11576
11576
|
/***/ }),
|
|
11577
11577
|
|
|
11578
|
-
/***/
|
|
11578
|
+
/***/ 7763:
|
|
11579
11579
|
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
11580
11580
|
|
|
11581
11581
|
var fs = __nccwpck_require__(7147)
|
|
11582
|
-
var polyfills = __nccwpck_require__(
|
|
11583
|
-
var legacy = __nccwpck_require__(
|
|
11584
|
-
var clone = __nccwpck_require__(
|
|
11582
|
+
var polyfills = __nccwpck_require__(2850)
|
|
11583
|
+
var legacy = __nccwpck_require__(2606)
|
|
11584
|
+
var clone = __nccwpck_require__(481)
|
|
11585
11585
|
|
|
11586
11586
|
var util = __nccwpck_require__(3837)
|
|
11587
11587
|
|
|
@@ -12030,7 +12030,7 @@ function retry () {
|
|
|
12030
12030
|
|
|
12031
12031
|
/***/ }),
|
|
12032
12032
|
|
|
12033
|
-
/***/
|
|
12033
|
+
/***/ 2606:
|
|
12034
12034
|
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
12035
12035
|
|
|
12036
12036
|
var Stream = (__nccwpck_require__(2781).Stream)
|
|
@@ -12155,7 +12155,7 @@ function legacy (fs) {
|
|
|
12155
12155
|
|
|
12156
12156
|
/***/ }),
|
|
12157
12157
|
|
|
12158
|
-
/***/
|
|
12158
|
+
/***/ 2850:
|
|
12159
12159
|
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
12160
12160
|
|
|
12161
12161
|
var constants = __nccwpck_require__(2057)
|
|
@@ -12261,7 +12261,7 @@ function patch (fs) {
|
|
|
12261
12261
|
var backoff = 0;
|
|
12262
12262
|
fs$rename(from, to, function CB (er) {
|
|
12263
12263
|
if (er
|
|
12264
|
-
&& (er.code === "EACCES" || er.code === "EPERM")
|
|
12264
|
+
&& (er.code === "EACCES" || er.code === "EPERM" || er.code === "EBUSY")
|
|
12265
12265
|
&& Date.now() - start < 60000) {
|
|
12266
12266
|
setTimeout(function() {
|
|
12267
12267
|
fs.stat(to, function (stater, st) {
|
|
@@ -16622,7 +16622,7 @@ module.exports = Array.isArray || function (arr) {
|
|
|
16622
16622
|
|
|
16623
16623
|
var _fs
|
|
16624
16624
|
try {
|
|
16625
|
-
_fs = __nccwpck_require__(
|
|
16625
|
+
_fs = __nccwpck_require__(7763)
|
|
16626
16626
|
} catch (_) {
|
|
16627
16627
|
_fs = __nccwpck_require__(7147)
|
|
16628
16628
|
}
|
|
@@ -21050,14 +21050,14 @@ module.exports = merge;
|
|
|
21050
21050
|
|
|
21051
21051
|
/***/ }),
|
|
21052
21052
|
|
|
21053
|
-
/***/
|
|
21053
|
+
/***/ 5037:
|
|
21054
21054
|
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
21055
21055
|
|
|
21056
21056
|
/* eslint max-classes-per-file: ["error", 2] */
|
|
21057
21057
|
/* eslint no-underscore-dangle: ["error", { "allow": ["_getLocationKeys"] }] */
|
|
21058
21058
|
|
|
21059
21059
|
const flatted = __nccwpck_require__(8522);
|
|
21060
|
-
const levels = __nccwpck_require__(
|
|
21060
|
+
const levels = __nccwpck_require__(5634);
|
|
21061
21061
|
|
|
21062
21062
|
class SerDe {
|
|
21063
21063
|
constructor() {
|
|
@@ -21214,7 +21214,7 @@ module.exports = LoggingEvent;
|
|
|
21214
21214
|
|
|
21215
21215
|
/***/ }),
|
|
21216
21216
|
|
|
21217
|
-
/***/
|
|
21217
|
+
/***/ 5717:
|
|
21218
21218
|
/***/ ((module) => {
|
|
21219
21219
|
|
|
21220
21220
|
function maxFileSizeUnitTransform(maxLogSize) {
|
|
@@ -21267,7 +21267,7 @@ module.exports.modifyConfig = (config) =>
|
|
|
21267
21267
|
|
|
21268
21268
|
/***/ }),
|
|
21269
21269
|
|
|
21270
|
-
/***/
|
|
21270
|
+
/***/ 6894:
|
|
21271
21271
|
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
21272
21272
|
|
|
21273
21273
|
const debug = __nccwpck_require__(5299)('log4js:categoryFilter');
|
|
@@ -21293,7 +21293,7 @@ module.exports.configure = configure;
|
|
|
21293
21293
|
|
|
21294
21294
|
/***/ }),
|
|
21295
21295
|
|
|
21296
|
-
/***/
|
|
21296
|
+
/***/ 1428:
|
|
21297
21297
|
/***/ ((module) => {
|
|
21298
21298
|
|
|
21299
21299
|
// eslint-disable-next-line no-console
|
|
@@ -21318,7 +21318,7 @@ module.exports.configure = configure;
|
|
|
21318
21318
|
|
|
21319
21319
|
/***/ }),
|
|
21320
21320
|
|
|
21321
|
-
/***/
|
|
21321
|
+
/***/ 9575:
|
|
21322
21322
|
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
21323
21323
|
|
|
21324
21324
|
const streams = __nccwpck_require__(5709);
|
|
@@ -21401,7 +21401,7 @@ module.exports.configure = configure;
|
|
|
21401
21401
|
|
|
21402
21402
|
/***/ }),
|
|
21403
21403
|
|
|
21404
|
-
/***/
|
|
21404
|
+
/***/ 3668:
|
|
21405
21405
|
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
21406
21406
|
|
|
21407
21407
|
const debug = __nccwpck_require__(5299)('log4js:file');
|
|
@@ -21562,7 +21562,7 @@ module.exports.configure = configure;
|
|
|
21562
21562
|
|
|
21563
21563
|
/***/ }),
|
|
21564
21564
|
|
|
21565
|
-
/***/
|
|
21565
|
+
/***/ 5564:
|
|
21566
21566
|
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
21567
21567
|
|
|
21568
21568
|
const debug = __nccwpck_require__(5299)('log4js:fileSync');
|
|
@@ -21827,29 +21827,29 @@ module.exports.configure = configure;
|
|
|
21827
21827
|
|
|
21828
21828
|
/***/ }),
|
|
21829
21829
|
|
|
21830
|
-
/***/
|
|
21830
|
+
/***/ 5921:
|
|
21831
21831
|
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
21832
21832
|
|
|
21833
21833
|
const path = __nccwpck_require__(1017);
|
|
21834
21834
|
const debug = __nccwpck_require__(5299)('log4js:appenders');
|
|
21835
|
-
const configuration = __nccwpck_require__(
|
|
21836
|
-
const clustering = __nccwpck_require__(
|
|
21837
|
-
const levels = __nccwpck_require__(
|
|
21838
|
-
const layouts = __nccwpck_require__(
|
|
21839
|
-
const adapters = __nccwpck_require__(
|
|
21835
|
+
const configuration = __nccwpck_require__(2990);
|
|
21836
|
+
const clustering = __nccwpck_require__(8027);
|
|
21837
|
+
const levels = __nccwpck_require__(5634);
|
|
21838
|
+
const layouts = __nccwpck_require__(8695);
|
|
21839
|
+
const adapters = __nccwpck_require__(5717);
|
|
21840
21840
|
|
|
21841
21841
|
// pre-load the core appenders so that webpack can find them
|
|
21842
21842
|
const coreAppenders = new Map();
|
|
21843
|
-
coreAppenders.set('console', __nccwpck_require__(
|
|
21844
|
-
coreAppenders.set('stdout', __nccwpck_require__(
|
|
21845
|
-
coreAppenders.set('stderr', __nccwpck_require__(
|
|
21846
|
-
coreAppenders.set('logLevelFilter', __nccwpck_require__(
|
|
21847
|
-
coreAppenders.set('categoryFilter', __nccwpck_require__(
|
|
21848
|
-
coreAppenders.set('noLogFilter', __nccwpck_require__(
|
|
21849
|
-
coreAppenders.set('file', __nccwpck_require__(
|
|
21850
|
-
coreAppenders.set('dateFile', __nccwpck_require__(
|
|
21851
|
-
coreAppenders.set('fileSync', __nccwpck_require__(
|
|
21852
|
-
coreAppenders.set('tcp', __nccwpck_require__(
|
|
21843
|
+
coreAppenders.set('console', __nccwpck_require__(1428));
|
|
21844
|
+
coreAppenders.set('stdout', __nccwpck_require__(6285));
|
|
21845
|
+
coreAppenders.set('stderr', __nccwpck_require__(8978));
|
|
21846
|
+
coreAppenders.set('logLevelFilter', __nccwpck_require__(7464));
|
|
21847
|
+
coreAppenders.set('categoryFilter', __nccwpck_require__(6894));
|
|
21848
|
+
coreAppenders.set('noLogFilter', __nccwpck_require__(3181));
|
|
21849
|
+
coreAppenders.set('file', __nccwpck_require__(3668));
|
|
21850
|
+
coreAppenders.set('dateFile', __nccwpck_require__(9575));
|
|
21851
|
+
coreAppenders.set('fileSync', __nccwpck_require__(5564));
|
|
21852
|
+
coreAppenders.set('tcp', __nccwpck_require__(3040));
|
|
21853
21853
|
|
|
21854
21854
|
const appenders = new Map();
|
|
21855
21855
|
|
|
@@ -22016,7 +22016,7 @@ module.exports.init = init;
|
|
|
22016
22016
|
|
|
22017
22017
|
/***/ }),
|
|
22018
22018
|
|
|
22019
|
-
/***/
|
|
22019
|
+
/***/ 7464:
|
|
22020
22020
|
/***/ ((module) => {
|
|
22021
22021
|
|
|
22022
22022
|
function logLevelFilter(minLevelString, maxLevelString, appender, levels) {
|
|
@@ -22043,7 +22043,7 @@ module.exports.configure = configure;
|
|
|
22043
22043
|
|
|
22044
22044
|
/***/ }),
|
|
22045
22045
|
|
|
22046
|
-
/***/
|
|
22046
|
+
/***/ 3181:
|
|
22047
22047
|
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
22048
22048
|
|
|
22049
22049
|
const debug = __nccwpck_require__(5299)('log4js:noLogFilter');
|
|
@@ -22093,7 +22093,7 @@ module.exports.configure = configure;
|
|
|
22093
22093
|
|
|
22094
22094
|
/***/ }),
|
|
22095
22095
|
|
|
22096
|
-
/***/
|
|
22096
|
+
/***/ 9668:
|
|
22097
22097
|
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
22098
22098
|
|
|
22099
22099
|
const debug = __nccwpck_require__(5299)('log4js:recording');
|
|
@@ -22129,7 +22129,7 @@ module.exports = {
|
|
|
22129
22129
|
|
|
22130
22130
|
/***/ }),
|
|
22131
22131
|
|
|
22132
|
-
/***/
|
|
22132
|
+
/***/ 8978:
|
|
22133
22133
|
/***/ ((module) => {
|
|
22134
22134
|
|
|
22135
22135
|
function stderrAppender(layout, timezoneOffset) {
|
|
@@ -22151,7 +22151,7 @@ module.exports.configure = configure;
|
|
|
22151
22151
|
|
|
22152
22152
|
/***/ }),
|
|
22153
22153
|
|
|
22154
|
-
/***/
|
|
22154
|
+
/***/ 6285:
|
|
22155
22155
|
/***/ ((__unused_webpack_module, exports) => {
|
|
22156
22156
|
|
|
22157
22157
|
function stdoutAppender(layout, timezoneOffset) {
|
|
@@ -22173,7 +22173,7 @@ exports.configure = configure;
|
|
|
22173
22173
|
|
|
22174
22174
|
/***/ }),
|
|
22175
22175
|
|
|
22176
|
-
/***/
|
|
22176
|
+
/***/ 3040:
|
|
22177
22177
|
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
22178
22178
|
|
|
22179
22179
|
const debug = __nccwpck_require__(5299)('log4js:tcp');
|
|
@@ -22272,13 +22272,13 @@ module.exports.configure = configure;
|
|
|
22272
22272
|
|
|
22273
22273
|
/***/ }),
|
|
22274
22274
|
|
|
22275
|
-
/***/
|
|
22275
|
+
/***/ 5228:
|
|
22276
22276
|
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
22277
22277
|
|
|
22278
22278
|
const debug = __nccwpck_require__(5299)('log4js:categories');
|
|
22279
|
-
const configuration = __nccwpck_require__(
|
|
22280
|
-
const levels = __nccwpck_require__(
|
|
22281
|
-
const appenders = __nccwpck_require__(
|
|
22279
|
+
const configuration = __nccwpck_require__(2990);
|
|
22280
|
+
const levels = __nccwpck_require__(5634);
|
|
22281
|
+
const appenders = __nccwpck_require__(5921);
|
|
22282
22282
|
|
|
22283
22283
|
const categories = new Map();
|
|
22284
22284
|
|
|
@@ -22498,12 +22498,12 @@ module.exports = Object.assign(module.exports, {
|
|
|
22498
22498
|
|
|
22499
22499
|
/***/ }),
|
|
22500
22500
|
|
|
22501
|
-
/***/
|
|
22501
|
+
/***/ 8027:
|
|
22502
22502
|
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
22503
22503
|
|
|
22504
22504
|
const debug = __nccwpck_require__(5299)('log4js:clustering');
|
|
22505
|
-
const LoggingEvent = __nccwpck_require__(
|
|
22506
|
-
const configuration = __nccwpck_require__(
|
|
22505
|
+
const LoggingEvent = __nccwpck_require__(5037);
|
|
22506
|
+
const configuration = __nccwpck_require__(2990);
|
|
22507
22507
|
|
|
22508
22508
|
let disabled = false;
|
|
22509
22509
|
let cluster = null;
|
|
@@ -22610,7 +22610,7 @@ module.exports = {
|
|
|
22610
22610
|
|
|
22611
22611
|
/***/ }),
|
|
22612
22612
|
|
|
22613
|
-
/***/
|
|
22613
|
+
/***/ 2990:
|
|
22614
22614
|
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
22615
22615
|
|
|
22616
22616
|
const util = __nccwpck_require__(3837);
|
|
@@ -22681,12 +22681,12 @@ module.exports = {
|
|
|
22681
22681
|
|
|
22682
22682
|
/***/ }),
|
|
22683
22683
|
|
|
22684
|
-
/***/
|
|
22684
|
+
/***/ 2009:
|
|
22685
22685
|
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
22686
22686
|
|
|
22687
22687
|
/* eslint no-underscore-dangle: ["error", { "allow": ["__statusCode", "_remoteAddress", "__headers", "_logging"] }] */
|
|
22688
22688
|
|
|
22689
|
-
const levels = __nccwpck_require__(
|
|
22689
|
+
const levels = __nccwpck_require__(5634);
|
|
22690
22690
|
|
|
22691
22691
|
const DEFAULT_FORMAT =
|
|
22692
22692
|
':remote-addr - -' +
|
|
@@ -23011,7 +23011,7 @@ module.exports = function getLogger(logger4js, options) {
|
|
|
23011
23011
|
|
|
23012
23012
|
/***/ }),
|
|
23013
23013
|
|
|
23014
|
-
/***/
|
|
23014
|
+
/***/ 8695:
|
|
23015
23015
|
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
23016
23016
|
|
|
23017
23017
|
const dateFormat = __nccwpck_require__(2149);
|
|
@@ -23504,10 +23504,10 @@ module.exports = {
|
|
|
23504
23504
|
|
|
23505
23505
|
/***/ }),
|
|
23506
23506
|
|
|
23507
|
-
/***/
|
|
23507
|
+
/***/ 5634:
|
|
23508
23508
|
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
23509
23509
|
|
|
23510
|
-
const configuration = __nccwpck_require__(
|
|
23510
|
+
const configuration = __nccwpck_require__(2990);
|
|
23511
23511
|
|
|
23512
23512
|
const validColours = [
|
|
23513
23513
|
'white',
|
|
@@ -23666,7 +23666,7 @@ module.exports = Level;
|
|
|
23666
23666
|
|
|
23667
23667
|
/***/ }),
|
|
23668
23668
|
|
|
23669
|
-
/***/
|
|
23669
|
+
/***/ 9569:
|
|
23670
23670
|
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
23671
23671
|
|
|
23672
23672
|
/**
|
|
@@ -23692,15 +23692,15 @@ module.exports = Level;
|
|
|
23692
23692
|
const debug = __nccwpck_require__(5299)('log4js:main');
|
|
23693
23693
|
const fs = __nccwpck_require__(7147);
|
|
23694
23694
|
const deepClone = __nccwpck_require__(6121)({ proto: true });
|
|
23695
|
-
const configuration = __nccwpck_require__(
|
|
23696
|
-
const layouts = __nccwpck_require__(
|
|
23697
|
-
const levels = __nccwpck_require__(
|
|
23698
|
-
const appenders = __nccwpck_require__(
|
|
23699
|
-
const categories = __nccwpck_require__(
|
|
23700
|
-
const Logger = __nccwpck_require__(
|
|
23701
|
-
const clustering = __nccwpck_require__(
|
|
23702
|
-
const connectLogger = __nccwpck_require__(
|
|
23703
|
-
const recordingModule = __nccwpck_require__(
|
|
23695
|
+
const configuration = __nccwpck_require__(2990);
|
|
23696
|
+
const layouts = __nccwpck_require__(8695);
|
|
23697
|
+
const levels = __nccwpck_require__(5634);
|
|
23698
|
+
const appenders = __nccwpck_require__(5921);
|
|
23699
|
+
const categories = __nccwpck_require__(5228);
|
|
23700
|
+
const Logger = __nccwpck_require__(5291);
|
|
23701
|
+
const clustering = __nccwpck_require__(8027);
|
|
23702
|
+
const connectLogger = __nccwpck_require__(2009);
|
|
23703
|
+
const recordingModule = __nccwpck_require__(9668);
|
|
23704
23704
|
|
|
23705
23705
|
let enabled = false;
|
|
23706
23706
|
|
|
@@ -23859,19 +23859,19 @@ module.exports = log4js;
|
|
|
23859
23859
|
|
|
23860
23860
|
/***/ }),
|
|
23861
23861
|
|
|
23862
|
-
/***/
|
|
23862
|
+
/***/ 5291:
|
|
23863
23863
|
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
23864
23864
|
|
|
23865
23865
|
/* eslint no-underscore-dangle: ["error", { "allow": ["_log"] }] */
|
|
23866
23866
|
|
|
23867
23867
|
const debug = __nccwpck_require__(5299)('log4js:logger');
|
|
23868
|
-
const LoggingEvent = __nccwpck_require__(
|
|
23869
|
-
const levels = __nccwpck_require__(
|
|
23870
|
-
const clustering = __nccwpck_require__(
|
|
23871
|
-
const categories = __nccwpck_require__(
|
|
23872
|
-
const configuration = __nccwpck_require__(
|
|
23868
|
+
const LoggingEvent = __nccwpck_require__(5037);
|
|
23869
|
+
const levels = __nccwpck_require__(5634);
|
|
23870
|
+
const clustering = __nccwpck_require__(8027);
|
|
23871
|
+
const categories = __nccwpck_require__(5228);
|
|
23872
|
+
const configuration = __nccwpck_require__(2990);
|
|
23873
23873
|
|
|
23874
|
-
const stackReg = /^(?:\s*)
|
|
23874
|
+
const stackReg = /^(?:\s*)at (?:(.+) \()?(?:([^(]+?):(\d+):(\d+))\)?$/;
|
|
23875
23875
|
/**
|
|
23876
23876
|
* The top entry is the Error
|
|
23877
23877
|
*/
|
|
@@ -31778,7 +31778,7 @@ function plural(ms, msAbs, n, name) {
|
|
|
31778
31778
|
var Promise = __nccwpck_require__(8573)
|
|
31779
31779
|
var fs
|
|
31780
31780
|
try {
|
|
31781
|
-
fs = __nccwpck_require__(
|
|
31781
|
+
fs = __nccwpck_require__(7763)
|
|
31782
31782
|
} catch(err) {
|
|
31783
31783
|
fs = __nccwpck_require__(7147)
|
|
31784
31784
|
}
|
|
@@ -44433,7 +44433,7 @@ module.exports = function load(appPath, modules) {
|
|
|
44433
44433
|
/***/ 8840:
|
|
44434
44434
|
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
44435
44435
|
|
|
44436
|
-
const log4js = __nccwpck_require__(
|
|
44436
|
+
const log4js = __nccwpck_require__(9569);
|
|
44437
44437
|
const _logger = Symbol('_logger');
|
|
44438
44438
|
|
|
44439
44439
|
module.exports = class {
|
|
@@ -49564,7 +49564,7 @@ var _isPort = __nccwpck_require__(6194);
|
|
|
49564
49564
|
|
|
49565
49565
|
var _isPort2 = _interopRequireDefault(_isPort);
|
|
49566
49566
|
|
|
49567
|
-
var _isLowercase = __nccwpck_require__(
|
|
49567
|
+
var _isLowercase = __nccwpck_require__(4927);
|
|
49568
49568
|
|
|
49569
49569
|
var _isLowercase2 = _interopRequireDefault(_isLowercase);
|
|
49570
49570
|
|
|
@@ -51509,7 +51509,7 @@ module.exports = exports['default'];
|
|
|
51509
51509
|
|
|
51510
51510
|
/***/ }),
|
|
51511
51511
|
|
|
51512
|
-
/***/
|
|
51512
|
+
/***/ 4927:
|
|
51513
51513
|
/***/ ((module, exports, __nccwpck_require__) => {
|
|
51514
51514
|
|
|
51515
51515
|
"use strict";
|
|
@@ -58037,6 +58037,7 @@ module.exports = LRU;
|
|
|
58037
58037
|
|
|
58038
58038
|
const os = __nccwpck_require__(2037);
|
|
58039
58039
|
const path = __nccwpck_require__(1017);
|
|
58040
|
+
|
|
58040
58041
|
const Application = __nccwpck_require__(9409);
|
|
58041
58042
|
const Loader = __nccwpck_require__(2209);
|
|
58042
58043
|
|
package/dist/package.json
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
const speakeasy = require('speakeasy');
|
|
2
1
|
const jwt = require('jsonwebtoken');
|
|
3
|
-
const helper = require('think-helper');
|
|
4
2
|
const { PasswordHash } = require('phpass');
|
|
3
|
+
const speakeasy = require('speakeasy');
|
|
4
|
+
const helper = require('think-helper');
|
|
5
|
+
|
|
5
6
|
const BaseRest = require('./rest');
|
|
6
7
|
|
|
7
8
|
module.exports = class extends BaseRest {
|
package/dist/src/extend/think.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
const parser = require('ua-parser-js');
|
|
2
1
|
const ip2region = require('dy-node-ip2region');
|
|
3
2
|
const helper = require('think-helper');
|
|
3
|
+
const parser = require('ua-parser-js');
|
|
4
|
+
|
|
4
5
|
const preventMessage = 'PREVENT_NEXT_PROCESS';
|
|
5
6
|
|
|
6
7
|
const regionSearch = ip2region.create(process.env.IP2REGION_DB);
|
package/dist/src/logic/base.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
const path = require('path');
|
|
2
2
|
const qs = require('querystring');
|
|
3
|
-
|
|
3
|
+
|
|
4
4
|
const jwt = require('jsonwebtoken');
|
|
5
|
+
const fetch = require('node-fetch');
|
|
5
6
|
const helper = require('think-helper');
|
|
6
7
|
|
|
7
8
|
module.exports = class extends think.Logic {
|
|
@@ -2,9 +2,10 @@ const MarkdownIt = require('markdown-it');
|
|
|
2
2
|
const emojiPlugin = require('markdown-it-emoji');
|
|
3
3
|
const subPlugin = require('markdown-it-sub');
|
|
4
4
|
const supPlugin = require('markdown-it-sup');
|
|
5
|
+
|
|
6
|
+
const { resolveHighlighter } = require('./highlight');
|
|
5
7
|
const { katexPlugin } = require('./katex');
|
|
6
8
|
const { mathjaxPlugin } = require('./mathjax');
|
|
7
|
-
const { resolveHighlighter } = require('./highlight');
|
|
8
9
|
const { sanitize } = require('./xss');
|
|
9
10
|
|
|
10
11
|
const getMarkdownParser = () => {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
const katex = require('katex');
|
|
2
|
-
|
|
2
|
+
|
|
3
3
|
const { inlineTex, blockTex } = require('./mathCommon');
|
|
4
|
+
const { escapeHtml } = require('./utils');
|
|
4
5
|
|
|
5
6
|
// set KaTeX as the renderer for markdown-it-simplemath
|
|
6
7
|
const katexInline = (tex, options) => {
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
const { mathjax } = require('mathjax-full/js/mathjax');
|
|
2
|
-
const { TeX } = require('mathjax-full/js/input/tex.js');
|
|
3
|
-
const { SVG } = require('mathjax-full/js/output/svg.js');
|
|
4
1
|
const { liteAdaptor } = require('mathjax-full/js/adaptors/liteAdaptor.js');
|
|
5
2
|
const { RegisterHTMLHandler } = require('mathjax-full/js/handlers/html.js');
|
|
6
3
|
const { AllPackages } = require('mathjax-full/js/input/tex/AllPackages.js');
|
|
4
|
+
const { TeX } = require('mathjax-full/js/input/tex.js');
|
|
5
|
+
const { mathjax } = require('mathjax-full/js/mathjax');
|
|
6
|
+
const { SVG } = require('mathjax-full/js/output/svg.js');
|
|
7
7
|
|
|
8
|
-
const { escapeHtml } = require('./utils');
|
|
9
8
|
const { inlineTex, blockTex } = require('./mathCommon');
|
|
9
|
+
const { escapeHtml } = require('./utils');
|
|
10
10
|
|
|
11
11
|
// set MathJax as the renderer
|
|
12
12
|
class MathToSvg {
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
const crypto = require('crypto');
|
|
2
|
+
|
|
1
3
|
const FormData = require('form-data');
|
|
2
|
-
const nodemailer = require('nodemailer');
|
|
3
4
|
const fetch = require('node-fetch');
|
|
5
|
+
const nodemailer = require('nodemailer');
|
|
4
6
|
const nunjucks = require('nunjucks');
|
|
5
|
-
const crypto = require('crypto');
|
|
6
7
|
|
|
7
8
|
module.exports = class extends think.Service {
|
|
8
9
|
constructor(ctx) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@waline/vercel",
|
|
3
|
-
"version": "1.27.
|
|
3
|
+
"version": "1.27.1",
|
|
4
4
|
"description": "vercel server for waline comment system",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"waline",
|
|
@@ -8,9 +8,6 @@
|
|
|
8
8
|
"comment",
|
|
9
9
|
"blog"
|
|
10
10
|
],
|
|
11
|
-
"scripts": {
|
|
12
|
-
"postpublish": "sh ./deta.build.sh"
|
|
13
|
-
},
|
|
14
11
|
"repository": {
|
|
15
12
|
"url": "https://github.com/walinejs/waline",
|
|
16
13
|
"directory": "packages/server"
|
package/src/config/middleware.js
CHANGED
|
@@ -13,6 +13,10 @@ module.exports = [
|
|
|
13
13
|
match: /^\/ui/,
|
|
14
14
|
},
|
|
15
15
|
|
|
16
|
+
{
|
|
17
|
+
handle: 'prefix-warning',
|
|
18
|
+
},
|
|
19
|
+
|
|
16
20
|
{
|
|
17
21
|
handle: 'meta',
|
|
18
22
|
options: {
|
|
@@ -57,7 +61,9 @@ module.exports = [
|
|
|
57
61
|
|
|
58
62
|
{
|
|
59
63
|
handle: 'router',
|
|
60
|
-
options: {
|
|
64
|
+
options: {
|
|
65
|
+
prefix: ['/api']
|
|
66
|
+
},
|
|
61
67
|
},
|
|
62
68
|
|
|
63
69
|
{ handle: routerREST },
|
|
@@ -11,10 +11,11 @@ module.exports = class extends BaseRest {
|
|
|
11
11
|
|
|
12
12
|
async getAction() {
|
|
13
13
|
const { path, type } = this.get();
|
|
14
|
+
const { deprecated } = this.ctx.state;
|
|
14
15
|
|
|
15
16
|
// path is required
|
|
16
17
|
if (!Array.isArray(path) || !path.length) {
|
|
17
|
-
return this.
|
|
18
|
+
return this.jsonOrSuccess(0);
|
|
18
19
|
}
|
|
19
20
|
|
|
20
21
|
const resp = await this.modelInstance.select({ url: ['IN', path] });
|
|
@@ -26,7 +27,7 @@ module.exports = class extends BaseRest {
|
|
|
26
27
|
return o;
|
|
27
28
|
}, {});
|
|
28
29
|
|
|
29
|
-
return this.
|
|
30
|
+
return this.jsonOrSuccess((type.length === 1 && deprecated) ? data[type[0]] : data);
|
|
30
31
|
}
|
|
31
32
|
|
|
32
33
|
const respObj = resp.reduce((o, n) => {
|
|
@@ -48,22 +49,23 @@ module.exports = class extends BaseRest {
|
|
|
48
49
|
respObj[url] && respObj[url][field] ? respObj[url][field] : 0;
|
|
49
50
|
}
|
|
50
51
|
|
|
51
|
-
if (type.length === 1) {
|
|
52
|
+
if (type.length === 1 && deprecated) {
|
|
52
53
|
counters = counters[type[0]];
|
|
53
54
|
}
|
|
54
55
|
data.push(counters);
|
|
55
56
|
}
|
|
56
57
|
|
|
57
|
-
return this.
|
|
58
|
+
return this.jsonOrSuccess(path.length === 1 && deprecated ? data[0] : data);
|
|
58
59
|
}
|
|
59
60
|
|
|
60
61
|
async postAction() {
|
|
61
62
|
const { path, type, action } = this.post();
|
|
62
63
|
const resp = await this.modelInstance.select({ url: path });
|
|
64
|
+
const { deprecated } = this.ctx.state;
|
|
63
65
|
|
|
64
66
|
if (think.isEmpty(resp)) {
|
|
65
67
|
if (action === 'desc') {
|
|
66
|
-
return this.
|
|
68
|
+
return this.jsonOrSuccess(deprecated ? 0 : [0]);
|
|
67
69
|
}
|
|
68
70
|
|
|
69
71
|
const count = 1;
|
|
@@ -73,7 +75,7 @@ module.exports = class extends BaseRest {
|
|
|
73
75
|
{ access: { read: true, write: true } }
|
|
74
76
|
);
|
|
75
77
|
|
|
76
|
-
return this.
|
|
78
|
+
return this.jsonOrSuccess(deprecated ? count : [count]);
|
|
77
79
|
}
|
|
78
80
|
|
|
79
81
|
const ret = await this.modelInstance.update(
|
|
@@ -86,6 +88,6 @@ module.exports = class extends BaseRest {
|
|
|
86
88
|
{ objectId: ['IN', resp.map(({ objectId }) => objectId)] }
|
|
87
89
|
);
|
|
88
90
|
|
|
89
|
-
return this.
|
|
91
|
+
return this.jsonOrSuccess(deprecated ? ret[0][type] : [ret[0][type]]);
|
|
90
92
|
}
|
|
91
93
|
};
|
|
@@ -7,7 +7,7 @@ const markdownParser = getMarkdownParser();
|
|
|
7
7
|
async function formatCmt(
|
|
8
8
|
{ ua, ip, ...comment },
|
|
9
9
|
users = [],
|
|
10
|
-
{ avatarProxy },
|
|
10
|
+
{ avatarProxy, deprecated },
|
|
11
11
|
loginUser
|
|
12
12
|
) {
|
|
13
13
|
ua = think.uaParser(ua);
|
|
@@ -61,6 +61,13 @@ async function formatCmt(
|
|
|
61
61
|
if (typeof comment.sticky === 'string') {
|
|
62
62
|
comment.sticky = Boolean(Number(comment.sticky));
|
|
63
63
|
}
|
|
64
|
+
|
|
65
|
+
comment.time = new Date(comment.insertedAt).getTime();
|
|
66
|
+
if (!deprecated) {
|
|
67
|
+
delete comment.insertedAt;
|
|
68
|
+
}
|
|
69
|
+
delete comment.createdAt;
|
|
70
|
+
delete comment.updatedAt;
|
|
64
71
|
|
|
65
72
|
return comment;
|
|
66
73
|
}
|
|
@@ -140,10 +147,10 @@ module.exports = class extends BaseRest {
|
|
|
140
147
|
);
|
|
141
148
|
}
|
|
142
149
|
|
|
143
|
-
return this.
|
|
150
|
+
return this.jsonOrSuccess(
|
|
144
151
|
await Promise.all(
|
|
145
152
|
comments.map((cmt) =>
|
|
146
|
-
formatCmt(cmt, users, this.config(), userInfo)
|
|
153
|
+
formatCmt(cmt, users, { ...this.config(), deprecated: this.ctx.state.deprecated }, userInfo)
|
|
147
154
|
)
|
|
148
155
|
)
|
|
149
156
|
);
|
|
@@ -164,18 +171,18 @@ module.exports = class extends BaseRest {
|
|
|
164
171
|
};
|
|
165
172
|
}
|
|
166
173
|
|
|
167
|
-
if (Array.isArray(url) && url.length > 1) {
|
|
174
|
+
if (Array.isArray(url) && (url.length > 1 || !this.ctx.state.deprecated)) {
|
|
168
175
|
const data = await this.modelInstance.select(where, {
|
|
169
176
|
field: ['url'],
|
|
170
177
|
});
|
|
171
178
|
|
|
172
|
-
return this.
|
|
179
|
+
return this.jsonOrSuccess(
|
|
173
180
|
url.map((u) => data.filter(({ url }) => url === u).length)
|
|
174
181
|
);
|
|
175
182
|
}
|
|
176
183
|
const data = await this.modelInstance.count(where);
|
|
177
184
|
|
|
178
|
-
return this.
|
|
185
|
+
return this.jsonOrSuccess(data);
|
|
179
186
|
}
|
|
180
187
|
|
|
181
188
|
case 'list': {
|
|
@@ -246,7 +253,7 @@ module.exports = class extends BaseRest {
|
|
|
246
253
|
waitingCount,
|
|
247
254
|
data: await Promise.all(
|
|
248
255
|
comments.map((cmt) =>
|
|
249
|
-
formatCmt(cmt, users, this.config(), userInfo)
|
|
256
|
+
formatCmt(cmt, users, { ...this.config(), deprecated: this.ctx.state.deprecated }, userInfo)
|
|
250
257
|
)
|
|
251
258
|
),
|
|
252
259
|
});
|
|
@@ -332,14 +339,13 @@ module.exports = class extends BaseRest {
|
|
|
332
339
|
(cmt) => rootIds[cmt.objectId] || rootIds[cmt.rid]
|
|
333
340
|
);
|
|
334
341
|
} else {
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
);
|
|
342
|
+
comments = await this.modelInstance.select({ ...where, rid: undefined }, {...selectOptions});
|
|
343
|
+
rootCount = comments.length;
|
|
344
|
+
rootComments = [
|
|
345
|
+
...comments.filter(({ rid, sticky }) => !rid && sticky),
|
|
346
|
+
...comments.filter(({ rid, sticky }) => !rid && !sticky),
|
|
347
|
+
].slice(pageOffset, pageOffset + pageSize);
|
|
348
|
+
|
|
343
349
|
const children = await this.modelInstance.select(
|
|
344
350
|
{
|
|
345
351
|
...where,
|
|
@@ -349,10 +355,6 @@ module.exports = class extends BaseRest {
|
|
|
349
355
|
);
|
|
350
356
|
|
|
351
357
|
comments = [...rootComments, ...children];
|
|
352
|
-
rootCount = await this.modelInstance.count({
|
|
353
|
-
...where,
|
|
354
|
-
rid: undefined,
|
|
355
|
-
});
|
|
356
358
|
}
|
|
357
359
|
|
|
358
360
|
const userModel = this.service(
|
|
@@ -430,7 +432,7 @@ module.exports = class extends BaseRest {
|
|
|
430
432
|
});
|
|
431
433
|
}
|
|
432
434
|
|
|
433
|
-
return this.json({
|
|
435
|
+
return this[this.ctx.state.deprecated ? 'json' : 'success']({
|
|
434
436
|
page,
|
|
435
437
|
totalPages: Math.ceil(rootCount / pageSize),
|
|
436
438
|
pageSize,
|
|
@@ -440,14 +442,14 @@ module.exports = class extends BaseRest {
|
|
|
440
442
|
const cmt = await formatCmt(
|
|
441
443
|
comment,
|
|
442
444
|
users,
|
|
443
|
-
this.config(),
|
|
444
|
-
userInfo
|
|
445
|
+
{ ...this.config(), deprecated: this.ctx.state.deprecated },
|
|
446
|
+
userInfo,
|
|
445
447
|
);
|
|
446
448
|
|
|
447
449
|
cmt.children = await Promise.all(
|
|
448
450
|
comments
|
|
449
451
|
.filter(({ rid }) => rid === cmt.objectId)
|
|
450
|
-
.map((cmt) => formatCmt(cmt, users, this.config(), userInfo))
|
|
452
|
+
.map((cmt) => formatCmt(cmt, users, { ...this.config(), deprecated: this.ctx.state.deprecated }, userInfo))
|
|
451
453
|
.reverse()
|
|
452
454
|
);
|
|
453
455
|
|
|
@@ -477,7 +479,7 @@ module.exports = class extends BaseRest {
|
|
|
477
479
|
user_id: this.ctx.state.userInfo.objectId,
|
|
478
480
|
};
|
|
479
481
|
|
|
480
|
-
if (pid) {
|
|
482
|
+
if (pid && this.ctx.deprecated) {
|
|
481
483
|
data.comment = `[@${at}](#${pid}): ` + data.comment;
|
|
482
484
|
}
|
|
483
485
|
|
|
@@ -610,14 +612,14 @@ module.exports = class extends BaseRest {
|
|
|
610
612
|
const cmtReturn = await formatCmt(
|
|
611
613
|
resp,
|
|
612
614
|
[userInfo],
|
|
613
|
-
this.config(),
|
|
615
|
+
{ ...this.config(), deprecated: this.ctx.state.deprecated },
|
|
614
616
|
userInfo
|
|
615
617
|
);
|
|
616
618
|
const parentReturn = parentComment
|
|
617
619
|
? await formatCmt(
|
|
618
620
|
parentComment,
|
|
619
621
|
parentUser ? [parentUser] : [],
|
|
620
|
-
this.config(),
|
|
622
|
+
{ ...this.config(), deprecated: this.ctx.state.deprecated },
|
|
621
623
|
userInfo
|
|
622
624
|
)
|
|
623
625
|
: undefined;
|
|
@@ -638,7 +640,7 @@ module.exports = class extends BaseRest {
|
|
|
638
640
|
think.logger.debug(`Comment post hooks postSave done!`);
|
|
639
641
|
|
|
640
642
|
return this.success(
|
|
641
|
-
await formatCmt(resp, [userInfo], this.config(), userInfo)
|
|
643
|
+
await formatCmt(resp, [userInfo], { ...this.config(), deprecated: this.ctx.state.deprecated }, userInfo)
|
|
642
644
|
);
|
|
643
645
|
}
|
|
644
646
|
|
|
@@ -688,7 +690,7 @@ module.exports = class extends BaseRest {
|
|
|
688
690
|
const cmtReturn = await formatCmt(
|
|
689
691
|
newData[0],
|
|
690
692
|
cmtUser ? [cmtUser] : [],
|
|
691
|
-
this.config(),
|
|
693
|
+
{ ...this.config(), deprecated: this.ctx.state.deprecated },
|
|
692
694
|
userInfo
|
|
693
695
|
);
|
|
694
696
|
|
|
@@ -719,7 +721,7 @@ module.exports = class extends BaseRest {
|
|
|
719
721
|
const pcmtReturn = await formatCmt(
|
|
720
722
|
pComment,
|
|
721
723
|
pUser ? [pUser] : [],
|
|
722
|
-
this.config(),
|
|
724
|
+
{ ...this.config(), deprecated: this.ctx.state.deprecated },
|
|
723
725
|
userInfo
|
|
724
726
|
);
|
|
725
727
|
|
package/src/controller/oauth.js
CHANGED
|
@@ -20,7 +20,7 @@ module.exports = class extends think.Controller {
|
|
|
20
20
|
|
|
21
21
|
if (!hasCode) {
|
|
22
22
|
const { serverURL } = this.ctx;
|
|
23
|
-
const redirectUrl = `${serverURL}/oauth?${new URLSearchParams({
|
|
23
|
+
const redirectUrl = `${serverURL}/api/oauth?${new URLSearchParams({
|
|
24
24
|
redirect,
|
|
25
25
|
type,
|
|
26
26
|
}).toString()}`;
|
|
@@ -40,7 +40,7 @@ module.exports = class extends think.Controller {
|
|
|
40
40
|
|
|
41
41
|
if (type === 'facebook') {
|
|
42
42
|
const { serverURL } = this.ctx;
|
|
43
|
-
const redirectUrl = `${serverURL}/oauth?${new URLSearchParams({
|
|
43
|
+
const redirectUrl = `${serverURL}/api/oauth?${new URLSearchParams({
|
|
44
44
|
redirect,
|
|
45
45
|
type,
|
|
46
46
|
}).toString()}`;
|
package/src/extend/controller.js
CHANGED
|
@@ -13,6 +13,9 @@ module.exports = {
|
|
|
13
13
|
|
|
14
14
|
return think.prevent();
|
|
15
15
|
},
|
|
16
|
+
jsonOrSuccess(...args) {
|
|
17
|
+
return this[this.ctx.state.deprecated ? 'json' : 'success'](...args);
|
|
18
|
+
},
|
|
16
19
|
locale(message, variables) {
|
|
17
20
|
const { lang } = this.get();
|
|
18
21
|
const locale = locales[(lang || 'zh-cn').toLowerCase()] || locales['zh-cn'];
|
package/src/logic/comment.js
CHANGED
|
@@ -14,7 +14,7 @@ module.exports = class extends Base {
|
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
|
-
* @api {GET} /comment Get comment list for client
|
|
17
|
+
* @api {GET} /api/comment Get comment list for client
|
|
18
18
|
* @apiGroup Comment
|
|
19
19
|
* @apiVersion 0.0.1
|
|
20
20
|
*
|
|
@@ -48,7 +48,7 @@ module.exports = class extends Base {
|
|
|
48
48
|
* @apiSuccess (200) {String} data.children.type comment login user type
|
|
49
49
|
*/
|
|
50
50
|
/**
|
|
51
|
-
* @api {GET} /comment?type=list Get comment list for admin
|
|
51
|
+
* @api {GET} /api/comment?type=list Get comment list for admin
|
|
52
52
|
* @apiGroup Comment
|
|
53
53
|
* @apiVersion 0.0.1
|
|
54
54
|
*
|
|
@@ -77,7 +77,7 @@ module.exports = class extends Base {
|
|
|
77
77
|
* @apiSuccess (200) {String} data.data.url comment article link
|
|
78
78
|
*/
|
|
79
79
|
/**
|
|
80
|
-
* @api {GET} /comment?type=count Get comment count for articles
|
|
80
|
+
* @api {GET} /api/comment?type=count Get comment count for articles
|
|
81
81
|
* @apiGroup Comment
|
|
82
82
|
* @apiVersion 0.0.1
|
|
83
83
|
*
|
|
@@ -90,7 +90,7 @@ module.exports = class extends Base {
|
|
|
90
90
|
* [300, 100]
|
|
91
91
|
*/
|
|
92
92
|
/**
|
|
93
|
-
* @api {GET} /comment?type=recent Get recent comments
|
|
93
|
+
* @api {GET} /api/comment?type=recent Get recent comments
|
|
94
94
|
* @apiGroup Comment
|
|
95
95
|
* @apiVersion 0.0.1
|
|
96
96
|
*
|
|
@@ -177,7 +177,7 @@ module.exports = class extends Base {
|
|
|
177
177
|
}
|
|
178
178
|
|
|
179
179
|
/**
|
|
180
|
-
* @api {POST} /comment post comment
|
|
180
|
+
* @api {POST} /api/comment post comment
|
|
181
181
|
* @apiGroup Comment
|
|
182
182
|
* @apiVersion 0.0.1
|
|
183
183
|
*
|
|
@@ -221,7 +221,7 @@ module.exports = class extends Base {
|
|
|
221
221
|
}
|
|
222
222
|
|
|
223
223
|
/**
|
|
224
|
-
* @api {PUT} /comment/:id update comment data
|
|
224
|
+
* @api {PUT} /api/comment/:id update comment data
|
|
225
225
|
* @apiGroup Comment
|
|
226
226
|
* @apiVersion 0.0.1
|
|
227
227
|
*
|
|
@@ -279,7 +279,7 @@ module.exports = class extends Base {
|
|
|
279
279
|
}
|
|
280
280
|
|
|
281
281
|
/**
|
|
282
|
-
* @api {DELETE} /comment/:id delete comment
|
|
282
|
+
* @api {DELETE} /api/comment/:id delete comment
|
|
283
283
|
* @apiGroup Comment
|
|
284
284
|
* @apiVersion 0.0.1
|
|
285
285
|
*
|
package/src/logic/db.js
CHANGED
|
@@ -16,7 +16,7 @@ module.exports = class extends Base {
|
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
/**
|
|
19
|
-
* @api {GET} /db export site data
|
|
19
|
+
* @api {GET} /api/db export site data
|
|
20
20
|
* @apiGroup Site
|
|
21
21
|
* @apiVersion 0.0.1
|
|
22
22
|
*
|
|
@@ -25,7 +25,7 @@ module.exports = class extends Base {
|
|
|
25
25
|
async getAction() {}
|
|
26
26
|
|
|
27
27
|
/**
|
|
28
|
-
* @api {POST} /db import site data
|
|
28
|
+
* @api {POST} /api/db import site data
|
|
29
29
|
* @apiGroup Site
|
|
30
30
|
* @apiVersion 0.0.1
|
|
31
31
|
*
|
|
@@ -42,7 +42,7 @@ module.exports = class extends Base {
|
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
/**
|
|
45
|
-
* @api {PUT} /db update site table data
|
|
45
|
+
* @api {PUT} /api/db update site table data
|
|
46
46
|
* @apiGroup Site
|
|
47
47
|
* @apiVersion 0.0.1
|
|
48
48
|
*
|
|
@@ -63,7 +63,7 @@ module.exports = class extends Base {
|
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
/**
|
|
66
|
-
* @api {DELETE} /db clean site data
|
|
66
|
+
* @api {DELETE} /api/db clean site data
|
|
67
67
|
* @apiGroup Site
|
|
68
68
|
* @apiVersion 0.0.1
|
|
69
69
|
*
|
package/src/logic/oauth.js
CHANGED
package/src/logic/token.js
CHANGED
|
@@ -2,7 +2,7 @@ const Base = require('./base');
|
|
|
2
2
|
|
|
3
3
|
module.exports = class extends Base {
|
|
4
4
|
/**
|
|
5
|
-
* @api {GET} /token get login user info
|
|
5
|
+
* @api {GET} /api/token get login user info
|
|
6
6
|
* @apiGroup User
|
|
7
7
|
* @apiVersion 0.0.1
|
|
8
8
|
*
|
|
@@ -24,7 +24,7 @@ module.exports = class extends Base {
|
|
|
24
24
|
getAction() {}
|
|
25
25
|
|
|
26
26
|
/**
|
|
27
|
-
* @api {POST} /token user login
|
|
27
|
+
* @api {POST} /api/token user login
|
|
28
28
|
* @apiGroup User
|
|
29
29
|
* @apiVersion 0.0.1
|
|
30
30
|
*
|
|
@@ -40,7 +40,7 @@ module.exports = class extends Base {
|
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
/**
|
|
43
|
-
* @api {DELETE} /token user logout
|
|
43
|
+
* @api {DELETE} /api/token user logout
|
|
44
44
|
* @apiGroup User
|
|
45
45
|
* @apiVersion 0.0.1
|
|
46
46
|
*
|
package/src/logic/user.js
CHANGED
|
@@ -2,7 +2,7 @@ const Base = require('./base');
|
|
|
2
2
|
|
|
3
3
|
module.exports = class extends Base {
|
|
4
4
|
/**
|
|
5
|
-
* @api {GET} /user user top list without admin
|
|
5
|
+
* @api {GET} /api/user user top list without admin
|
|
6
6
|
* @apiGroup User
|
|
7
7
|
* @apiVersion 0.0.1
|
|
8
8
|
*
|
|
@@ -19,7 +19,7 @@ module.exports = class extends Base {
|
|
|
19
19
|
* @apiSuccess (200) {String} data.count user comment count
|
|
20
20
|
*/
|
|
21
21
|
/**
|
|
22
|
-
* @api {GET} /user?token user list with admin login
|
|
22
|
+
* @api {GET} /api/user?token user list with admin login
|
|
23
23
|
* @apiGroup User
|
|
24
24
|
* @apiVersion 0.0.1
|
|
25
25
|
*
|
|
@@ -70,7 +70,7 @@ module.exports = class extends Base {
|
|
|
70
70
|
}
|
|
71
71
|
|
|
72
72
|
/**
|
|
73
|
-
* @api {POST} /user user register
|
|
73
|
+
* @api {POST} /api/user user register
|
|
74
74
|
* @apiGroup User
|
|
75
75
|
* @apiVersion 0.0.1
|
|
76
76
|
*
|
|
@@ -88,7 +88,7 @@ module.exports = class extends Base {
|
|
|
88
88
|
}
|
|
89
89
|
|
|
90
90
|
/**
|
|
91
|
-
* @api {PUT} /user update user profile
|
|
91
|
+
* @api {PUT} /api/user update user profile
|
|
92
92
|
* @apiGroup User
|
|
93
93
|
* @apiVersion 0.0.1
|
|
94
94
|
*
|
|
@@ -13,6 +13,7 @@ module.exports = function () {
|
|
|
13
13
|
window.SITE_URL = ${JSON.stringify(process.env.SITE_URL)};
|
|
14
14
|
window.SITE_NAME = ${JSON.stringify(process.env.SITE_NAME)};
|
|
15
15
|
window.recaptchaV3Key = ${JSON.stringify(process.env.RECAPTCHA_V3_KEY)};
|
|
16
|
+
window.serverURL = '${ctx.serverURL}/api/';
|
|
16
17
|
</script>
|
|
17
18
|
<script src="${
|
|
18
19
|
process.env.WALINE_ADMIN_MODULE_ASSET_URL || '//unpkg.com/@waline/admin'
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
const DEPRECATE_ROUTER_NEXT_VERSION = [
|
|
2
|
+
'/comment',
|
|
3
|
+
'/db',
|
|
4
|
+
'/oauth',
|
|
5
|
+
'/token',
|
|
6
|
+
'/user',
|
|
7
|
+
'/verification',
|
|
8
|
+
'/token/2fa',
|
|
9
|
+
'/user/password'
|
|
10
|
+
];
|
|
11
|
+
|
|
12
|
+
module.exports = () => async (ctx, next) => {
|
|
13
|
+
ctx.state.deprecated = DEPRECATE_ROUTER_NEXT_VERSION.some(prefix => ctx.path.indexOf(prefix) === 0);
|
|
14
|
+
if (ctx.state.deprecated) {
|
|
15
|
+
think.logger.warn(`[Deprecated] ${ctx.path} API will be deprecated in the next major version, please don't use it anymore. If you are using \`@waline/client\` please upgrade to \`@waline/client@3\`. For other scenarios, you can use \`/api${ctx.path}\` to replace it.`)
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
await next();
|
|
19
|
+
};
|
package/deta.build.sh
DELETED