nodestatus-server 1.2.5-beta.4 → 1.2.6-beta.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/build/app.js +1003 -272
- package/build/dist/classic-theme/assets/index.1523780a.js +5 -0
- package/build/dist/classic-theme/index.html +2 -2
- package/build/dist/hotaru-admin/assets/{LayoutHandler.428bd11c.js → LayoutHandler.a95f2fc7.js} +2 -2
- package/build/dist/hotaru-admin/assets/{Login.9417b9db.js → Login.41131be5.js} +1 -1
- package/build/dist/hotaru-admin/assets/{UserOutlined.556975fe.js → UserOutlined.b0352a1d.js} +1 -1
- package/build/dist/hotaru-admin/assets/index.c1101314.js +146 -0
- package/build/dist/hotaru-admin/index.html +1 -1
- package/build/dist/hotaru-theme/assets/index.448ffcff.js +5 -0
- package/build/dist/hotaru-theme/index.html +2 -2
- package/package.json +4 -5
- package/build/dist/classic-theme/assets/index.3c174464.js +0 -4
- package/build/dist/hotaru-admin/assets/index.5a41d476.js +0 -146
- package/build/dist/hotaru-theme/assets/index.1cf16238.js +0 -4
package/build/app.js
CHANGED
|
@@ -1,55 +1,55 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var require$$1$3 = require('path');
|
|
4
|
-
var require$$0$
|
|
4
|
+
var require$$0$5 = require('tty');
|
|
5
5
|
var require$$1$2 = require('util');
|
|
6
|
-
var require$$0$
|
|
7
|
-
var require$$0$
|
|
6
|
+
var require$$0$6 = require('buffer');
|
|
7
|
+
var require$$0$7 = require('fs');
|
|
8
8
|
var Stream$7 = require('stream');
|
|
9
9
|
var require$$2$2 = require('assert');
|
|
10
|
-
var require$$0$
|
|
11
|
-
var require$$0$
|
|
10
|
+
var require$$0$8 = require('events');
|
|
11
|
+
var require$$0$9 = require('crypto');
|
|
12
12
|
var require$$2$3 = require('http');
|
|
13
|
-
var require$$0$
|
|
13
|
+
var require$$0$a = require('url');
|
|
14
14
|
var require$$1$4 = require('net');
|
|
15
|
-
var require$$5$
|
|
15
|
+
var require$$5$1 = require('querystring');
|
|
16
16
|
var require$$1$5 = require('os');
|
|
17
|
-
var require$$0$
|
|
17
|
+
var require$$0$b = require('constants');
|
|
18
18
|
var zlib$3 = require('zlib');
|
|
19
19
|
var dotenv = require('dotenv');
|
|
20
20
|
var require$$1$6 = require('child_process');
|
|
21
|
-
var require$$4$
|
|
21
|
+
var require$$4$3 = require('process');
|
|
22
22
|
var require$$1$7 = require('string_decoder');
|
|
23
23
|
var client$1 = require('@prisma/client');
|
|
24
24
|
var require$$2$4 = require('https');
|
|
25
|
-
var require$$4$
|
|
26
|
-
var require$$0$
|
|
25
|
+
var require$$4$4 = require('tls');
|
|
26
|
+
var require$$0$c = require('punycode');
|
|
27
27
|
|
|
28
28
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
29
29
|
|
|
30
30
|
var require$$1__default$1 = /*#__PURE__*/_interopDefaultLegacy(require$$1$3);
|
|
31
|
-
var require$$0__default = /*#__PURE__*/_interopDefaultLegacy(require$$0$
|
|
31
|
+
var require$$0__default = /*#__PURE__*/_interopDefaultLegacy(require$$0$5);
|
|
32
32
|
var require$$1__default = /*#__PURE__*/_interopDefaultLegacy(require$$1$2);
|
|
33
|
-
var require$$0__default$1 = /*#__PURE__*/_interopDefaultLegacy(require$$0$
|
|
34
|
-
var require$$0__default$2 = /*#__PURE__*/_interopDefaultLegacy(require$$0$
|
|
33
|
+
var require$$0__default$1 = /*#__PURE__*/_interopDefaultLegacy(require$$0$6);
|
|
34
|
+
var require$$0__default$2 = /*#__PURE__*/_interopDefaultLegacy(require$$0$7);
|
|
35
35
|
var Stream__default = /*#__PURE__*/_interopDefaultLegacy(Stream$7);
|
|
36
36
|
var require$$2__default = /*#__PURE__*/_interopDefaultLegacy(require$$2$2);
|
|
37
|
-
var require$$0__default$3 = /*#__PURE__*/_interopDefaultLegacy(require$$0$
|
|
38
|
-
var require$$0__default$4 = /*#__PURE__*/_interopDefaultLegacy(require$$0$
|
|
37
|
+
var require$$0__default$3 = /*#__PURE__*/_interopDefaultLegacy(require$$0$8);
|
|
38
|
+
var require$$0__default$4 = /*#__PURE__*/_interopDefaultLegacy(require$$0$9);
|
|
39
39
|
var require$$2__default$1 = /*#__PURE__*/_interopDefaultLegacy(require$$2$3);
|
|
40
|
-
var require$$0__default$5 = /*#__PURE__*/_interopDefaultLegacy(require$$0$
|
|
40
|
+
var require$$0__default$5 = /*#__PURE__*/_interopDefaultLegacy(require$$0$a);
|
|
41
41
|
var require$$1__default$2 = /*#__PURE__*/_interopDefaultLegacy(require$$1$4);
|
|
42
|
-
var require$$5__default = /*#__PURE__*/_interopDefaultLegacy(require$$5$
|
|
42
|
+
var require$$5__default = /*#__PURE__*/_interopDefaultLegacy(require$$5$1);
|
|
43
43
|
var require$$1__default$3 = /*#__PURE__*/_interopDefaultLegacy(require$$1$5);
|
|
44
|
-
var require$$0__default$6 = /*#__PURE__*/_interopDefaultLegacy(require$$0$
|
|
44
|
+
var require$$0__default$6 = /*#__PURE__*/_interopDefaultLegacy(require$$0$b);
|
|
45
45
|
var zlib__default = /*#__PURE__*/_interopDefaultLegacy(zlib$3);
|
|
46
46
|
var dotenv__default = /*#__PURE__*/_interopDefaultLegacy(dotenv);
|
|
47
47
|
var require$$1__default$4 = /*#__PURE__*/_interopDefaultLegacy(require$$1$6);
|
|
48
|
-
var require$$4__default = /*#__PURE__*/_interopDefaultLegacy(require$$4$
|
|
48
|
+
var require$$4__default = /*#__PURE__*/_interopDefaultLegacy(require$$4$3);
|
|
49
49
|
var require$$1__default$5 = /*#__PURE__*/_interopDefaultLegacy(require$$1$7);
|
|
50
50
|
var require$$2__default$2 = /*#__PURE__*/_interopDefaultLegacy(require$$2$4);
|
|
51
|
-
var require$$4__default$1 = /*#__PURE__*/_interopDefaultLegacy(require$$4$
|
|
52
|
-
var require$$0__default$7 = /*#__PURE__*/_interopDefaultLegacy(require$$0$
|
|
51
|
+
var require$$4__default$1 = /*#__PURE__*/_interopDefaultLegacy(require$$4$4);
|
|
52
|
+
var require$$0__default$7 = /*#__PURE__*/_interopDefaultLegacy(require$$0$c);
|
|
53
53
|
|
|
54
54
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
55
55
|
|
|
@@ -1972,7 +1972,7 @@ function ContentDisposition (type, parameters) {
|
|
|
1972
1972
|
|
|
1973
1973
|
var mimeTypes$1 = {};
|
|
1974
1974
|
|
|
1975
|
-
var require$$0$
|
|
1975
|
+
var require$$0$4 = {
|
|
1976
1976
|
"application/1d-interleaved-parityfec": {
|
|
1977
1977
|
source: "iana"
|
|
1978
1978
|
},
|
|
@@ -12601,7 +12601,7 @@ var require$$0$3 = {
|
|
|
12601
12601
|
* Module exports.
|
|
12602
12602
|
*/
|
|
12603
12603
|
|
|
12604
|
-
var mimeDb = require$$0$
|
|
12604
|
+
var mimeDb = require$$0$4;
|
|
12605
12605
|
|
|
12606
12606
|
/*!
|
|
12607
12607
|
* mime-types
|
|
@@ -13528,7 +13528,7 @@ function tryNormalizeType (value) {
|
|
|
13528
13528
|
}
|
|
13529
13529
|
}
|
|
13530
13530
|
|
|
13531
|
-
var require$$0$
|
|
13531
|
+
var require$$0$3 = {
|
|
13532
13532
|
"100": "Continue",
|
|
13533
13533
|
"101": "Switching Protocols",
|
|
13534
13534
|
"102": "Processing",
|
|
@@ -13607,23 +13607,23 @@ var require$$0$2 = {
|
|
|
13607
13607
|
* @private
|
|
13608
13608
|
*/
|
|
13609
13609
|
|
|
13610
|
-
var codes = require$$0$
|
|
13610
|
+
var codes$1 = require$$0$3;
|
|
13611
13611
|
|
|
13612
13612
|
/**
|
|
13613
13613
|
* Module exports.
|
|
13614
13614
|
* @public
|
|
13615
13615
|
*/
|
|
13616
13616
|
|
|
13617
|
-
var statuses$
|
|
13617
|
+
var statuses$2 = status$1;
|
|
13618
13618
|
|
|
13619
13619
|
// status code to message map
|
|
13620
|
-
status.STATUS_CODES = codes;
|
|
13620
|
+
status$1.STATUS_CODES = codes$1;
|
|
13621
13621
|
|
|
13622
13622
|
// array of status codes
|
|
13623
|
-
status.codes = populateStatusesMap(status, codes);
|
|
13623
|
+
status$1.codes = populateStatusesMap(status$1, codes$1);
|
|
13624
13624
|
|
|
13625
13625
|
// status codes for redirects
|
|
13626
|
-
status.redirect = {
|
|
13626
|
+
status$1.redirect = {
|
|
13627
13627
|
300: true,
|
|
13628
13628
|
301: true,
|
|
13629
13629
|
302: true,
|
|
@@ -13634,14 +13634,14 @@ status.redirect = {
|
|
|
13634
13634
|
};
|
|
13635
13635
|
|
|
13636
13636
|
// status codes for empty bodies
|
|
13637
|
-
status.empty = {
|
|
13637
|
+
status$1.empty = {
|
|
13638
13638
|
204: true,
|
|
13639
13639
|
205: true,
|
|
13640
13640
|
304: true
|
|
13641
13641
|
};
|
|
13642
13642
|
|
|
13643
13643
|
// status codes for when you should retry the request
|
|
13644
|
-
status.retry = {
|
|
13644
|
+
status$1.retry = {
|
|
13645
13645
|
502: true,
|
|
13646
13646
|
503: true,
|
|
13647
13647
|
504: true
|
|
@@ -13685,9 +13685,9 @@ function populateStatusesMap (statuses, codes) {
|
|
|
13685
13685
|
* @public
|
|
13686
13686
|
*/
|
|
13687
13687
|
|
|
13688
|
-
function status (code) {
|
|
13688
|
+
function status$1 (code) {
|
|
13689
13689
|
if (typeof code === 'number') {
|
|
13690
|
-
if (!status[code]) throw new Error('invalid status code: ' + code)
|
|
13690
|
+
if (!status$1[code]) throw new Error('invalid status code: ' + code)
|
|
13691
13691
|
return code
|
|
13692
13692
|
}
|
|
13693
13693
|
|
|
@@ -13698,11 +13698,11 @@ function status (code) {
|
|
|
13698
13698
|
// '403'
|
|
13699
13699
|
var n = parseInt(code, 10);
|
|
13700
13700
|
if (!isNaN(n)) {
|
|
13701
|
-
if (!status[n]) throw new Error('invalid status code: ' + n)
|
|
13701
|
+
if (!status$1[n]) throw new Error('invalid status code: ' + n)
|
|
13702
13702
|
return n
|
|
13703
13703
|
}
|
|
13704
13704
|
|
|
13705
|
-
n = status[code.toLowerCase()];
|
|
13705
|
+
n = status$1[code.toLowerCase()];
|
|
13706
13706
|
if (!n) throw new Error('invalid status message: "' + code + '"')
|
|
13707
13707
|
return n
|
|
13708
13708
|
}
|
|
@@ -14011,7 +14011,7 @@ const getType = cacheContentType;
|
|
|
14011
14011
|
const onFinish = onFinished$2.exports;
|
|
14012
14012
|
const escape = escapeHtml_1;
|
|
14013
14013
|
const typeis = typeIs.exports.is;
|
|
14014
|
-
const statuses = statuses$
|
|
14014
|
+
const statuses = statuses$2;
|
|
14015
14015
|
const destroy = destroy_1;
|
|
14016
14016
|
const assert = require$$2__default["default"];
|
|
14017
14017
|
const extname = require$$1__default$1["default"].extname;
|
|
@@ -14638,7 +14638,7 @@ function compose$5 (middleware) {
|
|
|
14638
14638
|
|
|
14639
14639
|
var context$4 = {exports: {}};
|
|
14640
14640
|
|
|
14641
|
-
var httpErrors$
|
|
14641
|
+
var httpErrors$3 = {exports: {}};
|
|
14642
14642
|
|
|
14643
14643
|
var compat = {exports: {}};
|
|
14644
14644
|
|
|
@@ -15438,7 +15438,7 @@ try {
|
|
|
15438
15438
|
* @public
|
|
15439
15439
|
*/
|
|
15440
15440
|
|
|
15441
|
-
var toidentifier = toIdentifier;
|
|
15441
|
+
var toidentifier$1 = toIdentifier$1;
|
|
15442
15442
|
|
|
15443
15443
|
/**
|
|
15444
15444
|
* Trasform the given string into a JavaScript identifier
|
|
@@ -15448,7 +15448,7 @@ var toidentifier = toIdentifier;
|
|
|
15448
15448
|
* @public
|
|
15449
15449
|
*/
|
|
15450
15450
|
|
|
15451
|
-
function toIdentifier (str) {
|
|
15451
|
+
function toIdentifier$1 (str) {
|
|
15452
15452
|
return str
|
|
15453
15453
|
.split(' ')
|
|
15454
15454
|
.map(function (token) {
|
|
@@ -15474,9 +15474,9 @@ function toIdentifier (str) {
|
|
|
15474
15474
|
|
|
15475
15475
|
var deprecate = depd_1$1('http-errors');
|
|
15476
15476
|
var setPrototypeOf = setprototypeof$2;
|
|
15477
|
-
var statuses = statuses$
|
|
15477
|
+
var statuses = statuses$2;
|
|
15478
15478
|
var inherits = inherits$1.exports;
|
|
15479
|
-
var toIdentifier = toidentifier;
|
|
15479
|
+
var toIdentifier = toidentifier$1;
|
|
15480
15480
|
|
|
15481
15481
|
/**
|
|
15482
15482
|
* Module exports.
|
|
@@ -15757,7 +15757,7 @@ function toClassName (name) {
|
|
|
15757
15757
|
? name + 'Error'
|
|
15758
15758
|
: name
|
|
15759
15759
|
}
|
|
15760
|
-
}(httpErrors$
|
|
15760
|
+
}(httpErrors$3));
|
|
15761
15761
|
|
|
15762
15762
|
var deepEqual$1 = {exports: {}};
|
|
15763
15763
|
|
|
@@ -15893,7 +15893,7 @@ function objEquiv(a, b, opts) {
|
|
|
15893
15893
|
return typeof a === typeof b;
|
|
15894
15894
|
}
|
|
15895
15895
|
|
|
15896
|
-
var createError$3 = httpErrors$
|
|
15896
|
+
var createError$3 = httpErrors$3.exports;
|
|
15897
15897
|
var eql = deepEqual$1.exports;
|
|
15898
15898
|
|
|
15899
15899
|
var httpAssert = assert$4;
|
|
@@ -16912,10 +16912,10 @@ var cookies = Cookies;
|
|
|
16912
16912
|
*/
|
|
16913
16913
|
|
|
16914
16914
|
const util = require$$1__default["default"];
|
|
16915
|
-
const createError = httpErrors$
|
|
16915
|
+
const createError = httpErrors$3.exports;
|
|
16916
16916
|
const httpAssert$1 = httpAssert;
|
|
16917
16917
|
const delegate = delegates;
|
|
16918
|
-
const statuses = statuses$
|
|
16918
|
+
const statuses = statuses$2;
|
|
16919
16919
|
const Cookies = cookies;
|
|
16920
16920
|
|
|
16921
16921
|
const COOKIES = Symbol('context#cookies');
|
|
@@ -19944,7 +19944,7 @@ const response = response$1.exports;
|
|
|
19944
19944
|
const compose$3 = koaCompose;
|
|
19945
19945
|
const context$3 = context$4.exports;
|
|
19946
19946
|
const request = request$1.exports;
|
|
19947
|
-
const statuses = statuses$
|
|
19947
|
+
const statuses$1 = statuses$2;
|
|
19948
19948
|
const Emitter = require$$0__default$3["default"];
|
|
19949
19949
|
const util$e = require$$1__default["default"];
|
|
19950
19950
|
const Stream$5 = Stream__default["default"];
|
|
@@ -19952,7 +19952,7 @@ const http$4 = require$$2__default$1["default"];
|
|
|
19952
19952
|
const only = only$1;
|
|
19953
19953
|
const convert$1 = koaConvert;
|
|
19954
19954
|
const deprecate = depd_1('koa');
|
|
19955
|
-
const { HttpError: HttpError$1 } = httpErrors$
|
|
19955
|
+
const { HttpError: HttpError$1 } = httpErrors$3.exports;
|
|
19956
19956
|
|
|
19957
19957
|
/**
|
|
19958
19958
|
* Expose `Application` class.
|
|
@@ -20169,7 +20169,7 @@ function respond(ctx) {
|
|
|
20169
20169
|
const code = ctx.status;
|
|
20170
20170
|
|
|
20171
20171
|
// ignore body
|
|
20172
|
-
if (statuses.empty[code]) {
|
|
20172
|
+
if (statuses$1.empty[code]) {
|
|
20173
20173
|
// strip headers
|
|
20174
20174
|
ctx.body = null;
|
|
20175
20175
|
return res.end();
|
|
@@ -21011,7 +21011,7 @@ if (typeof process === 'undefined' || process.type === 'renderer' || process.bro
|
|
|
21011
21011
|
src$3.exports = node$1.exports;
|
|
21012
21012
|
}
|
|
21013
21013
|
|
|
21014
|
-
var httpErrors$
|
|
21014
|
+
var httpErrors$2 = {exports: {}};
|
|
21015
21015
|
|
|
21016
21016
|
var setprototypeof$1 = Object.setPrototypeOf || ({__proto__:[]} instanceof Array ? setProtoOf$1 : mixinProperties$1);
|
|
21017
21017
|
|
|
@@ -21081,7 +21081,7 @@ try {
|
|
|
21081
21081
|
|
|
21082
21082
|
var deprecate = depd_1$1('http-errors');
|
|
21083
21083
|
var setPrototypeOf = setprototypeof$1;
|
|
21084
|
-
var statuses = statuses$
|
|
21084
|
+
var statuses = statuses$2;
|
|
21085
21085
|
var inherits$1 = inherits.exports;
|
|
21086
21086
|
|
|
21087
21087
|
/**
|
|
@@ -21325,7 +21325,7 @@ function toIdentifier (str) {
|
|
|
21325
21325
|
return token.slice(0, 1).toUpperCase() + token.slice(1)
|
|
21326
21326
|
}).join('').replace(/[^ _0-9a-z]/gi, '')
|
|
21327
21327
|
}
|
|
21328
|
-
}(httpErrors$
|
|
21328
|
+
}(httpErrors$2));
|
|
21329
21329
|
|
|
21330
21330
|
var pathIsAbsolute$1 = {exports: {}};
|
|
21331
21331
|
|
|
@@ -21360,7 +21360,7 @@ pathIsAbsolute$1.exports.win32 = win32;
|
|
|
21360
21360
|
* @private
|
|
21361
21361
|
*/
|
|
21362
21362
|
|
|
21363
|
-
var createError$2 = httpErrors$
|
|
21363
|
+
var createError$2 = httpErrors$2.exports;
|
|
21364
21364
|
var join = require$$1__default$1["default"].join;
|
|
21365
21365
|
var normalize$2 = require$$1__default$1["default"].normalize;
|
|
21366
21366
|
var pathIsAbsolute = pathIsAbsolute$1.exports;
|
|
@@ -21443,7 +21443,7 @@ const fs$r = require$$0__default$2["default"];
|
|
|
21443
21443
|
const util$c = require$$1__default["default"];
|
|
21444
21444
|
const debug$s = src$4.exports('koa-send');
|
|
21445
21445
|
const resolvePath = resolvePath_1;
|
|
21446
|
-
const createError$1 = httpErrors$
|
|
21446
|
+
const createError$1 = httpErrors$3.exports;
|
|
21447
21447
|
const assert$3 = require$$2__default["default"];
|
|
21448
21448
|
|
|
21449
21449
|
const stat$5 = util$c.promisify(fs$r.stat);
|
|
@@ -32445,7 +32445,7 @@ const {
|
|
|
32445
32445
|
Help
|
|
32446
32446
|
} = commander;
|
|
32447
32447
|
|
|
32448
|
-
var _a$1, _b$1;
|
|
32448
|
+
var _a$1, _b$1, _c$1, _d, _e;
|
|
32449
32449
|
if (process.env.NODE_ENV !== "TEST") {
|
|
32450
32450
|
dotenv__default["default"].config({ path: require$$1$3.resolve(require$$1$5.homedir(), ".nodestatus/.env.local") });
|
|
32451
32451
|
}
|
|
@@ -32461,17 +32461,20 @@ const config = {
|
|
|
32461
32461
|
port: Number(process.env.PORT || options.port),
|
|
32462
32462
|
interval: Number(process.env.INTERVAL || options.interval),
|
|
32463
32463
|
verbose: process.env.VERBOSE === "true",
|
|
32464
|
-
theme: process.env.THEME || "hotaru-theme",
|
|
32465
32464
|
pingInterval: Number(process.env.PING_INTERVAL || 30),
|
|
32466
32465
|
useIpc: process.env.USE_IPC !== "false",
|
|
32467
32466
|
useWeb: process.env.USE_WEB !== "false",
|
|
32468
32467
|
usePush: process.env.USE_PUSH !== "false",
|
|
32468
|
+
webTheme: process.env.WEB_THEME || process.env.THEME || "hotaru-theme",
|
|
32469
|
+
webTitle: (_a$1 = process.env.WEB_TITLE) != null ? _a$1 : "Server Status",
|
|
32470
|
+
webSubTitle: (_b$1 = process.env.WEB_SUBTITLE) != null ? _b$1 : "Servers' Probes Set up with NodeStatus",
|
|
32471
|
+
webHeadTitle: (_c$1 = process.env.WEB_HEADTITLE) != null ? _c$1 : "NodeStatus",
|
|
32469
32472
|
webUsername: process.env.WEB_USERNAME || "admin",
|
|
32470
32473
|
webPassword: process.env.WEB_PASSWORD || "",
|
|
32471
32474
|
webSecret: process.env.WEB_SECRET || "secret",
|
|
32472
32475
|
ipcAddress: process.env.IPC_ADDRESS || (require$$1$5.platform() !== "win32" ? "/tmp/status_unix.sock" : "\\\\.\\pipe\\status_ipc"),
|
|
32473
|
-
pushTimeOut: Number((
|
|
32474
|
-
pushDelay: Number((
|
|
32476
|
+
pushTimeOut: Number((_d = process.env.PUSH_TIMEOUT) != null ? _d : 120),
|
|
32477
|
+
pushDelay: Number((_e = process.env.PUSH_DELAY) != null ? _e : 15),
|
|
32475
32478
|
telegram: {
|
|
32476
32479
|
proxy: process.env.TGBOT_PROXY,
|
|
32477
32480
|
bot_token: process.env.TGBOT_TOKEN || "",
|
|
@@ -37865,7 +37868,7 @@ function parse$7(val) {
|
|
|
37865
37868
|
return Math.floor(map[unit] * floatValue);
|
|
37866
37869
|
}
|
|
37867
37870
|
|
|
37868
|
-
var httpErrors = {exports: {}};
|
|
37871
|
+
var httpErrors$1 = {exports: {}};
|
|
37869
37872
|
|
|
37870
37873
|
/* eslint no-proto: 0 */
|
|
37871
37874
|
var setprototypeof = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array ? setProtoOf : mixinProperties);
|
|
@@ -37900,9 +37903,9 @@ function mixinProperties (obj, proto) {
|
|
|
37900
37903
|
|
|
37901
37904
|
var deprecate = depd_1$1('http-errors');
|
|
37902
37905
|
var setPrototypeOf = setprototypeof;
|
|
37903
|
-
var statuses = statuses$
|
|
37906
|
+
var statuses = statuses$2;
|
|
37904
37907
|
var inherits = inherits$1.exports;
|
|
37905
|
-
var toIdentifier = toidentifier;
|
|
37908
|
+
var toIdentifier = toidentifier$1;
|
|
37906
37909
|
|
|
37907
37910
|
/**
|
|
37908
37911
|
* Module exports.
|
|
@@ -38150,7 +38153,7 @@ function populateConstructorExports (exports, codes, HttpError) {
|
|
|
38150
38153
|
exports["I'mateapot"] = deprecate.function(exports.ImATeapot,
|
|
38151
38154
|
'"I\'mateapot"; use "ImATeapot" instead');
|
|
38152
38155
|
}
|
|
38153
|
-
}(httpErrors));
|
|
38156
|
+
}(httpErrors$1));
|
|
38154
38157
|
|
|
38155
38158
|
var lib$5 = {exports: {}};
|
|
38156
38159
|
|
|
@@ -40180,7 +40183,7 @@ function findIdx(table, val) {
|
|
|
40180
40183
|
return l;
|
|
40181
40184
|
}
|
|
40182
40185
|
|
|
40183
|
-
var require$$0$
|
|
40186
|
+
var require$$0$2 = [
|
|
40184
40187
|
[
|
|
40185
40188
|
"0",
|
|
40186
40189
|
"\u0000",
|
|
@@ -44845,12 +44848,12 @@ var gbChars = [
|
|
|
44845
44848
|
39394,
|
|
44846
44849
|
189000
|
|
44847
44850
|
];
|
|
44848
|
-
var require$$4$
|
|
44851
|
+
var require$$4$2 = {
|
|
44849
44852
|
uChars: uChars,
|
|
44850
44853
|
gbChars: gbChars
|
|
44851
44854
|
};
|
|
44852
44855
|
|
|
44853
|
-
var require$$5
|
|
44856
|
+
var require$$5 = [
|
|
44854
44857
|
[
|
|
44855
44858
|
"0",
|
|
44856
44859
|
"\u0000",
|
|
@@ -48502,7 +48505,7 @@ var dbcsData = {
|
|
|
48502
48505
|
|
|
48503
48506
|
'shiftjis': {
|
|
48504
48507
|
type: '_dbcs',
|
|
48505
|
-
table: function() { return require$$0$
|
|
48508
|
+
table: function() { return require$$0$2 },
|
|
48506
48509
|
encodeAdd: {'\u00a5': 0x5C, '\u203E': 0x7E},
|
|
48507
48510
|
encodeSkipVals: [{from: 0xED40, to: 0xF940}],
|
|
48508
48511
|
},
|
|
@@ -48565,7 +48568,7 @@ var dbcsData = {
|
|
|
48565
48568
|
'gb18030': {
|
|
48566
48569
|
type: '_dbcs',
|
|
48567
48570
|
table: function() { return require$$2$1.concat(require$$3) },
|
|
48568
|
-
gb18030: function() { return require$$4$
|
|
48571
|
+
gb18030: function() { return require$$4$2 },
|
|
48569
48572
|
encodeSkipVals: [0x80],
|
|
48570
48573
|
encodeAdd: {'€': 0xA2E3},
|
|
48571
48574
|
},
|
|
@@ -48580,7 +48583,7 @@ var dbcsData = {
|
|
|
48580
48583
|
'949': 'cp949',
|
|
48581
48584
|
'cp949': {
|
|
48582
48585
|
type: '_dbcs',
|
|
48583
|
-
table: function() { return require$$5
|
|
48586
|
+
table: function() { return require$$5 },
|
|
48584
48587
|
},
|
|
48585
48588
|
|
|
48586
48589
|
'cseuckr': 'cp949',
|
|
@@ -49229,7 +49232,7 @@ function unpipe$1(stream) {
|
|
|
49229
49232
|
*/
|
|
49230
49233
|
|
|
49231
49234
|
var bytes = bytes$2.exports;
|
|
49232
|
-
var createError = httpErrors.exports;
|
|
49235
|
+
var createError = httpErrors$1.exports;
|
|
49233
49236
|
var iconv = lib$5.exports;
|
|
49234
49237
|
var unpipe = unpipe_1;
|
|
49235
49238
|
|
|
@@ -52956,6 +52959,541 @@ function formy(ctx, opts) {
|
|
|
52956
52959
|
});
|
|
52957
52960
|
}
|
|
52958
52961
|
|
|
52962
|
+
var httpErrors = {exports: {}};
|
|
52963
|
+
|
|
52964
|
+
var require$$0$1 = {
|
|
52965
|
+
"100": "Continue",
|
|
52966
|
+
"101": "Switching Protocols",
|
|
52967
|
+
"102": "Processing",
|
|
52968
|
+
"103": "Early Hints",
|
|
52969
|
+
"200": "OK",
|
|
52970
|
+
"201": "Created",
|
|
52971
|
+
"202": "Accepted",
|
|
52972
|
+
"203": "Non-Authoritative Information",
|
|
52973
|
+
"204": "No Content",
|
|
52974
|
+
"205": "Reset Content",
|
|
52975
|
+
"206": "Partial Content",
|
|
52976
|
+
"207": "Multi-Status",
|
|
52977
|
+
"208": "Already Reported",
|
|
52978
|
+
"226": "IM Used",
|
|
52979
|
+
"300": "Multiple Choices",
|
|
52980
|
+
"301": "Moved Permanently",
|
|
52981
|
+
"302": "Found",
|
|
52982
|
+
"303": "See Other",
|
|
52983
|
+
"304": "Not Modified",
|
|
52984
|
+
"305": "Use Proxy",
|
|
52985
|
+
"307": "Temporary Redirect",
|
|
52986
|
+
"308": "Permanent Redirect",
|
|
52987
|
+
"400": "Bad Request",
|
|
52988
|
+
"401": "Unauthorized",
|
|
52989
|
+
"402": "Payment Required",
|
|
52990
|
+
"403": "Forbidden",
|
|
52991
|
+
"404": "Not Found",
|
|
52992
|
+
"405": "Method Not Allowed",
|
|
52993
|
+
"406": "Not Acceptable",
|
|
52994
|
+
"407": "Proxy Authentication Required",
|
|
52995
|
+
"408": "Request Timeout",
|
|
52996
|
+
"409": "Conflict",
|
|
52997
|
+
"410": "Gone",
|
|
52998
|
+
"411": "Length Required",
|
|
52999
|
+
"412": "Precondition Failed",
|
|
53000
|
+
"413": "Payload Too Large",
|
|
53001
|
+
"414": "URI Too Long",
|
|
53002
|
+
"415": "Unsupported Media Type",
|
|
53003
|
+
"416": "Range Not Satisfiable",
|
|
53004
|
+
"417": "Expectation Failed",
|
|
53005
|
+
"418": "I'm a Teapot",
|
|
53006
|
+
"421": "Misdirected Request",
|
|
53007
|
+
"422": "Unprocessable Entity",
|
|
53008
|
+
"423": "Locked",
|
|
53009
|
+
"424": "Failed Dependency",
|
|
53010
|
+
"425": "Too Early",
|
|
53011
|
+
"426": "Upgrade Required",
|
|
53012
|
+
"428": "Precondition Required",
|
|
53013
|
+
"429": "Too Many Requests",
|
|
53014
|
+
"431": "Request Header Fields Too Large",
|
|
53015
|
+
"451": "Unavailable For Legal Reasons",
|
|
53016
|
+
"500": "Internal Server Error",
|
|
53017
|
+
"501": "Not Implemented",
|
|
53018
|
+
"502": "Bad Gateway",
|
|
53019
|
+
"503": "Service Unavailable",
|
|
53020
|
+
"504": "Gateway Timeout",
|
|
53021
|
+
"505": "HTTP Version Not Supported",
|
|
53022
|
+
"506": "Variant Also Negotiates",
|
|
53023
|
+
"507": "Insufficient Storage",
|
|
53024
|
+
"508": "Loop Detected",
|
|
53025
|
+
"509": "Bandwidth Limit Exceeded",
|
|
53026
|
+
"510": "Not Extended",
|
|
53027
|
+
"511": "Network Authentication Required"
|
|
53028
|
+
};
|
|
53029
|
+
|
|
53030
|
+
/*!
|
|
53031
|
+
* statuses
|
|
53032
|
+
* Copyright(c) 2014 Jonathan Ong
|
|
53033
|
+
* Copyright(c) 2016 Douglas Christopher Wilson
|
|
53034
|
+
* MIT Licensed
|
|
53035
|
+
*/
|
|
53036
|
+
|
|
53037
|
+
/**
|
|
53038
|
+
* Module dependencies.
|
|
53039
|
+
* @private
|
|
53040
|
+
*/
|
|
53041
|
+
|
|
53042
|
+
var codes = require$$0$1;
|
|
53043
|
+
|
|
53044
|
+
/**
|
|
53045
|
+
* Module exports.
|
|
53046
|
+
* @public
|
|
53047
|
+
*/
|
|
53048
|
+
|
|
53049
|
+
var statuses = status;
|
|
53050
|
+
|
|
53051
|
+
// status code to message map
|
|
53052
|
+
status.message = codes;
|
|
53053
|
+
|
|
53054
|
+
// status message (lower-case) to code map
|
|
53055
|
+
status.code = createMessageToStatusCodeMap(codes);
|
|
53056
|
+
|
|
53057
|
+
// array of status codes
|
|
53058
|
+
status.codes = createStatusCodeList(codes);
|
|
53059
|
+
|
|
53060
|
+
// status codes for redirects
|
|
53061
|
+
status.redirect = {
|
|
53062
|
+
300: true,
|
|
53063
|
+
301: true,
|
|
53064
|
+
302: true,
|
|
53065
|
+
303: true,
|
|
53066
|
+
305: true,
|
|
53067
|
+
307: true,
|
|
53068
|
+
308: true
|
|
53069
|
+
};
|
|
53070
|
+
|
|
53071
|
+
// status codes for empty bodies
|
|
53072
|
+
status.empty = {
|
|
53073
|
+
204: true,
|
|
53074
|
+
205: true,
|
|
53075
|
+
304: true
|
|
53076
|
+
};
|
|
53077
|
+
|
|
53078
|
+
// status codes for when you should retry the request
|
|
53079
|
+
status.retry = {
|
|
53080
|
+
502: true,
|
|
53081
|
+
503: true,
|
|
53082
|
+
504: true
|
|
53083
|
+
};
|
|
53084
|
+
|
|
53085
|
+
/**
|
|
53086
|
+
* Create a map of message to status code.
|
|
53087
|
+
* @private
|
|
53088
|
+
*/
|
|
53089
|
+
|
|
53090
|
+
function createMessageToStatusCodeMap (codes) {
|
|
53091
|
+
var map = {};
|
|
53092
|
+
|
|
53093
|
+
Object.keys(codes).forEach(function forEachCode (code) {
|
|
53094
|
+
var message = codes[code];
|
|
53095
|
+
var status = Number(code);
|
|
53096
|
+
|
|
53097
|
+
// populate map
|
|
53098
|
+
map[message.toLowerCase()] = status;
|
|
53099
|
+
});
|
|
53100
|
+
|
|
53101
|
+
return map
|
|
53102
|
+
}
|
|
53103
|
+
|
|
53104
|
+
/**
|
|
53105
|
+
* Create a list of all status codes.
|
|
53106
|
+
* @private
|
|
53107
|
+
*/
|
|
53108
|
+
|
|
53109
|
+
function createStatusCodeList (codes) {
|
|
53110
|
+
return Object.keys(codes).map(function mapCode (code) {
|
|
53111
|
+
return Number(code)
|
|
53112
|
+
})
|
|
53113
|
+
}
|
|
53114
|
+
|
|
53115
|
+
/**
|
|
53116
|
+
* Get the status code for given message.
|
|
53117
|
+
* @private
|
|
53118
|
+
*/
|
|
53119
|
+
|
|
53120
|
+
function getStatusCode (message) {
|
|
53121
|
+
var msg = message.toLowerCase();
|
|
53122
|
+
|
|
53123
|
+
if (!Object.prototype.hasOwnProperty.call(status.code, msg)) {
|
|
53124
|
+
throw new Error('invalid status message: "' + message + '"')
|
|
53125
|
+
}
|
|
53126
|
+
|
|
53127
|
+
return status.code[msg]
|
|
53128
|
+
}
|
|
53129
|
+
|
|
53130
|
+
/**
|
|
53131
|
+
* Get the status message for given code.
|
|
53132
|
+
* @private
|
|
53133
|
+
*/
|
|
53134
|
+
|
|
53135
|
+
function getStatusMessage (code) {
|
|
53136
|
+
if (!Object.prototype.hasOwnProperty.call(status.message, code)) {
|
|
53137
|
+
throw new Error('invalid status code: ' + code)
|
|
53138
|
+
}
|
|
53139
|
+
|
|
53140
|
+
return status.message[code]
|
|
53141
|
+
}
|
|
53142
|
+
|
|
53143
|
+
/**
|
|
53144
|
+
* Get the status code.
|
|
53145
|
+
*
|
|
53146
|
+
* Given a number, this will throw if it is not a known status
|
|
53147
|
+
* code, otherwise the code will be returned. Given a string,
|
|
53148
|
+
* the string will be parsed for a number and return the code
|
|
53149
|
+
* if valid, otherwise will lookup the code assuming this is
|
|
53150
|
+
* the status message.
|
|
53151
|
+
*
|
|
53152
|
+
* @param {string|number} code
|
|
53153
|
+
* @returns {number}
|
|
53154
|
+
* @public
|
|
53155
|
+
*/
|
|
53156
|
+
|
|
53157
|
+
function status (code) {
|
|
53158
|
+
if (typeof code === 'number') {
|
|
53159
|
+
return getStatusMessage(code)
|
|
53160
|
+
}
|
|
53161
|
+
|
|
53162
|
+
if (typeof code !== 'string') {
|
|
53163
|
+
throw new TypeError('code must be a number or string')
|
|
53164
|
+
}
|
|
53165
|
+
|
|
53166
|
+
// '403'
|
|
53167
|
+
var n = parseInt(code, 10);
|
|
53168
|
+
if (!isNaN(n)) {
|
|
53169
|
+
return getStatusMessage(n)
|
|
53170
|
+
}
|
|
53171
|
+
|
|
53172
|
+
return getStatusCode(code)
|
|
53173
|
+
}
|
|
53174
|
+
|
|
53175
|
+
/*!
|
|
53176
|
+
* toidentifier
|
|
53177
|
+
* Copyright(c) 2016 Douglas Christopher Wilson
|
|
53178
|
+
* MIT Licensed
|
|
53179
|
+
*/
|
|
53180
|
+
|
|
53181
|
+
/**
|
|
53182
|
+
* Module exports.
|
|
53183
|
+
* @public
|
|
53184
|
+
*/
|
|
53185
|
+
|
|
53186
|
+
var toidentifier = toIdentifier;
|
|
53187
|
+
|
|
53188
|
+
/**
|
|
53189
|
+
* Trasform the given string into a JavaScript identifier
|
|
53190
|
+
*
|
|
53191
|
+
* @param {string} str
|
|
53192
|
+
* @returns {string}
|
|
53193
|
+
* @public
|
|
53194
|
+
*/
|
|
53195
|
+
|
|
53196
|
+
function toIdentifier (str) {
|
|
53197
|
+
return str
|
|
53198
|
+
.split(' ')
|
|
53199
|
+
.map(function (token) {
|
|
53200
|
+
return token.slice(0, 1).toUpperCase() + token.slice(1)
|
|
53201
|
+
})
|
|
53202
|
+
.join('')
|
|
53203
|
+
.replace(/[^ _0-9a-z]/gi, '')
|
|
53204
|
+
}
|
|
53205
|
+
|
|
53206
|
+
/*!
|
|
53207
|
+
* http-errors
|
|
53208
|
+
* Copyright(c) 2014 Jonathan Ong
|
|
53209
|
+
* Copyright(c) 2016 Douglas Christopher Wilson
|
|
53210
|
+
* MIT Licensed
|
|
53211
|
+
*/
|
|
53212
|
+
|
|
53213
|
+
(function (module) {
|
|
53214
|
+
|
|
53215
|
+
/**
|
|
53216
|
+
* Module dependencies.
|
|
53217
|
+
* @private
|
|
53218
|
+
*/
|
|
53219
|
+
|
|
53220
|
+
var deprecate = depd_1('http-errors');
|
|
53221
|
+
var setPrototypeOf = setprototypeof$2;
|
|
53222
|
+
var statuses$1 = statuses;
|
|
53223
|
+
var inherits = inherits$1.exports;
|
|
53224
|
+
var toIdentifier = toidentifier;
|
|
53225
|
+
|
|
53226
|
+
/**
|
|
53227
|
+
* Module exports.
|
|
53228
|
+
* @public
|
|
53229
|
+
*/
|
|
53230
|
+
|
|
53231
|
+
module.exports = createError;
|
|
53232
|
+
module.exports.HttpError = createHttpErrorConstructor();
|
|
53233
|
+
module.exports.isHttpError = createIsHttpErrorFunction(module.exports.HttpError);
|
|
53234
|
+
|
|
53235
|
+
// Populate exports for all constructors
|
|
53236
|
+
populateConstructorExports(module.exports, statuses$1.codes, module.exports.HttpError);
|
|
53237
|
+
|
|
53238
|
+
/**
|
|
53239
|
+
* Get the code class of a status code.
|
|
53240
|
+
* @private
|
|
53241
|
+
*/
|
|
53242
|
+
|
|
53243
|
+
function codeClass (status) {
|
|
53244
|
+
return Number(String(status).charAt(0) + '00')
|
|
53245
|
+
}
|
|
53246
|
+
|
|
53247
|
+
/**
|
|
53248
|
+
* Create a new HTTP Error.
|
|
53249
|
+
*
|
|
53250
|
+
* @returns {Error}
|
|
53251
|
+
* @public
|
|
53252
|
+
*/
|
|
53253
|
+
|
|
53254
|
+
function createError () {
|
|
53255
|
+
// so much arity going on ~_~
|
|
53256
|
+
var err;
|
|
53257
|
+
var msg;
|
|
53258
|
+
var status = 500;
|
|
53259
|
+
var props = {};
|
|
53260
|
+
for (var i = 0; i < arguments.length; i++) {
|
|
53261
|
+
var arg = arguments[i];
|
|
53262
|
+
var type = typeof arg;
|
|
53263
|
+
if (type === 'object' && arg instanceof Error) {
|
|
53264
|
+
err = arg;
|
|
53265
|
+
status = err.status || err.statusCode || status;
|
|
53266
|
+
} else if (type === 'number' && i === 0) {
|
|
53267
|
+
status = arg;
|
|
53268
|
+
} else if (type === 'string') {
|
|
53269
|
+
msg = arg;
|
|
53270
|
+
} else if (type === 'object') {
|
|
53271
|
+
props = arg;
|
|
53272
|
+
} else {
|
|
53273
|
+
throw new TypeError('argument #' + (i + 1) + ' unsupported type ' + type)
|
|
53274
|
+
}
|
|
53275
|
+
}
|
|
53276
|
+
|
|
53277
|
+
if (typeof status === 'number' && (status < 400 || status >= 600)) {
|
|
53278
|
+
deprecate('non-error status code; use only 4xx or 5xx status codes');
|
|
53279
|
+
}
|
|
53280
|
+
|
|
53281
|
+
if (typeof status !== 'number' ||
|
|
53282
|
+
(!statuses$1.message[status] && (status < 400 || status >= 600))) {
|
|
53283
|
+
status = 500;
|
|
53284
|
+
}
|
|
53285
|
+
|
|
53286
|
+
// constructor
|
|
53287
|
+
var HttpError = createError[status] || createError[codeClass(status)];
|
|
53288
|
+
|
|
53289
|
+
if (!err) {
|
|
53290
|
+
// create error
|
|
53291
|
+
err = HttpError
|
|
53292
|
+
? new HttpError(msg)
|
|
53293
|
+
: new Error(msg || statuses$1.message[status]);
|
|
53294
|
+
Error.captureStackTrace(err, createError);
|
|
53295
|
+
}
|
|
53296
|
+
|
|
53297
|
+
if (!HttpError || !(err instanceof HttpError) || err.status !== status) {
|
|
53298
|
+
// add properties to generic error
|
|
53299
|
+
err.expose = status < 500;
|
|
53300
|
+
err.status = err.statusCode = status;
|
|
53301
|
+
}
|
|
53302
|
+
|
|
53303
|
+
for (var key in props) {
|
|
53304
|
+
if (key !== 'status' && key !== 'statusCode') {
|
|
53305
|
+
err[key] = props[key];
|
|
53306
|
+
}
|
|
53307
|
+
}
|
|
53308
|
+
|
|
53309
|
+
return err
|
|
53310
|
+
}
|
|
53311
|
+
|
|
53312
|
+
/**
|
|
53313
|
+
* Create HTTP error abstract base class.
|
|
53314
|
+
* @private
|
|
53315
|
+
*/
|
|
53316
|
+
|
|
53317
|
+
function createHttpErrorConstructor () {
|
|
53318
|
+
function HttpError () {
|
|
53319
|
+
throw new TypeError('cannot construct abstract class')
|
|
53320
|
+
}
|
|
53321
|
+
|
|
53322
|
+
inherits(HttpError, Error);
|
|
53323
|
+
|
|
53324
|
+
return HttpError
|
|
53325
|
+
}
|
|
53326
|
+
|
|
53327
|
+
/**
|
|
53328
|
+
* Create a constructor for a client error.
|
|
53329
|
+
* @private
|
|
53330
|
+
*/
|
|
53331
|
+
|
|
53332
|
+
function createClientErrorConstructor (HttpError, name, code) {
|
|
53333
|
+
var className = toClassName(name);
|
|
53334
|
+
|
|
53335
|
+
function ClientError (message) {
|
|
53336
|
+
// create the error object
|
|
53337
|
+
var msg = message != null ? message : statuses$1.message[code];
|
|
53338
|
+
var err = new Error(msg);
|
|
53339
|
+
|
|
53340
|
+
// capture a stack trace to the construction point
|
|
53341
|
+
Error.captureStackTrace(err, ClientError);
|
|
53342
|
+
|
|
53343
|
+
// adjust the [[Prototype]]
|
|
53344
|
+
setPrototypeOf(err, ClientError.prototype);
|
|
53345
|
+
|
|
53346
|
+
// redefine the error message
|
|
53347
|
+
Object.defineProperty(err, 'message', {
|
|
53348
|
+
enumerable: true,
|
|
53349
|
+
configurable: true,
|
|
53350
|
+
value: msg,
|
|
53351
|
+
writable: true
|
|
53352
|
+
});
|
|
53353
|
+
|
|
53354
|
+
// redefine the error name
|
|
53355
|
+
Object.defineProperty(err, 'name', {
|
|
53356
|
+
enumerable: false,
|
|
53357
|
+
configurable: true,
|
|
53358
|
+
value: className,
|
|
53359
|
+
writable: true
|
|
53360
|
+
});
|
|
53361
|
+
|
|
53362
|
+
return err
|
|
53363
|
+
}
|
|
53364
|
+
|
|
53365
|
+
inherits(ClientError, HttpError);
|
|
53366
|
+
nameFunc(ClientError, className);
|
|
53367
|
+
|
|
53368
|
+
ClientError.prototype.status = code;
|
|
53369
|
+
ClientError.prototype.statusCode = code;
|
|
53370
|
+
ClientError.prototype.expose = true;
|
|
53371
|
+
|
|
53372
|
+
return ClientError
|
|
53373
|
+
}
|
|
53374
|
+
|
|
53375
|
+
/**
|
|
53376
|
+
* Create function to test is a value is a HttpError.
|
|
53377
|
+
* @private
|
|
53378
|
+
*/
|
|
53379
|
+
|
|
53380
|
+
function createIsHttpErrorFunction (HttpError) {
|
|
53381
|
+
return function isHttpError (val) {
|
|
53382
|
+
if (!val || typeof val !== 'object') {
|
|
53383
|
+
return false
|
|
53384
|
+
}
|
|
53385
|
+
|
|
53386
|
+
if (val instanceof HttpError) {
|
|
53387
|
+
return true
|
|
53388
|
+
}
|
|
53389
|
+
|
|
53390
|
+
return val instanceof Error &&
|
|
53391
|
+
typeof val.expose === 'boolean' &&
|
|
53392
|
+
typeof val.statusCode === 'number' && val.status === val.statusCode
|
|
53393
|
+
}
|
|
53394
|
+
}
|
|
53395
|
+
|
|
53396
|
+
/**
|
|
53397
|
+
* Create a constructor for a server error.
|
|
53398
|
+
* @private
|
|
53399
|
+
*/
|
|
53400
|
+
|
|
53401
|
+
function createServerErrorConstructor (HttpError, name, code) {
|
|
53402
|
+
var className = toClassName(name);
|
|
53403
|
+
|
|
53404
|
+
function ServerError (message) {
|
|
53405
|
+
// create the error object
|
|
53406
|
+
var msg = message != null ? message : statuses$1.message[code];
|
|
53407
|
+
var err = new Error(msg);
|
|
53408
|
+
|
|
53409
|
+
// capture a stack trace to the construction point
|
|
53410
|
+
Error.captureStackTrace(err, ServerError);
|
|
53411
|
+
|
|
53412
|
+
// adjust the [[Prototype]]
|
|
53413
|
+
setPrototypeOf(err, ServerError.prototype);
|
|
53414
|
+
|
|
53415
|
+
// redefine the error message
|
|
53416
|
+
Object.defineProperty(err, 'message', {
|
|
53417
|
+
enumerable: true,
|
|
53418
|
+
configurable: true,
|
|
53419
|
+
value: msg,
|
|
53420
|
+
writable: true
|
|
53421
|
+
});
|
|
53422
|
+
|
|
53423
|
+
// redefine the error name
|
|
53424
|
+
Object.defineProperty(err, 'name', {
|
|
53425
|
+
enumerable: false,
|
|
53426
|
+
configurable: true,
|
|
53427
|
+
value: className,
|
|
53428
|
+
writable: true
|
|
53429
|
+
});
|
|
53430
|
+
|
|
53431
|
+
return err
|
|
53432
|
+
}
|
|
53433
|
+
|
|
53434
|
+
inherits(ServerError, HttpError);
|
|
53435
|
+
nameFunc(ServerError, className);
|
|
53436
|
+
|
|
53437
|
+
ServerError.prototype.status = code;
|
|
53438
|
+
ServerError.prototype.statusCode = code;
|
|
53439
|
+
ServerError.prototype.expose = false;
|
|
53440
|
+
|
|
53441
|
+
return ServerError
|
|
53442
|
+
}
|
|
53443
|
+
|
|
53444
|
+
/**
|
|
53445
|
+
* Set the name of a function, if possible.
|
|
53446
|
+
* @private
|
|
53447
|
+
*/
|
|
53448
|
+
|
|
53449
|
+
function nameFunc (func, name) {
|
|
53450
|
+
var desc = Object.getOwnPropertyDescriptor(func, 'name');
|
|
53451
|
+
|
|
53452
|
+
if (desc && desc.configurable) {
|
|
53453
|
+
desc.value = name;
|
|
53454
|
+
Object.defineProperty(func, 'name', desc);
|
|
53455
|
+
}
|
|
53456
|
+
}
|
|
53457
|
+
|
|
53458
|
+
/**
|
|
53459
|
+
* Populate the exports object with constructors for every error class.
|
|
53460
|
+
* @private
|
|
53461
|
+
*/
|
|
53462
|
+
|
|
53463
|
+
function populateConstructorExports (exports, codes, HttpError) {
|
|
53464
|
+
codes.forEach(function forEachCode (code) {
|
|
53465
|
+
var CodeError;
|
|
53466
|
+
var name = toIdentifier(statuses$1.message[code]);
|
|
53467
|
+
|
|
53468
|
+
switch (codeClass(code)) {
|
|
53469
|
+
case 400:
|
|
53470
|
+
CodeError = createClientErrorConstructor(HttpError, name, code);
|
|
53471
|
+
break
|
|
53472
|
+
case 500:
|
|
53473
|
+
CodeError = createServerErrorConstructor(HttpError, name, code);
|
|
53474
|
+
break
|
|
53475
|
+
}
|
|
53476
|
+
|
|
53477
|
+
if (CodeError) {
|
|
53478
|
+
// export the constructor
|
|
53479
|
+
exports[code] = CodeError;
|
|
53480
|
+
exports[name] = CodeError;
|
|
53481
|
+
}
|
|
53482
|
+
});
|
|
53483
|
+
}
|
|
53484
|
+
|
|
53485
|
+
/**
|
|
53486
|
+
* Get a class name from a name identifier.
|
|
53487
|
+
* @private
|
|
53488
|
+
*/
|
|
53489
|
+
|
|
53490
|
+
function toClassName (name) {
|
|
53491
|
+
return name.substr(-5) !== 'Error'
|
|
53492
|
+
? name + 'Error'
|
|
53493
|
+
: name
|
|
53494
|
+
}
|
|
53495
|
+
}(httpErrors));
|
|
53496
|
+
|
|
52959
53497
|
/*!
|
|
52960
53498
|
* methods
|
|
52961
53499
|
* Copyright(c) 2013-2014 TJ Holowaychuk
|
|
@@ -53068,7 +53606,7 @@ function lexer(str) {
|
|
|
53068
53606
|
break;
|
|
53069
53607
|
}
|
|
53070
53608
|
if (!name)
|
|
53071
|
-
throw new TypeError("Missing parameter name at "
|
|
53609
|
+
throw new TypeError("Missing parameter name at ".concat(i));
|
|
53072
53610
|
tokens.push({ type: "NAME", index: i, value: name });
|
|
53073
53611
|
i = j;
|
|
53074
53612
|
continue;
|
|
@@ -53078,7 +53616,7 @@ function lexer(str) {
|
|
|
53078
53616
|
var pattern = "";
|
|
53079
53617
|
var j = i + 1;
|
|
53080
53618
|
if (str[j] === "?") {
|
|
53081
|
-
throw new TypeError("Pattern cannot start with \"?\" at "
|
|
53619
|
+
throw new TypeError("Pattern cannot start with \"?\" at ".concat(j));
|
|
53082
53620
|
}
|
|
53083
53621
|
while (j < str.length) {
|
|
53084
53622
|
if (str[j] === "\\") {
|
|
@@ -53095,15 +53633,15 @@ function lexer(str) {
|
|
|
53095
53633
|
else if (str[j] === "(") {
|
|
53096
53634
|
count++;
|
|
53097
53635
|
if (str[j + 1] !== "?") {
|
|
53098
|
-
throw new TypeError("Capturing groups are not allowed at "
|
|
53636
|
+
throw new TypeError("Capturing groups are not allowed at ".concat(j));
|
|
53099
53637
|
}
|
|
53100
53638
|
}
|
|
53101
53639
|
pattern += str[j++];
|
|
53102
53640
|
}
|
|
53103
53641
|
if (count)
|
|
53104
|
-
throw new TypeError("Unbalanced pattern at "
|
|
53642
|
+
throw new TypeError("Unbalanced pattern at ".concat(i));
|
|
53105
53643
|
if (!pattern)
|
|
53106
|
-
throw new TypeError("Missing pattern at "
|
|
53644
|
+
throw new TypeError("Missing pattern at ".concat(i));
|
|
53107
53645
|
tokens.push({ type: "PATTERN", index: i, value: pattern });
|
|
53108
53646
|
i = j;
|
|
53109
53647
|
continue;
|
|
@@ -53120,7 +53658,7 @@ function parse$4(str, options) {
|
|
|
53120
53658
|
if (options === void 0) { options = {}; }
|
|
53121
53659
|
var tokens = lexer(str);
|
|
53122
53660
|
var _a = options.prefixes, prefixes = _a === void 0 ? "./" : _a;
|
|
53123
|
-
var defaultPattern = "[^"
|
|
53661
|
+
var defaultPattern = "[^".concat(escapeString(options.delimiter || "/#?"), "]+?");
|
|
53124
53662
|
var result = [];
|
|
53125
53663
|
var key = 0;
|
|
53126
53664
|
var i = 0;
|
|
@@ -53134,12 +53672,11 @@ function parse$4(str, options) {
|
|
|
53134
53672
|
if (value !== undefined)
|
|
53135
53673
|
return value;
|
|
53136
53674
|
var _a = tokens[i], nextType = _a.type, index = _a.index;
|
|
53137
|
-
throw new TypeError("Unexpected "
|
|
53675
|
+
throw new TypeError("Unexpected ".concat(nextType, " at ").concat(index, ", expected ").concat(type));
|
|
53138
53676
|
};
|
|
53139
53677
|
var consumeText = function () {
|
|
53140
53678
|
var result = "";
|
|
53141
53679
|
var value;
|
|
53142
|
-
// tslint:disable-next-line
|
|
53143
53680
|
while ((value = tryConsume("CHAR") || tryConsume("ESCAPED_CHAR"))) {
|
|
53144
53681
|
result += value;
|
|
53145
53682
|
}
|
|
@@ -53164,7 +53701,7 @@ function parse$4(str, options) {
|
|
|
53164
53701
|
prefix: prefix,
|
|
53165
53702
|
suffix: "",
|
|
53166
53703
|
pattern: pattern || defaultPattern,
|
|
53167
|
-
modifier: tryConsume("MODIFIER") || ""
|
|
53704
|
+
modifier: tryConsume("MODIFIER") || "",
|
|
53168
53705
|
});
|
|
53169
53706
|
continue;
|
|
53170
53707
|
}
|
|
@@ -53189,7 +53726,7 @@ function parse$4(str, options) {
|
|
|
53189
53726
|
pattern: name_1 && !pattern_1 ? defaultPattern : pattern_1,
|
|
53190
53727
|
prefix: prefix,
|
|
53191
53728
|
suffix: suffix,
|
|
53192
|
-
modifier: tryConsume("MODIFIER") || ""
|
|
53729
|
+
modifier: tryConsume("MODIFIER") || "",
|
|
53193
53730
|
});
|
|
53194
53731
|
continue;
|
|
53195
53732
|
}
|
|
@@ -53213,7 +53750,7 @@ function tokensToFunction(tokens, options) {
|
|
|
53213
53750
|
// Compile all the tokens into regexps.
|
|
53214
53751
|
var matches = tokens.map(function (token) {
|
|
53215
53752
|
if (typeof token === "object") {
|
|
53216
|
-
return new RegExp("^(?:"
|
|
53753
|
+
return new RegExp("^(?:".concat(token.pattern, ")$"), reFlags);
|
|
53217
53754
|
}
|
|
53218
53755
|
});
|
|
53219
53756
|
return function (data) {
|
|
@@ -53229,17 +53766,17 @@ function tokensToFunction(tokens, options) {
|
|
|
53229
53766
|
var repeat = token.modifier === "*" || token.modifier === "+";
|
|
53230
53767
|
if (Array.isArray(value)) {
|
|
53231
53768
|
if (!repeat) {
|
|
53232
|
-
throw new TypeError("Expected \""
|
|
53769
|
+
throw new TypeError("Expected \"".concat(token.name, "\" to not repeat, but got an array"));
|
|
53233
53770
|
}
|
|
53234
53771
|
if (value.length === 0) {
|
|
53235
53772
|
if (optional)
|
|
53236
53773
|
continue;
|
|
53237
|
-
throw new TypeError("Expected \""
|
|
53774
|
+
throw new TypeError("Expected \"".concat(token.name, "\" to not be empty"));
|
|
53238
53775
|
}
|
|
53239
53776
|
for (var j = 0; j < value.length; j++) {
|
|
53240
53777
|
var segment = encode(value[j], token);
|
|
53241
53778
|
if (validate && !matches[i].test(segment)) {
|
|
53242
|
-
throw new TypeError("Expected all \""
|
|
53779
|
+
throw new TypeError("Expected all \"".concat(token.name, "\" to match \"").concat(token.pattern, "\", but got \"").concat(segment, "\""));
|
|
53243
53780
|
}
|
|
53244
53781
|
path += token.prefix + segment + token.suffix;
|
|
53245
53782
|
}
|
|
@@ -53248,7 +53785,7 @@ function tokensToFunction(tokens, options) {
|
|
|
53248
53785
|
if (typeof value === "string" || typeof value === "number") {
|
|
53249
53786
|
var segment = encode(String(value), token);
|
|
53250
53787
|
if (validate && !matches[i].test(segment)) {
|
|
53251
|
-
throw new TypeError("Expected \""
|
|
53788
|
+
throw new TypeError("Expected \"".concat(token.name, "\" to match \"").concat(token.pattern, "\", but got \"").concat(segment, "\""));
|
|
53252
53789
|
}
|
|
53253
53790
|
path += token.prefix + segment + token.suffix;
|
|
53254
53791
|
continue;
|
|
@@ -53256,7 +53793,7 @@ function tokensToFunction(tokens, options) {
|
|
|
53256
53793
|
if (optional)
|
|
53257
53794
|
continue;
|
|
53258
53795
|
var typeOfMessage = repeat ? "an array" : "a string";
|
|
53259
|
-
throw new TypeError("Expected \""
|
|
53796
|
+
throw new TypeError("Expected \"".concat(token.name, "\" to be ").concat(typeOfMessage));
|
|
53260
53797
|
}
|
|
53261
53798
|
return path;
|
|
53262
53799
|
};
|
|
@@ -53282,7 +53819,6 @@ function regexpToFunction(re, keys, options) {
|
|
|
53282
53819
|
var path = m[0], index = m.index;
|
|
53283
53820
|
var params = Object.create(null);
|
|
53284
53821
|
var _loop_1 = function (i) {
|
|
53285
|
-
// tslint:disable-next-line
|
|
53286
53822
|
if (m[i] === undefined)
|
|
53287
53823
|
return "continue";
|
|
53288
53824
|
var key = keys[i - 1];
|
|
@@ -53329,7 +53865,7 @@ function regexpToRegexp(path, keys) {
|
|
|
53329
53865
|
prefix: "",
|
|
53330
53866
|
suffix: "",
|
|
53331
53867
|
modifier: "",
|
|
53332
|
-
pattern: ""
|
|
53868
|
+
pattern: "",
|
|
53333
53869
|
});
|
|
53334
53870
|
execResult = groupsRegex.exec(path.source);
|
|
53335
53871
|
}
|
|
@@ -53340,7 +53876,7 @@ function regexpToRegexp(path, keys) {
|
|
|
53340
53876
|
*/
|
|
53341
53877
|
function arrayToRegexp(paths, keys, options) {
|
|
53342
53878
|
var parts = paths.map(function (path) { return pathToRegexp$2(path, keys, options).source; });
|
|
53343
|
-
return new RegExp("(?:"
|
|
53879
|
+
return new RegExp("(?:".concat(parts.join("|"), ")"), flags(options));
|
|
53344
53880
|
}
|
|
53345
53881
|
/**
|
|
53346
53882
|
* Create a path regexp from string input.
|
|
@@ -53353,9 +53889,9 @@ function stringToRegexp(path, keys, options) {
|
|
|
53353
53889
|
*/
|
|
53354
53890
|
function tokensToRegexp(tokens, keys, options) {
|
|
53355
53891
|
if (options === void 0) { options = {}; }
|
|
53356
|
-
var _a = options.strict, strict = _a === void 0 ? false : _a, _b = options.start, start = _b === void 0 ? true : _b, _c = options.end, end = _c === void 0 ? true : _c, _d = options.encode, encode = _d === void 0 ? function (x) { return x; } : _d;
|
|
53357
|
-
var
|
|
53358
|
-
var
|
|
53892
|
+
var _a = options.strict, strict = _a === void 0 ? false : _a, _b = options.start, start = _b === void 0 ? true : _b, _c = options.end, end = _c === void 0 ? true : _c, _d = options.encode, encode = _d === void 0 ? function (x) { return x; } : _d, _e = options.delimiter, delimiter = _e === void 0 ? "/#?" : _e, _f = options.endsWith, endsWith = _f === void 0 ? "" : _f;
|
|
53893
|
+
var endsWithRe = "[".concat(escapeString(endsWith), "]|$");
|
|
53894
|
+
var delimiterRe = "[".concat(escapeString(delimiter), "]");
|
|
53359
53895
|
var route = start ? "^" : "";
|
|
53360
53896
|
// Iterate over the tokens and create our regexp string.
|
|
53361
53897
|
for (var _i = 0, tokens_1 = tokens; _i < tokens_1.length; _i++) {
|
|
@@ -53372,37 +53908,41 @@ function tokensToRegexp(tokens, keys, options) {
|
|
|
53372
53908
|
if (prefix || suffix) {
|
|
53373
53909
|
if (token.modifier === "+" || token.modifier === "*") {
|
|
53374
53910
|
var mod = token.modifier === "*" ? "?" : "";
|
|
53375
|
-
route += "(?:"
|
|
53911
|
+
route += "(?:".concat(prefix, "((?:").concat(token.pattern, ")(?:").concat(suffix).concat(prefix, "(?:").concat(token.pattern, "))*)").concat(suffix, ")").concat(mod);
|
|
53376
53912
|
}
|
|
53377
53913
|
else {
|
|
53378
|
-
route += "(?:"
|
|
53914
|
+
route += "(?:".concat(prefix, "(").concat(token.pattern, ")").concat(suffix, ")").concat(token.modifier);
|
|
53379
53915
|
}
|
|
53380
53916
|
}
|
|
53381
53917
|
else {
|
|
53382
|
-
|
|
53918
|
+
if (token.modifier === "+" || token.modifier === "*") {
|
|
53919
|
+
route += "((?:".concat(token.pattern, ")").concat(token.modifier, ")");
|
|
53920
|
+
}
|
|
53921
|
+
else {
|
|
53922
|
+
route += "(".concat(token.pattern, ")").concat(token.modifier);
|
|
53923
|
+
}
|
|
53383
53924
|
}
|
|
53384
53925
|
}
|
|
53385
53926
|
else {
|
|
53386
|
-
route += "(?:"
|
|
53927
|
+
route += "(?:".concat(prefix).concat(suffix, ")").concat(token.modifier);
|
|
53387
53928
|
}
|
|
53388
53929
|
}
|
|
53389
53930
|
}
|
|
53390
53931
|
if (end) {
|
|
53391
53932
|
if (!strict)
|
|
53392
|
-
route +=
|
|
53393
|
-
route += !options.endsWith ? "$" : "(?="
|
|
53933
|
+
route += "".concat(delimiterRe, "?");
|
|
53934
|
+
route += !options.endsWith ? "$" : "(?=".concat(endsWithRe, ")");
|
|
53394
53935
|
}
|
|
53395
53936
|
else {
|
|
53396
53937
|
var endToken = tokens[tokens.length - 1];
|
|
53397
53938
|
var isEndDelimited = typeof endToken === "string"
|
|
53398
|
-
?
|
|
53399
|
-
:
|
|
53400
|
-
endToken === undefined;
|
|
53939
|
+
? delimiterRe.indexOf(endToken[endToken.length - 1]) > -1
|
|
53940
|
+
: endToken === undefined;
|
|
53401
53941
|
if (!strict) {
|
|
53402
|
-
route += "(?:"
|
|
53942
|
+
route += "(?:".concat(delimiterRe, "(?=").concat(endsWithRe, "))?");
|
|
53403
53943
|
}
|
|
53404
53944
|
if (!isEndDelimited) {
|
|
53405
|
-
route += "(?="
|
|
53945
|
+
route += "(?=".concat(delimiterRe, "|").concat(endsWithRe, ")");
|
|
53406
53946
|
}
|
|
53407
53947
|
}
|
|
53408
53948
|
return new RegExp(route, flags(options));
|
|
@@ -53433,10 +53973,10 @@ var dist_es2015 = /*#__PURE__*/Object.freeze({
|
|
|
53433
53973
|
pathToRegexp: pathToRegexp$2
|
|
53434
53974
|
});
|
|
53435
53975
|
|
|
53436
|
-
var require$$
|
|
53976
|
+
var require$$4$1 = /*@__PURE__*/getAugmentedNamespace(dist_es2015);
|
|
53437
53977
|
|
|
53438
|
-
const { pathToRegexp: pathToRegexp$1, compile, parse: parse$3 } = require$$5;
|
|
53439
53978
|
const { parse: parseUrl, format: formatUrl } = require$$0__default$5["default"];
|
|
53979
|
+
const { pathToRegexp: pathToRegexp$1, compile, parse: parse$3 } = require$$4$1;
|
|
53440
53980
|
|
|
53441
53981
|
var layer = Layer$1;
|
|
53442
53982
|
|
|
@@ -53454,31 +53994,34 @@ var layer = Layer$1;
|
|
|
53454
53994
|
* @private
|
|
53455
53995
|
*/
|
|
53456
53996
|
|
|
53457
|
-
function Layer$1(path, methods, middleware, opts) {
|
|
53458
|
-
this.opts = opts
|
|
53997
|
+
function Layer$1(path, methods, middleware, opts = {}) {
|
|
53998
|
+
this.opts = opts;
|
|
53459
53999
|
this.name = this.opts.name || null;
|
|
53460
54000
|
this.methods = [];
|
|
53461
54001
|
this.paramNames = [];
|
|
53462
54002
|
this.stack = Array.isArray(middleware) ? middleware : [middleware];
|
|
53463
54003
|
|
|
53464
|
-
for (
|
|
53465
|
-
const l = this.methods.push(
|
|
54004
|
+
for (const method of methods) {
|
|
54005
|
+
const l = this.methods.push(method.toUpperCase());
|
|
53466
54006
|
if (this.methods[l - 1] === 'GET') this.methods.unshift('HEAD');
|
|
53467
54007
|
}
|
|
53468
54008
|
|
|
53469
54009
|
// ensure middleware is a function
|
|
53470
54010
|
for (let i = 0; i < this.stack.length; i++) {
|
|
53471
54011
|
const fn = this.stack[i];
|
|
53472
|
-
const type =
|
|
54012
|
+
const type = typeof fn;
|
|
53473
54013
|
if (type !== 'function')
|
|
53474
54014
|
throw new Error(
|
|
53475
|
-
`${methods.toString()} \`${
|
|
54015
|
+
`${methods.toString()} \`${
|
|
54016
|
+
this.opts.name || path
|
|
54017
|
+
}\`: \`middleware\` must be a function, not \`${type}\``
|
|
53476
54018
|
);
|
|
53477
54019
|
}
|
|
53478
54020
|
|
|
53479
54021
|
this.path = path;
|
|
53480
54022
|
this.regexp = pathToRegexp$1(path, this.paramNames, this.opts);
|
|
53481
54023
|
}
|
|
54024
|
+
|
|
53482
54025
|
/**
|
|
53483
54026
|
* Returns whether request `path` matches route.
|
|
53484
54027
|
*
|
|
@@ -53496,18 +54039,17 @@ Layer$1.prototype.match = function (path) {
|
|
|
53496
54039
|
*
|
|
53497
54040
|
* @param {String} path
|
|
53498
54041
|
* @param {Array.<String>} captures
|
|
53499
|
-
* @param {Object=}
|
|
54042
|
+
* @param {Object=} params
|
|
53500
54043
|
* @returns {Object}
|
|
53501
54044
|
* @private
|
|
53502
54045
|
*/
|
|
53503
54046
|
|
|
53504
|
-
Layer$1.prototype.params = function (path, captures,
|
|
53505
|
-
const params = existingParams || {};
|
|
53506
|
-
|
|
54047
|
+
Layer$1.prototype.params = function (path, captures, params = {}) {
|
|
53507
54048
|
for (let len = captures.length, i = 0; i < len; i++) {
|
|
53508
54049
|
if (this.paramNames[i]) {
|
|
53509
54050
|
const c = captures[i];
|
|
53510
|
-
if (c && c.length
|
|
54051
|
+
if (c && c.length > 0)
|
|
54052
|
+
params[this.paramNames[i].name] = c ? safeDecodeURIComponent(c) : c;
|
|
53511
54053
|
}
|
|
53512
54054
|
}
|
|
53513
54055
|
|
|
@@ -53546,11 +54088,11 @@ Layer$1.prototype.url = function (params, options) {
|
|
|
53546
54088
|
let args = params;
|
|
53547
54089
|
const url = this.path.replace(/\(\.\*\)/g, '');
|
|
53548
54090
|
|
|
53549
|
-
if (typeof params
|
|
54091
|
+
if (typeof params !== 'object') {
|
|
53550
54092
|
args = Array.prototype.slice.call(arguments);
|
|
53551
|
-
if (typeof args[args.length - 1]
|
|
54093
|
+
if (typeof args[args.length - 1] === 'object') {
|
|
53552
54094
|
options = args[args.length - 1];
|
|
53553
|
-
args = args.slice(0,
|
|
54095
|
+
args = args.slice(0, -1);
|
|
53554
54096
|
}
|
|
53555
54097
|
}
|
|
53556
54098
|
|
|
@@ -53560,11 +54102,11 @@ Layer$1.prototype.url = function (params, options) {
|
|
|
53560
54102
|
const tokens = parse$3(url);
|
|
53561
54103
|
let replace = {};
|
|
53562
54104
|
|
|
53563
|
-
if (args
|
|
54105
|
+
if (Array.isArray(args)) {
|
|
53564
54106
|
for (let len = tokens.length, i = 0, j = 0; i < len; i++) {
|
|
53565
54107
|
if (tokens[i].name) replace[tokens[i].name] = args[j++];
|
|
53566
54108
|
}
|
|
53567
|
-
} else if (tokens.some(token => token.name)) {
|
|
54109
|
+
} else if (tokens.some((token) => token.name)) {
|
|
53568
54110
|
replace = params;
|
|
53569
54111
|
} else if (!options) {
|
|
53570
54112
|
options = params;
|
|
@@ -53580,6 +54122,7 @@ Layer$1.prototype.url = function (params, options) {
|
|
|
53580
54122
|
replaced.search = undefined;
|
|
53581
54123
|
replaced.query = options.query;
|
|
53582
54124
|
}
|
|
54125
|
+
|
|
53583
54126
|
return formatUrl(replaced);
|
|
53584
54127
|
}
|
|
53585
54128
|
|
|
@@ -53595,7 +54138,7 @@ Layer$1.prototype.url = function (params, options) {
|
|
|
53595
54138
|
* router
|
|
53596
54139
|
* .param('user', function (id, ctx, next) {
|
|
53597
54140
|
* ctx.user = users[id];
|
|
53598
|
-
* if (!user) return ctx.status = 404;
|
|
54141
|
+
* if (!ctx.user) return ctx.status = 404;
|
|
53599
54142
|
* next();
|
|
53600
54143
|
* })
|
|
53601
54144
|
* .get('/users/:user', function (ctx, next) {
|
|
@@ -53610,11 +54153,12 @@ Layer$1.prototype.url = function (params, options) {
|
|
|
53610
54153
|
*/
|
|
53611
54154
|
|
|
53612
54155
|
Layer$1.prototype.param = function (param, fn) {
|
|
53613
|
-
const stack = this
|
|
54156
|
+
const { stack } = this;
|
|
53614
54157
|
const params = this.paramNames;
|
|
53615
54158
|
const middleware = function (ctx, next) {
|
|
53616
54159
|
return fn.call(this, ctx.params[param], ctx, next);
|
|
53617
54160
|
};
|
|
54161
|
+
|
|
53618
54162
|
middleware.param = param;
|
|
53619
54163
|
|
|
53620
54164
|
const names = params.map(function (p) {
|
|
@@ -53648,7 +54192,10 @@ Layer$1.prototype.param = function (param, fn) {
|
|
|
53648
54192
|
|
|
53649
54193
|
Layer$1.prototype.setPrefix = function (prefix) {
|
|
53650
54194
|
if (this.path) {
|
|
53651
|
-
this.path =
|
|
54195
|
+
this.path =
|
|
54196
|
+
this.path !== '/' || this.opts.strict === true
|
|
54197
|
+
? `${prefix}${this.path}`
|
|
54198
|
+
: prefix;
|
|
53652
54199
|
this.paramNames = [];
|
|
53653
54200
|
this.regexp = pathToRegexp$1(this.path, this.paramNames, this.opts);
|
|
53654
54201
|
}
|
|
@@ -53668,7 +54215,7 @@ Layer$1.prototype.setPrefix = function (prefix) {
|
|
|
53668
54215
|
function safeDecodeURIComponent(text) {
|
|
53669
54216
|
try {
|
|
53670
54217
|
return decodeURIComponent(text);
|
|
53671
|
-
} catch
|
|
54218
|
+
} catch {
|
|
53672
54219
|
return text;
|
|
53673
54220
|
}
|
|
53674
54221
|
}
|
|
@@ -53680,12 +54227,15 @@ function safeDecodeURIComponent(text) {
|
|
|
53680
54227
|
* @link https://github.com/alexmingoia/koa-router
|
|
53681
54228
|
*/
|
|
53682
54229
|
|
|
53683
|
-
const
|
|
54230
|
+
const { debuglog } = require$$1__default["default"];
|
|
54231
|
+
|
|
53684
54232
|
const compose$1 = koaCompose;
|
|
53685
|
-
const HttpError = httpErrors
|
|
54233
|
+
const HttpError = httpErrors.exports;
|
|
53686
54234
|
const methods = methods$1;
|
|
54235
|
+
const { pathToRegexp } = require$$4$1;
|
|
53687
54236
|
const Layer = layer;
|
|
53688
|
-
|
|
54237
|
+
|
|
54238
|
+
const debug$8 = debuglog('koa-router');
|
|
53689
54239
|
|
|
53690
54240
|
/**
|
|
53691
54241
|
* @module koa-router
|
|
@@ -53718,14 +54268,16 @@ var router$2 = Router$1;
|
|
|
53718
54268
|
*
|
|
53719
54269
|
* @alias module:koa-router
|
|
53720
54270
|
* @param {Object=} opts
|
|
54271
|
+
* @param {Boolean=false} opts.exclusive only run last matched route's controller when there are multiple matches
|
|
53721
54272
|
* @param {String=} opts.prefix prefix router paths
|
|
54273
|
+
* @param {String|RegExp=} opts.host host for router match
|
|
53722
54274
|
* @constructor
|
|
53723
54275
|
*/
|
|
53724
54276
|
|
|
53725
|
-
function Router$1(opts) {
|
|
54277
|
+
function Router$1(opts = {}) {
|
|
53726
54278
|
if (!(this instanceof Router$1)) return new Router$1(opts);
|
|
53727
54279
|
|
|
53728
|
-
this.opts = opts
|
|
54280
|
+
this.opts = opts;
|
|
53729
54281
|
this.methods = this.opts.methods || [
|
|
53730
54282
|
'HEAD',
|
|
53731
54283
|
'OPTIONS',
|
|
@@ -53735,10 +54287,13 @@ function Router$1(opts) {
|
|
|
53735
54287
|
'POST',
|
|
53736
54288
|
'DELETE'
|
|
53737
54289
|
];
|
|
54290
|
+
this.exclusive = Boolean(this.opts.exclusive);
|
|
53738
54291
|
|
|
53739
54292
|
this.params = {};
|
|
53740
54293
|
this.stack = [];
|
|
54294
|
+
this.host = this.opts.host;
|
|
53741
54295
|
}
|
|
54296
|
+
|
|
53742
54297
|
/**
|
|
53743
54298
|
* Create `router.verb()` methods, where *verb* is one of the HTTP verbs such
|
|
53744
54299
|
* as `router.get()` or `router.post()`.
|
|
@@ -53746,7 +54301,7 @@ function Router$1(opts) {
|
|
|
53746
54301
|
* Match URL patterns to callback functions or controller actions using `router.verb()`,
|
|
53747
54302
|
* where **verb** is one of the HTTP verbs such as `router.get()` or `router.post()`.
|
|
53748
54303
|
*
|
|
53749
|
-
*
|
|
54304
|
+
* Additionally, `router.all()` can be used to match against all methods.
|
|
53750
54305
|
*
|
|
53751
54306
|
* ```javascript
|
|
53752
54307
|
* router
|
|
@@ -53852,6 +54407,24 @@ function Router$1(opts) {
|
|
|
53852
54407
|
* The [path-to-regexp](https://github.com/pillarjs/path-to-regexp) module is
|
|
53853
54408
|
* used to convert paths to regular expressions.
|
|
53854
54409
|
*
|
|
54410
|
+
*
|
|
54411
|
+
* ### Match host for each router instance
|
|
54412
|
+
*
|
|
54413
|
+
* ```javascript
|
|
54414
|
+
* const router = new Router({
|
|
54415
|
+
* host: 'example.domain' // only match if request host exactly equal `example.domain`
|
|
54416
|
+
* });
|
|
54417
|
+
*
|
|
54418
|
+
* ```
|
|
54419
|
+
*
|
|
54420
|
+
* OR host cloud be a regexp
|
|
54421
|
+
*
|
|
54422
|
+
* ```javascript
|
|
54423
|
+
* const router = new Router({
|
|
54424
|
+
* host: /.*\.?example\.domain$/ // all host end with .example.domain would be matched
|
|
54425
|
+
* });
|
|
54426
|
+
* ```
|
|
54427
|
+
*
|
|
53855
54428
|
* @name get|put|post|patch|delete|del
|
|
53856
54429
|
* @memberof module:koa-router.prototype
|
|
53857
54430
|
* @param {String} path
|
|
@@ -53860,10 +54433,10 @@ function Router$1(opts) {
|
|
|
53860
54433
|
* @returns {Router}
|
|
53861
54434
|
*/
|
|
53862
54435
|
|
|
53863
|
-
for (
|
|
54436
|
+
for (const method_ of methods) {
|
|
53864
54437
|
function setMethodVerb(method) {
|
|
53865
|
-
Router$1.prototype[method] = function(name, path, middleware) {
|
|
53866
|
-
if (typeof path ===
|
|
54438
|
+
Router$1.prototype[method] = function (name, path, middleware) {
|
|
54439
|
+
if (typeof path === 'string' || path instanceof RegExp) {
|
|
53867
54440
|
middleware = Array.prototype.slice.call(arguments, 2);
|
|
53868
54441
|
} else {
|
|
53869
54442
|
middleware = Array.prototype.slice.call(arguments, 1);
|
|
@@ -53871,17 +54444,27 @@ for (let i = 0; i < methods.length; i++) {
|
|
|
53871
54444
|
name = null;
|
|
53872
54445
|
}
|
|
53873
54446
|
|
|
53874
|
-
|
|
53875
|
-
|
|
53876
|
-
|
|
54447
|
+
// Sanity check to ensure we have a viable path candidate (eg: string|regex|non-empty array)
|
|
54448
|
+
if (
|
|
54449
|
+
typeof path !== 'string' &&
|
|
54450
|
+
!(path instanceof RegExp) &&
|
|
54451
|
+
(!Array.isArray(path) || path.length === 0)
|
|
54452
|
+
)
|
|
54453
|
+
throw new Error(
|
|
54454
|
+
`You have to provide a path when adding a ${method} handler`
|
|
54455
|
+
);
|
|
54456
|
+
|
|
54457
|
+
this.register(path, [method], middleware, { name });
|
|
53877
54458
|
|
|
53878
54459
|
return this;
|
|
53879
54460
|
};
|
|
53880
54461
|
}
|
|
53881
|
-
|
|
54462
|
+
|
|
54463
|
+
setMethodVerb(method_);
|
|
53882
54464
|
}
|
|
53883
54465
|
|
|
53884
54466
|
// Alias for `router.delete()` because delete is a reserved word
|
|
54467
|
+
// eslint-disable-next-line dot-notation
|
|
53885
54468
|
Router$1.prototype.del = Router$1.prototype['delete'];
|
|
53886
54469
|
|
|
53887
54470
|
/**
|
|
@@ -53921,9 +54504,8 @@ Router$1.prototype.use = function () {
|
|
|
53921
54504
|
|
|
53922
54505
|
// support array of paths
|
|
53923
54506
|
if (Array.isArray(middleware[0]) && typeof middleware[0][0] === 'string') {
|
|
53924
|
-
|
|
53925
|
-
for (
|
|
53926
|
-
const p = arrPaths[i];
|
|
54507
|
+
const arrPaths = middleware[0];
|
|
54508
|
+
for (const p of arrPaths) {
|
|
53927
54509
|
router.use.apply(router, [p].concat(middleware.slice(1)));
|
|
53928
54510
|
}
|
|
53929
54511
|
|
|
@@ -53933,12 +54515,15 @@ Router$1.prototype.use = function () {
|
|
|
53933
54515
|
const hasPath = typeof middleware[0] === 'string';
|
|
53934
54516
|
if (hasPath) path = middleware.shift();
|
|
53935
54517
|
|
|
53936
|
-
for (
|
|
53937
|
-
const m = middleware[i];
|
|
54518
|
+
for (const m of middleware) {
|
|
53938
54519
|
if (m.router) {
|
|
53939
|
-
const cloneRouter = Object.assign(
|
|
53940
|
-
|
|
53941
|
-
|
|
54520
|
+
const cloneRouter = Object.assign(
|
|
54521
|
+
Object.create(Router$1.prototype),
|
|
54522
|
+
m.router,
|
|
54523
|
+
{
|
|
54524
|
+
stack: [...m.router.stack]
|
|
54525
|
+
}
|
|
54526
|
+
);
|
|
53942
54527
|
|
|
53943
54528
|
for (let j = 0; j < cloneRouter.stack.length; j++) {
|
|
53944
54529
|
const nestedLayer = cloneRouter.stack[j];
|
|
@@ -53956,18 +54541,21 @@ Router$1.prototype.use = function () {
|
|
|
53956
54541
|
if (router.params) {
|
|
53957
54542
|
function setRouterParams(paramArr) {
|
|
53958
54543
|
const routerParams = paramArr;
|
|
53959
|
-
for (
|
|
53960
|
-
const key = routerParams[j];
|
|
54544
|
+
for (const key of routerParams) {
|
|
53961
54545
|
cloneRouter.param(key, router.params[key]);
|
|
53962
54546
|
}
|
|
53963
54547
|
}
|
|
54548
|
+
|
|
53964
54549
|
setRouterParams(Object.keys(router.params));
|
|
53965
54550
|
}
|
|
53966
54551
|
} else {
|
|
53967
54552
|
const keys = [];
|
|
53968
54553
|
pathToRegexp(router.opts.prefix || '', keys);
|
|
53969
54554
|
const routerPrefixHasParam = router.opts.prefix && keys.length;
|
|
53970
|
-
router.register(path || '([
|
|
54555
|
+
router.register(path || '([^/]*)', [], m, {
|
|
54556
|
+
end: false,
|
|
54557
|
+
ignoreCaptures: !hasPath && !routerPrefixHasParam
|
|
54558
|
+
});
|
|
53971
54559
|
}
|
|
53972
54560
|
}
|
|
53973
54561
|
|
|
@@ -54009,9 +54597,15 @@ Router$1.prototype.prefix = function (prefix) {
|
|
|
54009
54597
|
Router$1.prototype.routes = Router$1.prototype.middleware = function () {
|
|
54010
54598
|
const router = this;
|
|
54011
54599
|
|
|
54012
|
-
|
|
54600
|
+
const dispatch = function dispatch(ctx, next) {
|
|
54013
54601
|
debug$8('%s %s', ctx.method, ctx.path);
|
|
54014
54602
|
|
|
54603
|
+
const hostMatched = router.matchHost(ctx.host);
|
|
54604
|
+
|
|
54605
|
+
if (!hostMatched) {
|
|
54606
|
+
return next();
|
|
54607
|
+
}
|
|
54608
|
+
|
|
54015
54609
|
const path = router.opts.routerPath || ctx.routerPath || ctx.path;
|
|
54016
54610
|
const matched = router.match(path, ctx.method);
|
|
54017
54611
|
let layerChain;
|
|
@@ -54033,16 +54627,23 @@ Router$1.prototype.routes = Router$1.prototype.middleware = function () {
|
|
|
54033
54627
|
ctx._matchedRouteName = mostSpecificLayer.name;
|
|
54034
54628
|
}
|
|
54035
54629
|
|
|
54036
|
-
layerChain =
|
|
54037
|
-
|
|
54630
|
+
layerChain = (
|
|
54631
|
+
router.exclusive ? [mostSpecificLayer] : matchedLayers
|
|
54632
|
+
).reduce(function (memo, layer) {
|
|
54633
|
+
memo.push(function (ctx, next) {
|
|
54038
54634
|
ctx.captures = layer.captures(path, ctx.captures);
|
|
54039
|
-
ctx.params = ctx.request.params = layer.params(
|
|
54635
|
+
ctx.params = ctx.request.params = layer.params(
|
|
54636
|
+
path,
|
|
54637
|
+
ctx.captures,
|
|
54638
|
+
ctx.params
|
|
54639
|
+
);
|
|
54040
54640
|
ctx.routerPath = layer.path;
|
|
54041
54641
|
ctx.routerName = layer.name;
|
|
54042
54642
|
ctx._matchedRoute = layer.path;
|
|
54043
54643
|
if (layer.name) {
|
|
54044
54644
|
ctx._matchedRouteName = layer.name;
|
|
54045
54645
|
}
|
|
54646
|
+
|
|
54046
54647
|
return next();
|
|
54047
54648
|
});
|
|
54048
54649
|
return memo.concat(layer.stack);
|
|
@@ -54099,12 +54700,11 @@ Router$1.prototype.routes = Router$1.prototype.middleware = function () {
|
|
|
54099
54700
|
* @returns {Function}
|
|
54100
54701
|
*/
|
|
54101
54702
|
|
|
54102
|
-
Router$1.prototype.allowedMethods = function (options) {
|
|
54103
|
-
options = options || {};
|
|
54703
|
+
Router$1.prototype.allowedMethods = function (options = {}) {
|
|
54104
54704
|
const implemented = this.methods;
|
|
54105
54705
|
|
|
54106
54706
|
return function allowedMethods(ctx, next) {
|
|
54107
|
-
return next().then(function() {
|
|
54707
|
+
return next().then(function () {
|
|
54108
54708
|
const allowed = {};
|
|
54109
54709
|
|
|
54110
54710
|
if (!ctx.status || ctx.status === 404) {
|
|
@@ -54120,25 +54720,27 @@ Router$1.prototype.allowedMethods = function (options) {
|
|
|
54120
54720
|
|
|
54121
54721
|
if (!~implemented.indexOf(ctx.method)) {
|
|
54122
54722
|
if (options.throw) {
|
|
54123
|
-
|
|
54124
|
-
|
|
54125
|
-
|
|
54723
|
+
const notImplementedThrowable =
|
|
54724
|
+
typeof options.notImplemented === 'function'
|
|
54725
|
+
? options.notImplemented() // set whatever the user returns from their function
|
|
54726
|
+
: new HttpError.NotImplemented();
|
|
54126
54727
|
|
|
54127
54728
|
throw notImplementedThrowable;
|
|
54128
54729
|
} else {
|
|
54129
54730
|
ctx.status = 501;
|
|
54130
54731
|
ctx.set('Allow', allowedArr.join(', '));
|
|
54131
54732
|
}
|
|
54132
|
-
} else if (allowedArr.length) {
|
|
54733
|
+
} else if (allowedArr.length > 0) {
|
|
54133
54734
|
if (ctx.method === 'OPTIONS') {
|
|
54134
54735
|
ctx.status = 200;
|
|
54135
54736
|
ctx.body = '';
|
|
54136
54737
|
ctx.set('Allow', allowedArr.join(', '));
|
|
54137
54738
|
} else if (!allowed[ctx.method]) {
|
|
54138
54739
|
if (options.throw) {
|
|
54139
|
-
|
|
54140
|
-
|
|
54141
|
-
|
|
54740
|
+
const notAllowedThrowable =
|
|
54741
|
+
typeof options.methodNotAllowed === 'function'
|
|
54742
|
+
? options.methodNotAllowed() // set whatever the user returns from their function
|
|
54743
|
+
: new HttpError.MethodNotAllowed();
|
|
54142
54744
|
|
|
54143
54745
|
throw notAllowedThrowable;
|
|
54144
54746
|
} else {
|
|
@@ -54160,7 +54762,6 @@ Router$1.prototype.allowedMethods = function (options) {
|
|
|
54160
54762
|
* @param {Function=} middleware You may also pass multiple middleware.
|
|
54161
54763
|
* @param {Function} callback
|
|
54162
54764
|
* @returns {Router}
|
|
54163
|
-
* @private
|
|
54164
54765
|
*/
|
|
54165
54766
|
|
|
54166
54767
|
Router$1.prototype.all = function (name, path, middleware) {
|
|
@@ -54172,6 +54773,14 @@ Router$1.prototype.all = function (name, path, middleware) {
|
|
|
54172
54773
|
name = null;
|
|
54173
54774
|
}
|
|
54174
54775
|
|
|
54776
|
+
// Sanity check to ensure we have a viable path candidate (eg: string|regex|non-empty array)
|
|
54777
|
+
if (
|
|
54778
|
+
typeof path !== 'string' &&
|
|
54779
|
+
!(path instanceof RegExp) &&
|
|
54780
|
+
(!Array.isArray(path) || path.length === 0)
|
|
54781
|
+
)
|
|
54782
|
+
throw new Error('You have to provide a path when adding an all handler');
|
|
54783
|
+
|
|
54175
54784
|
this.register(path, methods, middleware, { name });
|
|
54176
54785
|
|
|
54177
54786
|
return this;
|
|
@@ -54203,12 +54812,21 @@ Router$1.prototype.all = function (name, path, middleware) {
|
|
|
54203
54812
|
|
|
54204
54813
|
Router$1.prototype.redirect = function (source, destination, code) {
|
|
54205
54814
|
// lookup source route by name
|
|
54206
|
-
if (source[0] !== '/')
|
|
54815
|
+
if (typeof source === 'symbol' || source[0] !== '/') {
|
|
54816
|
+
source = this.url(source);
|
|
54817
|
+
if (source instanceof Error) throw source;
|
|
54818
|
+
}
|
|
54207
54819
|
|
|
54208
54820
|
// lookup destination route by name
|
|
54209
|
-
if (
|
|
54821
|
+
if (
|
|
54822
|
+
typeof destination === 'symbol' ||
|
|
54823
|
+
(destination[0] !== '/' && !destination.includes('://'))
|
|
54824
|
+
) {
|
|
54825
|
+
destination = this.url(destination);
|
|
54826
|
+
if (destination instanceof Error) throw destination;
|
|
54827
|
+
}
|
|
54210
54828
|
|
|
54211
|
-
return this.all(source, ctx => {
|
|
54829
|
+
return this.all(source, (ctx) => {
|
|
54212
54830
|
ctx.redirect(destination);
|
|
54213
54831
|
ctx.status = code || 301;
|
|
54214
54832
|
});
|
|
@@ -54224,16 +54842,13 @@ Router$1.prototype.redirect = function (source, destination, code) {
|
|
|
54224
54842
|
* @private
|
|
54225
54843
|
*/
|
|
54226
54844
|
|
|
54227
|
-
Router$1.prototype.register = function (path, methods, middleware, opts) {
|
|
54228
|
-
opts = opts || {};
|
|
54229
|
-
|
|
54845
|
+
Router$1.prototype.register = function (path, methods, middleware, opts = {}) {
|
|
54230
54846
|
const router = this;
|
|
54231
|
-
const stack = this
|
|
54847
|
+
const { stack } = this;
|
|
54232
54848
|
|
|
54233
54849
|
// support array of paths
|
|
54234
54850
|
if (Array.isArray(path)) {
|
|
54235
|
-
for (
|
|
54236
|
-
const curPath = path[i];
|
|
54851
|
+
for (const curPath of path) {
|
|
54237
54852
|
router.register.call(router, curPath, methods, middleware, opts);
|
|
54238
54853
|
}
|
|
54239
54854
|
|
|
@@ -54246,7 +54861,7 @@ Router$1.prototype.register = function (path, methods, middleware, opts) {
|
|
|
54246
54861
|
name: opts.name,
|
|
54247
54862
|
sensitive: opts.sensitive || this.opts.sensitive || false,
|
|
54248
54863
|
strict: opts.strict || this.opts.strict || false,
|
|
54249
|
-
prefix: opts.prefix || this.opts.prefix ||
|
|
54864
|
+
prefix: opts.prefix || this.opts.prefix || '',
|
|
54250
54865
|
ignoreCaptures: opts.ignoreCaptures
|
|
54251
54866
|
});
|
|
54252
54867
|
|
|
@@ -54277,7 +54892,7 @@ Router$1.prototype.register = function (path, methods, middleware, opts) {
|
|
|
54277
54892
|
Router$1.prototype.route = function (name) {
|
|
54278
54893
|
const routes = this.stack;
|
|
54279
54894
|
|
|
54280
|
-
for (let len = routes.length, i=0; i<len; i++) {
|
|
54895
|
+
for (let len = routes.length, i = 0; i < len; i++) {
|
|
54281
54896
|
if (routes[i].name && routes[i].name === name) return routes[i];
|
|
54282
54897
|
}
|
|
54283
54898
|
|
|
@@ -54327,7 +54942,7 @@ Router$1.prototype.url = function (name, params) {
|
|
|
54327
54942
|
return route.url.apply(route, args);
|
|
54328
54943
|
}
|
|
54329
54944
|
|
|
54330
|
-
return new Error(`No route found for name: ${name}`);
|
|
54945
|
+
return new Error(`No route found for name: ${String(name)}`);
|
|
54331
54946
|
};
|
|
54332
54947
|
|
|
54333
54948
|
/**
|
|
@@ -54354,12 +54969,13 @@ Router$1.prototype.match = function (path, method) {
|
|
|
54354
54969
|
|
|
54355
54970
|
debug$8('test %s %s', layer.path, layer.regexp);
|
|
54356
54971
|
|
|
54972
|
+
// eslint-disable-next-line unicorn/prefer-regexp-test
|
|
54357
54973
|
if (layer.match(path)) {
|
|
54358
54974
|
matched.path.push(layer);
|
|
54359
54975
|
|
|
54360
54976
|
if (layer.methods.length === 0 || ~layer.methods.indexOf(method)) {
|
|
54361
54977
|
matched.pathAndMethod.push(layer);
|
|
54362
|
-
if (layer.methods.length) matched.route = true;
|
|
54978
|
+
if (layer.methods.length > 0) matched.route = true;
|
|
54363
54979
|
}
|
|
54364
54980
|
}
|
|
54365
54981
|
}
|
|
@@ -54367,6 +54983,32 @@ Router$1.prototype.match = function (path, method) {
|
|
|
54367
54983
|
return matched;
|
|
54368
54984
|
};
|
|
54369
54985
|
|
|
54986
|
+
/**
|
|
54987
|
+
* Match given `input` to allowed host
|
|
54988
|
+
* @param {String} input
|
|
54989
|
+
* @returns {boolean}
|
|
54990
|
+
*/
|
|
54991
|
+
|
|
54992
|
+
Router$1.prototype.matchHost = function (input) {
|
|
54993
|
+
const { host } = this;
|
|
54994
|
+
|
|
54995
|
+
if (!host) {
|
|
54996
|
+
return true;
|
|
54997
|
+
}
|
|
54998
|
+
|
|
54999
|
+
if (!input) {
|
|
55000
|
+
return false;
|
|
55001
|
+
}
|
|
55002
|
+
|
|
55003
|
+
if (typeof host === 'string') {
|
|
55004
|
+
return input === host;
|
|
55005
|
+
}
|
|
55006
|
+
|
|
55007
|
+
if (typeof host === 'object' && host instanceof RegExp) {
|
|
55008
|
+
return host.test(input);
|
|
55009
|
+
}
|
|
55010
|
+
};
|
|
55011
|
+
|
|
54370
55012
|
/**
|
|
54371
55013
|
* Run middleware for named route parameters. Useful for auto-loading or
|
|
54372
55014
|
* validation.
|
|
@@ -54397,7 +55039,7 @@ Router$1.prototype.match = function (path, method) {
|
|
|
54397
55039
|
* @returns {Router}
|
|
54398
55040
|
*/
|
|
54399
55041
|
|
|
54400
|
-
Router$1.prototype.param = function(param, middleware) {
|
|
55042
|
+
Router$1.prototype.param = function (param, middleware) {
|
|
54401
55043
|
this.params[param] = middleware;
|
|
54402
55044
|
for (let i = 0; i < this.stack.length; i++) {
|
|
54403
55045
|
const route = this.stack[i];
|
|
@@ -56025,7 +56667,16 @@ const updateEvent = (username, resolved = true) => prisma.event.updateMany({
|
|
|
56025
56667
|
resolved
|
|
56026
56668
|
}
|
|
56027
56669
|
});
|
|
56028
|
-
const readEvents = () => prisma
|
|
56670
|
+
const readEvents = (size, offset) => prisma.$transaction([
|
|
56671
|
+
prisma.event.count(),
|
|
56672
|
+
prisma.event.findMany({
|
|
56673
|
+
take: size,
|
|
56674
|
+
skip: offset,
|
|
56675
|
+
orderBy: {
|
|
56676
|
+
id: "desc"
|
|
56677
|
+
}
|
|
56678
|
+
})
|
|
56679
|
+
]);
|
|
56029
56680
|
const deleteEvent = (id) => prisma.event.delete({
|
|
56030
56681
|
where: {
|
|
56031
56682
|
id
|
|
@@ -56094,7 +56745,9 @@ const modifyOrder = async (ctx) => {
|
|
|
56094
56745
|
await handleRequest$1(ctx, updateOrder(order.join(",")));
|
|
56095
56746
|
};
|
|
56096
56747
|
const queryEvents = async (ctx) => {
|
|
56097
|
-
|
|
56748
|
+
const size = Number(ctx.query.size) || 10;
|
|
56749
|
+
const offset = Number(ctx.query.offset) || 0;
|
|
56750
|
+
await handleRequest$1(ctx, readEvents(size, offset).then(([count, list]) => ({ count, list })));
|
|
56098
56751
|
};
|
|
56099
56752
|
const removeEvent = async (ctx) => {
|
|
56100
56753
|
if (ctx.params.id) {
|
|
@@ -56103,17 +56756,23 @@ const removeEvent = async (ctx) => {
|
|
|
56103
56756
|
await handleRequest$1(ctx, deleteAllEvents());
|
|
56104
56757
|
}
|
|
56105
56758
|
};
|
|
56759
|
+
const queryConfig = async (ctx) => ctx.body = {
|
|
56760
|
+
title: config.webTitle,
|
|
56761
|
+
subTitle: config.webSubTitle,
|
|
56762
|
+
headTitle: config.webHeadTitle
|
|
56763
|
+
};
|
|
56106
56764
|
|
|
56107
56765
|
const router$1 = new router$2({ prefix: "/api" });
|
|
56108
56766
|
router$1.get("/session", verifySession);
|
|
56109
56767
|
router$1.post("/session", createSession);
|
|
56110
|
-
router$1.get("/
|
|
56111
|
-
router$1.post("/
|
|
56112
|
-
router$1.put("/
|
|
56113
|
-
router$1.put("/
|
|
56114
|
-
router$1.delete("/
|
|
56115
|
-
router$1.get("/
|
|
56116
|
-
router$1.delete("/
|
|
56768
|
+
router$1.get("/servers", getListServers$1);
|
|
56769
|
+
router$1.post("/servers", addServer$1);
|
|
56770
|
+
router$1.put("/servers", setServer$1);
|
|
56771
|
+
router$1.put("/servers/order", modifyOrder);
|
|
56772
|
+
router$1.delete("/servers/:username", removeServer$1);
|
|
56773
|
+
router$1.get("/events", queryEvents);
|
|
56774
|
+
router$1.delete("/events/:id?", removeEvent);
|
|
56775
|
+
router$1.get("/config", queryConfig);
|
|
56117
56776
|
|
|
56118
56777
|
var cjs = {};
|
|
56119
56778
|
|
|
@@ -56584,6 +57243,9 @@ var constants = {
|
|
|
56584
57243
|
NOOP: () => {}
|
|
56585
57244
|
};
|
|
56586
57245
|
|
|
57246
|
+
var unmask$1;
|
|
57247
|
+
var mask;
|
|
57248
|
+
|
|
56587
57249
|
const { EMPTY_BUFFER: EMPTY_BUFFER$3 } = constants;
|
|
56588
57250
|
|
|
56589
57251
|
/**
|
|
@@ -56683,30 +57345,31 @@ function toBuffer$2(data) {
|
|
|
56683
57345
|
return buf;
|
|
56684
57346
|
}
|
|
56685
57347
|
|
|
56686
|
-
|
|
56687
|
-
|
|
57348
|
+
bufferUtil$1.exports = {
|
|
57349
|
+
concat: concat$1,
|
|
57350
|
+
mask: _mask,
|
|
57351
|
+
toArrayBuffer: toArrayBuffer$1,
|
|
57352
|
+
toBuffer: toBuffer$2,
|
|
57353
|
+
unmask: _unmask
|
|
57354
|
+
};
|
|
56688
57355
|
|
|
56689
|
-
|
|
56690
|
-
|
|
56691
|
-
|
|
57356
|
+
/* istanbul ignore else */
|
|
57357
|
+
if (!process.env.WS_NO_BUFFER_UTIL) {
|
|
57358
|
+
try {
|
|
57359
|
+
const bufferUtil = require('bufferutil');
|
|
57360
|
+
|
|
57361
|
+
mask = bufferUtil$1.exports.mask = function (source, mask, output, offset, length) {
|
|
56692
57362
|
if (length < 48) _mask(source, mask, output, offset, length);
|
|
56693
57363
|
else bufferUtil.mask(source, mask, output, offset, length);
|
|
56694
|
-
}
|
|
56695
|
-
|
|
56696
|
-
|
|
56697
|
-
unmask(buffer, mask) {
|
|
57364
|
+
};
|
|
57365
|
+
|
|
57366
|
+
unmask$1 = bufferUtil$1.exports.unmask = function (buffer, mask) {
|
|
56698
57367
|
if (buffer.length < 32) _unmask(buffer, mask);
|
|
56699
57368
|
else bufferUtil.unmask(buffer, mask);
|
|
56700
|
-
}
|
|
56701
|
-
}
|
|
56702
|
-
|
|
56703
|
-
|
|
56704
|
-
concat: concat$1,
|
|
56705
|
-
mask: _mask,
|
|
56706
|
-
toArrayBuffer: toArrayBuffer$1,
|
|
56707
|
-
toBuffer: toBuffer$2,
|
|
56708
|
-
unmask: _unmask
|
|
56709
|
-
};
|
|
57369
|
+
};
|
|
57370
|
+
} catch (e) {
|
|
57371
|
+
// Continue regardless of the error.
|
|
57372
|
+
}
|
|
56710
57373
|
}
|
|
56711
57374
|
|
|
56712
57375
|
const kDone = Symbol('kDone');
|
|
@@ -57275,6 +57938,8 @@ function inflateOnError(err) {
|
|
|
57275
57938
|
|
|
57276
57939
|
var validation = {exports: {}};
|
|
57277
57940
|
|
|
57941
|
+
var isValidUTF8_1;
|
|
57942
|
+
|
|
57278
57943
|
//
|
|
57279
57944
|
// Allowed token characters:
|
|
57280
57945
|
//
|
|
@@ -57380,22 +58045,23 @@ function _isValidUTF8(buf) {
|
|
|
57380
58045
|
return true;
|
|
57381
58046
|
}
|
|
57382
58047
|
|
|
57383
|
-
|
|
57384
|
-
|
|
58048
|
+
validation.exports = {
|
|
58049
|
+
isValidStatusCode: isValidStatusCode$2,
|
|
58050
|
+
isValidUTF8: _isValidUTF8,
|
|
58051
|
+
tokenChars: tokenChars$2
|
|
58052
|
+
};
|
|
58053
|
+
|
|
58054
|
+
/* istanbul ignore else */
|
|
58055
|
+
if (!process.env.WS_NO_UTF_8_VALIDATE) {
|
|
58056
|
+
try {
|
|
58057
|
+
const isValidUTF8 = require('utf-8-validate');
|
|
57385
58058
|
|
|
57386
|
-
|
|
57387
|
-
isValidStatusCode: isValidStatusCode$2,
|
|
57388
|
-
isValidUTF8(buf) {
|
|
58059
|
+
isValidUTF8_1 = validation.exports.isValidUTF8 = function (buf) {
|
|
57389
58060
|
return buf.length < 150 ? _isValidUTF8(buf) : isValidUTF8(buf);
|
|
57390
|
-
}
|
|
57391
|
-
|
|
57392
|
-
|
|
57393
|
-
}
|
|
57394
|
-
validation.exports = {
|
|
57395
|
-
isValidStatusCode: isValidStatusCode$2,
|
|
57396
|
-
isValidUTF8: _isValidUTF8,
|
|
57397
|
-
tokenChars: tokenChars$2
|
|
57398
|
-
};
|
|
58061
|
+
};
|
|
58062
|
+
} catch (e) {
|
|
58063
|
+
// Continue regardless of the error.
|
|
58064
|
+
}
|
|
57399
58065
|
}
|
|
57400
58066
|
|
|
57401
58067
|
const { Writable } = Stream__default["default"];
|
|
@@ -59668,11 +60334,11 @@ function initAsClient(websocket, address, protocols, options) {
|
|
|
59668
60334
|
? parsedUrl.hostname.slice(1, -1)
|
|
59669
60335
|
: parsedUrl.hostname;
|
|
59670
60336
|
opts.headers = {
|
|
60337
|
+
...opts.headers,
|
|
59671
60338
|
'Sec-WebSocket-Version': opts.protocolVersion,
|
|
59672
60339
|
'Sec-WebSocket-Key': key,
|
|
59673
60340
|
Connection: 'Upgrade',
|
|
59674
|
-
Upgrade: 'websocket'
|
|
59675
|
-
...opts.headers
|
|
60341
|
+
Upgrade: 'websocket'
|
|
59676
60342
|
};
|
|
59677
60343
|
opts.path = parsedUrl.pathname + parsedUrl.search;
|
|
59678
60344
|
opts.timeout = opts.handshakeTimeout;
|
|
@@ -59726,7 +60392,11 @@ function initAsClient(websocket, address, protocols, options) {
|
|
|
59726
60392
|
|
|
59727
60393
|
if (opts.followRedirects) {
|
|
59728
60394
|
if (websocket._redirects === 0) {
|
|
59729
|
-
websocket.
|
|
60395
|
+
websocket._originalUnixSocket = isUnixSocket;
|
|
60396
|
+
websocket._originalSecure = isSecure;
|
|
60397
|
+
websocket._originalHostOrSocketPath = isUnixSocket
|
|
60398
|
+
? opts.socketPath
|
|
60399
|
+
: parsedUrl.host;
|
|
59730
60400
|
|
|
59731
60401
|
const headers = options && options.headers;
|
|
59732
60402
|
|
|
@@ -59741,18 +60411,27 @@ function initAsClient(websocket, address, protocols, options) {
|
|
|
59741
60411
|
options.headers[key.toLowerCase()] = value;
|
|
59742
60412
|
}
|
|
59743
60413
|
}
|
|
59744
|
-
} else if (
|
|
59745
|
-
|
|
59746
|
-
|
|
59747
|
-
|
|
59748
|
-
|
|
59749
|
-
|
|
59750
|
-
|
|
59751
|
-
|
|
59752
|
-
|
|
59753
|
-
|
|
59754
|
-
|
|
59755
|
-
|
|
60414
|
+
} else if (websocket.listenerCount('redirect') === 0) {
|
|
60415
|
+
const isSameHost = isUnixSocket
|
|
60416
|
+
? websocket._originalUnixSocket
|
|
60417
|
+
? opts.socketPath === websocket._originalHostOrSocketPath
|
|
60418
|
+
: false
|
|
60419
|
+
: websocket._originalUnixSocket
|
|
60420
|
+
? false
|
|
60421
|
+
: parsedUrl.host === websocket._originalHostOrSocketPath;
|
|
60422
|
+
|
|
60423
|
+
if (!isSameHost || (websocket._originalSecure && !isSecure)) {
|
|
60424
|
+
//
|
|
60425
|
+
// Match curl 7.77.0 behavior and drop the following headers. These
|
|
60426
|
+
// headers are also dropped when following a redirect to a subdomain.
|
|
60427
|
+
//
|
|
60428
|
+
delete opts.headers.authorization;
|
|
60429
|
+
delete opts.headers.cookie;
|
|
60430
|
+
|
|
60431
|
+
if (!isSameHost) delete opts.headers.host;
|
|
60432
|
+
|
|
60433
|
+
opts.auth = undefined;
|
|
60434
|
+
}
|
|
59756
60435
|
}
|
|
59757
60436
|
|
|
59758
60437
|
//
|
|
@@ -59844,6 +60523,11 @@ function initAsClient(websocket, address, protocols, options) {
|
|
|
59844
60523
|
|
|
59845
60524
|
req = websocket._req = null;
|
|
59846
60525
|
|
|
60526
|
+
if (res.headers.upgrade.toLowerCase() !== 'websocket') {
|
|
60527
|
+
abortHandshake$1(websocket, socket, 'Invalid Upgrade header');
|
|
60528
|
+
return;
|
|
60529
|
+
}
|
|
60530
|
+
|
|
59847
60531
|
const digest = createHash$1('sha1')
|
|
59848
60532
|
.update(key + GUID$1)
|
|
59849
60533
|
.digest('base64');
|
|
@@ -60687,21 +61371,36 @@ class WebSocketServer extends EventEmitter {
|
|
|
60687
61371
|
handleUpgrade(req, socket, head, cb) {
|
|
60688
61372
|
socket.on('error', socketOnError);
|
|
60689
61373
|
|
|
60690
|
-
const key =
|
|
60691
|
-
req.headers['sec-websocket-key'] !== undefined
|
|
60692
|
-
? req.headers['sec-websocket-key']
|
|
60693
|
-
: false;
|
|
61374
|
+
const key = req.headers['sec-websocket-key'];
|
|
60694
61375
|
const version = +req.headers['sec-websocket-version'];
|
|
60695
61376
|
|
|
60696
|
-
if (
|
|
60697
|
-
|
|
60698
|
-
|
|
60699
|
-
|
|
60700
|
-
|
|
60701
|
-
|
|
60702
|
-
|
|
60703
|
-
|
|
60704
|
-
|
|
61377
|
+
if (req.method !== 'GET') {
|
|
61378
|
+
const message = 'Invalid HTTP method';
|
|
61379
|
+
abortHandshakeOrEmitwsClientError(this, req, socket, 405, message);
|
|
61380
|
+
return;
|
|
61381
|
+
}
|
|
61382
|
+
|
|
61383
|
+
if (req.headers.upgrade.toLowerCase() !== 'websocket') {
|
|
61384
|
+
const message = 'Invalid Upgrade header';
|
|
61385
|
+
abortHandshakeOrEmitwsClientError(this, req, socket, 400, message);
|
|
61386
|
+
return;
|
|
61387
|
+
}
|
|
61388
|
+
|
|
61389
|
+
if (!key || !keyRegex.test(key)) {
|
|
61390
|
+
const message = 'Missing or invalid Sec-WebSocket-Key header';
|
|
61391
|
+
abortHandshakeOrEmitwsClientError(this, req, socket, 400, message);
|
|
61392
|
+
return;
|
|
61393
|
+
}
|
|
61394
|
+
|
|
61395
|
+
if (version !== 8 && version !== 13) {
|
|
61396
|
+
const message = 'Missing or invalid Sec-WebSocket-Version header';
|
|
61397
|
+
abortHandshakeOrEmitwsClientError(this, req, socket, 400, message);
|
|
61398
|
+
return;
|
|
61399
|
+
}
|
|
61400
|
+
|
|
61401
|
+
if (!this.shouldHandle(req)) {
|
|
61402
|
+
abortHandshake(socket, 400);
|
|
61403
|
+
return;
|
|
60705
61404
|
}
|
|
60706
61405
|
|
|
60707
61406
|
const secWebSocketProtocol = req.headers['sec-websocket-protocol'];
|
|
@@ -60711,7 +61410,9 @@ class WebSocketServer extends EventEmitter {
|
|
|
60711
61410
|
try {
|
|
60712
61411
|
protocols = subprotocol.parse(secWebSocketProtocol);
|
|
60713
61412
|
} catch (err) {
|
|
60714
|
-
|
|
61413
|
+
const message = 'Invalid Sec-WebSocket-Protocol header';
|
|
61414
|
+
abortHandshakeOrEmitwsClientError(this, req, socket, 400, message);
|
|
61415
|
+
return;
|
|
60715
61416
|
}
|
|
60716
61417
|
}
|
|
60717
61418
|
|
|
@@ -60736,7 +61437,10 @@ class WebSocketServer extends EventEmitter {
|
|
|
60736
61437
|
extensions[PerMessageDeflate.extensionName] = perMessageDeflate;
|
|
60737
61438
|
}
|
|
60738
61439
|
} catch (err) {
|
|
60739
|
-
|
|
61440
|
+
const message =
|
|
61441
|
+
'Invalid or unacceptable Sec-WebSocket-Extensions header';
|
|
61442
|
+
abortHandshakeOrEmitwsClientError(this, req, socket, 400, message);
|
|
61443
|
+
return;
|
|
60740
61444
|
}
|
|
60741
61445
|
}
|
|
60742
61446
|
|
|
@@ -60903,7 +61607,7 @@ function emitClose(server) {
|
|
|
60903
61607
|
}
|
|
60904
61608
|
|
|
60905
61609
|
/**
|
|
60906
|
-
* Handle
|
|
61610
|
+
* Handle socket errors.
|
|
60907
61611
|
*
|
|
60908
61612
|
* @private
|
|
60909
61613
|
*/
|
|
@@ -60921,27 +61625,54 @@ function socketOnError() {
|
|
|
60921
61625
|
* @private
|
|
60922
61626
|
*/
|
|
60923
61627
|
function abortHandshake(socket, code, message, headers) {
|
|
60924
|
-
|
|
60925
|
-
|
|
60926
|
-
|
|
60927
|
-
|
|
60928
|
-
|
|
60929
|
-
|
|
60930
|
-
|
|
60931
|
-
|
|
61628
|
+
//
|
|
61629
|
+
// The socket is writable unless the user destroyed or ended it before calling
|
|
61630
|
+
// `server.handleUpgrade()` or in the `verifyClient` function, which is a user
|
|
61631
|
+
// error. Handling this does not make much sense as the worst that can happen
|
|
61632
|
+
// is that some of the data written by the user might be discarded due to the
|
|
61633
|
+
// call to `socket.end()` below, which triggers an `'error'` event that in
|
|
61634
|
+
// turn causes the socket to be destroyed.
|
|
61635
|
+
//
|
|
61636
|
+
message = message || http$1.STATUS_CODES[code];
|
|
61637
|
+
headers = {
|
|
61638
|
+
Connection: 'close',
|
|
61639
|
+
'Content-Type': 'text/html',
|
|
61640
|
+
'Content-Length': Buffer.byteLength(message),
|
|
61641
|
+
...headers
|
|
61642
|
+
};
|
|
60932
61643
|
|
|
60933
|
-
|
|
60934
|
-
|
|
60935
|
-
|
|
60936
|
-
|
|
60937
|
-
|
|
60938
|
-
|
|
60939
|
-
|
|
60940
|
-
|
|
60941
|
-
|
|
61644
|
+
socket.once('finish', socket.destroy);
|
|
61645
|
+
|
|
61646
|
+
socket.end(
|
|
61647
|
+
`HTTP/1.1 ${code} ${http$1.STATUS_CODES[code]}\r\n` +
|
|
61648
|
+
Object.keys(headers)
|
|
61649
|
+
.map((h) => `${h}: ${headers[h]}`)
|
|
61650
|
+
.join('\r\n') +
|
|
61651
|
+
'\r\n\r\n' +
|
|
61652
|
+
message
|
|
61653
|
+
);
|
|
61654
|
+
}
|
|
61655
|
+
|
|
61656
|
+
/**
|
|
61657
|
+
* Emit a `'wsClientError'` event on a `WebSocketServer` if there is at least
|
|
61658
|
+
* one listener for it, otherwise call `abortHandshake()`.
|
|
61659
|
+
*
|
|
61660
|
+
* @param {WebSocketServer} server The WebSocket server
|
|
61661
|
+
* @param {http.IncomingMessage} req The request object
|
|
61662
|
+
* @param {(net.Socket|tls.Socket)} socket The socket of the upgrade request
|
|
61663
|
+
* @param {Number} code The HTTP response status code
|
|
61664
|
+
* @param {String} message The HTTP response body
|
|
61665
|
+
* @private
|
|
61666
|
+
*/
|
|
61667
|
+
function abortHandshakeOrEmitwsClientError(server, req, socket, code, message) {
|
|
61668
|
+
if (server.listenerCount('wsClientError')) {
|
|
61669
|
+
const err = new Error(message);
|
|
61670
|
+
Error.captureStackTrace(err, abortHandshakeOrEmitwsClientError);
|
|
60942
61671
|
|
|
60943
|
-
|
|
60944
|
-
|
|
61672
|
+
server.emit('wsClientError', err, socket, req);
|
|
61673
|
+
} else {
|
|
61674
|
+
abortHandshake(socket, code, message);
|
|
61675
|
+
}
|
|
60945
61676
|
}
|
|
60946
61677
|
|
|
60947
61678
|
const WebSocket = websocket;
|
|
@@ -150306,7 +151037,7 @@ Please check your settings\\.`, { parse_mode: "MarkdownV2" });
|
|
|
150306
151037
|
const secretPath = `/telegraf/${bot.secretPathComponent()}`;
|
|
150307
151038
|
bot.telegram.setWebhook(`${tgConfig.web_hook}${secretPath}`).then(() => logger.info("\u{1F916} Telegram Bot is running using webhook"));
|
|
150308
151039
|
this.server.on("request", (req, res) => {
|
|
150309
|
-
if (req.url && req.url.length === secretPath.length && require$$0$
|
|
151040
|
+
if (req.url && req.url.length === secretPath.length && require$$0$9.timingSafeEqual(Buffer.from(secretPath), Buffer.from(req.url))) {
|
|
150310
151041
|
bot.webhookCallback(secretPath)(req, res);
|
|
150311
151042
|
res.statusCode = 200;
|
|
150312
151043
|
}
|
|
@@ -150375,7 +151106,7 @@ async function createStatus(app) {
|
|
|
150375
151106
|
app.use(lib$6({
|
|
150376
151107
|
secret: config.webSecret
|
|
150377
151108
|
}).unless({
|
|
150378
|
-
path: [/^\/api\/session/, /^\/telegraf/]
|
|
151109
|
+
path: [/^\/api\/session/, /^\/telegraf/, /^\/api\/config/]
|
|
150379
151110
|
}));
|
|
150380
151111
|
app.use(router$1.routes());
|
|
150381
151112
|
app.use(router$1.allowedMethods());
|
|
@@ -150400,7 +151131,7 @@ if (config.useWeb && !config.webPassword) {
|
|
|
150400
151131
|
]
|
|
150401
151132
|
}));
|
|
150402
151133
|
app.use(koaMount("/admin", koaStatic(require$$1$3.resolve(__dirname, "./dist/hotaru-admin"), { maxage: 2592e3 })));
|
|
150403
|
-
app.use(koaStatic(require$$1$3.resolve(__dirname, `./dist/${config.
|
|
151134
|
+
app.use(koaStatic(require$$1$3.resolve(__dirname, `./dist/${config.webTheme}`), { maxage: 2592e3 }));
|
|
150404
151135
|
const [server, ipc] = await createStatus(app);
|
|
150405
151136
|
server.listen(config.port, () => logger.info(`\u{1F389} NodeStatus is listening on http://127.0.0.1:${config.port}`));
|
|
150406
151137
|
ipc && ipc.listen(config.ipcAddress, () => logger.info(`\u{1F389} NodeStatus Ipc is listening on ${config.ipcAddress}`));
|