nodestatus-server 1.2.8-beta → 1.2.9-beta
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 +715 -713
- package/build/dist/classic-theme/assets/custom/style.css +0 -0
- package/build/dist/classic-theme/assets/index-CbwAqhVX.js +23 -0
- package/build/dist/classic-theme/assets/index-_NZejE1e.css +9 -0
- package/build/dist/classic-theme/index.html +3 -3
- package/build/dist/hotaru-admin/assets/LayoutHandler-u5TaO1dL.js +102 -0
- package/build/dist/hotaru-admin/assets/Login-FmJKe532.js +1 -0
- package/build/dist/hotaru-admin/assets/UserOutlined-DB7325GN.js +14 -0
- package/build/dist/hotaru-admin/assets/index-BTK7ataG.css +8 -0
- package/build/dist/hotaru-admin/assets/index-CB64fiAo.js +147 -0
- package/build/dist/hotaru-admin/index.html +2 -3
- package/build/dist/hotaru-theme/assets/custom/style.css +0 -0
- package/build/dist/hotaru-theme/assets/index-DeKygKyv.js +23 -0
- package/build/dist/hotaru-theme/assets/{index-78a4f720.css → index-mxb2KpWf.css} +24 -24
- package/build/dist/hotaru-theme/index.html +3 -3
- package/package.json +4 -4
- package/build/dist/classic-theme/assets/index-331c683d.js +0 -23
- package/build/dist/classic-theme/assets/index-719d037b.css +0 -9
- package/build/dist/hotaru-admin/assets/LayoutHandler-a88af57b.js +0 -102
- package/build/dist/hotaru-admin/assets/Login-3f718f9e.js +0 -1
- package/build/dist/hotaru-admin/assets/UserOutlined-e45e7ca2.js +0 -14
- package/build/dist/hotaru-admin/assets/index-372f4f56.js +0 -141
- package/build/dist/hotaru-admin/assets/index-b6b46a40.css +0 -8
- package/build/dist/hotaru-admin/assets/logo-32158513.svg +0 -20
- package/build/dist/hotaru-theme/assets/index-734a7c4f.js +0 -23
- /package/build/dist/classic-theme/assets/{glyphicons-halflings-regular-a26394f7.woff → glyphicons-halflings-regular-BKjkU69z.woff} +0 -0
- /package/build/dist/classic-theme/assets/{glyphicons-halflings-regular-13634da8.eot → glyphicons-halflings-regular-BUJKDMgK.eot} +0 -0
- /package/build/dist/classic-theme/assets/{glyphicons-halflings-regular-42f60659.svg → glyphicons-halflings-regular-CSehLiBc.svg} +0 -0
- /package/build/dist/classic-theme/assets/{glyphicons-halflings-regular-e3950440.ttf → glyphicons-halflings-regular-DrwTMapi.ttf} +0 -0
- /package/build/dist/classic-theme/assets/{glyphicons-halflings-regular-fe185d11.woff2 → glyphicons-halflings-regular-DzqM6ju8.woff2} +0 -0
- /package/build/dist/classic-theme/assets/{light-b83ee430.png → light-Vj0n3sgW.png} +0 -0
- /package/build/dist/hotaru-admin/assets/{bg_howatama-73b3a663.png → bg_howatama-Bc2ywde4.png} +0 -0
- /package/build/dist/hotaru-admin/assets/{cherry-d242b139.jpg → cherry-DUMkS0dU.jpg} +0 -0
- /package/build/dist/hotaru-admin/assets/{logo-80ec46a6.png → logo-CkpsJYEN.png} +0 -0
- /package/build/dist/hotaru-theme/assets/{bg-517550d0.png → bg-BIzsDHaA.png} +0 -0
- /package/build/dist/hotaru-theme/assets/{bg_parts-82c89578.png → bg_parts-B7IaUvHS.png} +0 -0
- /package/build/dist/hotaru-theme/assets/{brand-icons-6519a15b.svg → brand-icons-Cu_C0hZ4.svg} +0 -0
- /package/build/dist/hotaru-theme/assets/{brand-icons-9fafd6c3.woff → brand-icons-F3SPCeH1.woff} +0 -0
- /package/build/dist/hotaru-theme/assets/{brand-icons-e7d4d534.woff2 → brand-icons-XL9sxUpA.woff2} +0 -0
- /package/build/dist/hotaru-theme/assets/{brand-icons-d023c55f.eot → brand-icons-sqJ2Pg7a.eot} +0 -0
- /package/build/dist/hotaru-theme/assets/{brand-icons-42e369dc.ttf → brand-icons-ubhWoxly.ttf} +0 -0
- /package/build/dist/hotaru-theme/assets/{cover-5733800e.png → cover-C2wnmJ5O.png} +0 -0
- /package/build/dist/hotaru-theme/assets/{cover_mobile-27fb488e.png → cover_mobile-BAT-44NK.png} +0 -0
- /package/build/dist/hotaru-theme/assets/{flags-94d5c7f1.png → flags-DOLqOU7Y.png} +0 -0
- /package/build/dist/hotaru-theme/assets/{icons-95b6a484.woff → icons-BOCtAERH.woff} +0 -0
- /package/build/dist/hotaru-theme/assets/{icons-8b4e1b84.eot → icons-CHzK1VD9.eot} +0 -0
- /package/build/dist/hotaru-theme/assets/{icons-cb7f81f5.ttf → icons-D29ZQHHw.ttf} +0 -0
- /package/build/dist/hotaru-theme/assets/{icons-434466b5.woff2 → icons-Du6TOHnR.woff2} +0 -0
- /package/build/dist/hotaru-theme/assets/{icons-282a64fb.svg → icons-RwhydX30.svg} +0 -0
- /package/build/dist/hotaru-theme/assets/{outline-icons-ae8fd02a.svg → outline-icons-BfdLr8tr.svg} +0 -0
- /package/build/dist/hotaru-theme/assets/{outline-icons-67172172.ttf → outline-icons-DD8jm0uy.ttf} +0 -0
- /package/build/dist/hotaru-theme/assets/{outline-icons-4d288344.woff2 → outline-icons-DInHoiqI.woff2} +0 -0
- /package/build/dist/hotaru-theme/assets/{outline-icons-4537fa06.eot → outline-icons-LX8adJ4n.eot} +0 -0
- /package/build/dist/hotaru-theme/assets/{outline-icons-4bc359c2.woff → outline-icons-aQ88nltS.woff} +0 -0
package/build/app.js
CHANGED
|
@@ -21414,6 +21414,715 @@ function requireNode$1 () {
|
|
|
21414
21414
|
}
|
|
21415
21415
|
} (src$4));
|
|
21416
21416
|
|
|
21417
|
+
var httpErrorsExports$2 = {};
|
|
21418
|
+
var httpErrors$2 = {
|
|
21419
|
+
get exports(){ return httpErrorsExports$2; },
|
|
21420
|
+
set exports(v){ httpErrorsExports$2 = v; },
|
|
21421
|
+
};
|
|
21422
|
+
|
|
21423
|
+
var setprototypeof$1 = Object.setPrototypeOf || ({__proto__:[]} instanceof Array ? setProtoOf$1 : mixinProperties$1);
|
|
21424
|
+
|
|
21425
|
+
function setProtoOf$1(obj, proto) {
|
|
21426
|
+
obj.__proto__ = proto;
|
|
21427
|
+
return obj;
|
|
21428
|
+
}
|
|
21429
|
+
|
|
21430
|
+
function mixinProperties$1(obj, proto) {
|
|
21431
|
+
for (var prop in proto) {
|
|
21432
|
+
if (!obj.hasOwnProperty(prop)) {
|
|
21433
|
+
obj[prop] = proto[prop];
|
|
21434
|
+
}
|
|
21435
|
+
}
|
|
21436
|
+
return obj;
|
|
21437
|
+
}
|
|
21438
|
+
|
|
21439
|
+
var inheritsExports = {};
|
|
21440
|
+
var inherits = {
|
|
21441
|
+
get exports(){ return inheritsExports; },
|
|
21442
|
+
set exports(v){ inheritsExports = v; },
|
|
21443
|
+
};
|
|
21444
|
+
|
|
21445
|
+
var inherits_browserExports = {};
|
|
21446
|
+
var inherits_browser = {
|
|
21447
|
+
get exports(){ return inherits_browserExports; },
|
|
21448
|
+
set exports(v){ inherits_browserExports = v; },
|
|
21449
|
+
};
|
|
21450
|
+
|
|
21451
|
+
var hasRequiredInherits_browser;
|
|
21452
|
+
|
|
21453
|
+
function requireInherits_browser () {
|
|
21454
|
+
if (hasRequiredInherits_browser) return inherits_browserExports;
|
|
21455
|
+
hasRequiredInherits_browser = 1;
|
|
21456
|
+
if (typeof Object.create === 'function') {
|
|
21457
|
+
// implementation from standard node.js 'util' module
|
|
21458
|
+
inherits_browser.exports = function inherits(ctor, superCtor) {
|
|
21459
|
+
ctor.super_ = superCtor;
|
|
21460
|
+
ctor.prototype = Object.create(superCtor.prototype, {
|
|
21461
|
+
constructor: {
|
|
21462
|
+
value: ctor,
|
|
21463
|
+
enumerable: false,
|
|
21464
|
+
writable: true,
|
|
21465
|
+
configurable: true
|
|
21466
|
+
}
|
|
21467
|
+
});
|
|
21468
|
+
};
|
|
21469
|
+
} else {
|
|
21470
|
+
// old school shim for old browsers
|
|
21471
|
+
inherits_browser.exports = function inherits(ctor, superCtor) {
|
|
21472
|
+
ctor.super_ = superCtor;
|
|
21473
|
+
var TempCtor = function () {};
|
|
21474
|
+
TempCtor.prototype = superCtor.prototype;
|
|
21475
|
+
ctor.prototype = new TempCtor();
|
|
21476
|
+
ctor.prototype.constructor = ctor;
|
|
21477
|
+
};
|
|
21478
|
+
}
|
|
21479
|
+
return inherits_browserExports;
|
|
21480
|
+
}
|
|
21481
|
+
|
|
21482
|
+
(function (module) {
|
|
21483
|
+
try {
|
|
21484
|
+
var util = require('util');
|
|
21485
|
+
if (typeof util.inherits !== 'function') throw '';
|
|
21486
|
+
module.exports = util.inherits;
|
|
21487
|
+
} catch (e) {
|
|
21488
|
+
module.exports = requireInherits_browser();
|
|
21489
|
+
}
|
|
21490
|
+
} (inherits));
|
|
21491
|
+
|
|
21492
|
+
/*!
|
|
21493
|
+
* http-errors
|
|
21494
|
+
* Copyright(c) 2014 Jonathan Ong
|
|
21495
|
+
* Copyright(c) 2016 Douglas Christopher Wilson
|
|
21496
|
+
* MIT Licensed
|
|
21497
|
+
*/
|
|
21498
|
+
|
|
21499
|
+
(function (module) {
|
|
21500
|
+
|
|
21501
|
+
/**
|
|
21502
|
+
* Module dependencies.
|
|
21503
|
+
* @private
|
|
21504
|
+
*/
|
|
21505
|
+
|
|
21506
|
+
var deprecate = depd_1$1('http-errors');
|
|
21507
|
+
var setPrototypeOf = setprototypeof$1;
|
|
21508
|
+
var statuses = statuses$2;
|
|
21509
|
+
var inherits = inheritsExports;
|
|
21510
|
+
|
|
21511
|
+
/**
|
|
21512
|
+
* Module exports.
|
|
21513
|
+
* @public
|
|
21514
|
+
*/
|
|
21515
|
+
|
|
21516
|
+
module.exports = createError;
|
|
21517
|
+
module.exports.HttpError = createHttpErrorConstructor();
|
|
21518
|
+
|
|
21519
|
+
// Populate exports for all constructors
|
|
21520
|
+
populateConstructorExports(module.exports, statuses.codes, module.exports.HttpError);
|
|
21521
|
+
|
|
21522
|
+
/**
|
|
21523
|
+
* Get the code class of a status code.
|
|
21524
|
+
* @private
|
|
21525
|
+
*/
|
|
21526
|
+
|
|
21527
|
+
function codeClass (status) {
|
|
21528
|
+
return Number(String(status).charAt(0) + '00')
|
|
21529
|
+
}
|
|
21530
|
+
|
|
21531
|
+
/**
|
|
21532
|
+
* Create a new HTTP Error.
|
|
21533
|
+
*
|
|
21534
|
+
* @returns {Error}
|
|
21535
|
+
* @public
|
|
21536
|
+
*/
|
|
21537
|
+
|
|
21538
|
+
function createError () {
|
|
21539
|
+
// so much arity going on ~_~
|
|
21540
|
+
var err;
|
|
21541
|
+
var msg;
|
|
21542
|
+
var status = 500;
|
|
21543
|
+
var props = {};
|
|
21544
|
+
for (var i = 0; i < arguments.length; i++) {
|
|
21545
|
+
var arg = arguments[i];
|
|
21546
|
+
if (arg instanceof Error) {
|
|
21547
|
+
err = arg;
|
|
21548
|
+
status = err.status || err.statusCode || status;
|
|
21549
|
+
continue
|
|
21550
|
+
}
|
|
21551
|
+
switch (typeof arg) {
|
|
21552
|
+
case 'string':
|
|
21553
|
+
msg = arg;
|
|
21554
|
+
break
|
|
21555
|
+
case 'number':
|
|
21556
|
+
status = arg;
|
|
21557
|
+
if (i !== 0) {
|
|
21558
|
+
deprecate('non-first-argument status code; replace with createError(' + arg + ', ...)');
|
|
21559
|
+
}
|
|
21560
|
+
break
|
|
21561
|
+
case 'object':
|
|
21562
|
+
props = arg;
|
|
21563
|
+
break
|
|
21564
|
+
}
|
|
21565
|
+
}
|
|
21566
|
+
|
|
21567
|
+
if (typeof status === 'number' && (status < 400 || status >= 600)) {
|
|
21568
|
+
deprecate('non-error status code; use only 4xx or 5xx status codes');
|
|
21569
|
+
}
|
|
21570
|
+
|
|
21571
|
+
if (typeof status !== 'number' ||
|
|
21572
|
+
(!statuses[status] && (status < 400 || status >= 600))) {
|
|
21573
|
+
status = 500;
|
|
21574
|
+
}
|
|
21575
|
+
|
|
21576
|
+
// constructor
|
|
21577
|
+
var HttpError = createError[status] || createError[codeClass(status)];
|
|
21578
|
+
|
|
21579
|
+
if (!err) {
|
|
21580
|
+
// create error
|
|
21581
|
+
err = HttpError
|
|
21582
|
+
? new HttpError(msg)
|
|
21583
|
+
: new Error(msg || statuses[status]);
|
|
21584
|
+
Error.captureStackTrace(err, createError);
|
|
21585
|
+
}
|
|
21586
|
+
|
|
21587
|
+
if (!HttpError || !(err instanceof HttpError) || err.status !== status) {
|
|
21588
|
+
// add properties to generic error
|
|
21589
|
+
err.expose = status < 500;
|
|
21590
|
+
err.status = err.statusCode = status;
|
|
21591
|
+
}
|
|
21592
|
+
|
|
21593
|
+
for (var key in props) {
|
|
21594
|
+
if (key !== 'status' && key !== 'statusCode') {
|
|
21595
|
+
err[key] = props[key];
|
|
21596
|
+
}
|
|
21597
|
+
}
|
|
21598
|
+
|
|
21599
|
+
return err
|
|
21600
|
+
}
|
|
21601
|
+
|
|
21602
|
+
/**
|
|
21603
|
+
* Create HTTP error abstract base class.
|
|
21604
|
+
* @private
|
|
21605
|
+
*/
|
|
21606
|
+
|
|
21607
|
+
function createHttpErrorConstructor () {
|
|
21608
|
+
function HttpError () {
|
|
21609
|
+
throw new TypeError('cannot construct abstract class')
|
|
21610
|
+
}
|
|
21611
|
+
|
|
21612
|
+
inherits(HttpError, Error);
|
|
21613
|
+
|
|
21614
|
+
return HttpError
|
|
21615
|
+
}
|
|
21616
|
+
|
|
21617
|
+
/**
|
|
21618
|
+
* Create a constructor for a client error.
|
|
21619
|
+
* @private
|
|
21620
|
+
*/
|
|
21621
|
+
|
|
21622
|
+
function createClientErrorConstructor (HttpError, name, code) {
|
|
21623
|
+
var className = name.match(/Error$/) ? name : name + 'Error';
|
|
21624
|
+
|
|
21625
|
+
function ClientError (message) {
|
|
21626
|
+
// create the error object
|
|
21627
|
+
var msg = message != null ? message : statuses[code];
|
|
21628
|
+
var err = new Error(msg);
|
|
21629
|
+
|
|
21630
|
+
// capture a stack trace to the construction point
|
|
21631
|
+
Error.captureStackTrace(err, ClientError);
|
|
21632
|
+
|
|
21633
|
+
// adjust the [[Prototype]]
|
|
21634
|
+
setPrototypeOf(err, ClientError.prototype);
|
|
21635
|
+
|
|
21636
|
+
// redefine the error message
|
|
21637
|
+
Object.defineProperty(err, 'message', {
|
|
21638
|
+
enumerable: true,
|
|
21639
|
+
configurable: true,
|
|
21640
|
+
value: msg,
|
|
21641
|
+
writable: true
|
|
21642
|
+
});
|
|
21643
|
+
|
|
21644
|
+
// redefine the error name
|
|
21645
|
+
Object.defineProperty(err, 'name', {
|
|
21646
|
+
enumerable: false,
|
|
21647
|
+
configurable: true,
|
|
21648
|
+
value: className,
|
|
21649
|
+
writable: true
|
|
21650
|
+
});
|
|
21651
|
+
|
|
21652
|
+
return err
|
|
21653
|
+
}
|
|
21654
|
+
|
|
21655
|
+
inherits(ClientError, HttpError);
|
|
21656
|
+
|
|
21657
|
+
ClientError.prototype.status = code;
|
|
21658
|
+
ClientError.prototype.statusCode = code;
|
|
21659
|
+
ClientError.prototype.expose = true;
|
|
21660
|
+
|
|
21661
|
+
return ClientError
|
|
21662
|
+
}
|
|
21663
|
+
|
|
21664
|
+
/**
|
|
21665
|
+
* Create a constructor for a server error.
|
|
21666
|
+
* @private
|
|
21667
|
+
*/
|
|
21668
|
+
|
|
21669
|
+
function createServerErrorConstructor (HttpError, name, code) {
|
|
21670
|
+
var className = name.match(/Error$/) ? name : name + 'Error';
|
|
21671
|
+
|
|
21672
|
+
function ServerError (message) {
|
|
21673
|
+
// create the error object
|
|
21674
|
+
var msg = message != null ? message : statuses[code];
|
|
21675
|
+
var err = new Error(msg);
|
|
21676
|
+
|
|
21677
|
+
// capture a stack trace to the construction point
|
|
21678
|
+
Error.captureStackTrace(err, ServerError);
|
|
21679
|
+
|
|
21680
|
+
// adjust the [[Prototype]]
|
|
21681
|
+
setPrototypeOf(err, ServerError.prototype);
|
|
21682
|
+
|
|
21683
|
+
// redefine the error message
|
|
21684
|
+
Object.defineProperty(err, 'message', {
|
|
21685
|
+
enumerable: true,
|
|
21686
|
+
configurable: true,
|
|
21687
|
+
value: msg,
|
|
21688
|
+
writable: true
|
|
21689
|
+
});
|
|
21690
|
+
|
|
21691
|
+
// redefine the error name
|
|
21692
|
+
Object.defineProperty(err, 'name', {
|
|
21693
|
+
enumerable: false,
|
|
21694
|
+
configurable: true,
|
|
21695
|
+
value: className,
|
|
21696
|
+
writable: true
|
|
21697
|
+
});
|
|
21698
|
+
|
|
21699
|
+
return err
|
|
21700
|
+
}
|
|
21701
|
+
|
|
21702
|
+
inherits(ServerError, HttpError);
|
|
21703
|
+
|
|
21704
|
+
ServerError.prototype.status = code;
|
|
21705
|
+
ServerError.prototype.statusCode = code;
|
|
21706
|
+
ServerError.prototype.expose = false;
|
|
21707
|
+
|
|
21708
|
+
return ServerError
|
|
21709
|
+
}
|
|
21710
|
+
|
|
21711
|
+
/**
|
|
21712
|
+
* Populate the exports object with constructors for every error class.
|
|
21713
|
+
* @private
|
|
21714
|
+
*/
|
|
21715
|
+
|
|
21716
|
+
function populateConstructorExports (exports, codes, HttpError) {
|
|
21717
|
+
codes.forEach(function forEachCode (code) {
|
|
21718
|
+
var CodeError;
|
|
21719
|
+
var name = toIdentifier(statuses[code]);
|
|
21720
|
+
|
|
21721
|
+
switch (codeClass(code)) {
|
|
21722
|
+
case 400:
|
|
21723
|
+
CodeError = createClientErrorConstructor(HttpError, name, code);
|
|
21724
|
+
break
|
|
21725
|
+
case 500:
|
|
21726
|
+
CodeError = createServerErrorConstructor(HttpError, name, code);
|
|
21727
|
+
break
|
|
21728
|
+
}
|
|
21729
|
+
|
|
21730
|
+
if (CodeError) {
|
|
21731
|
+
// export the constructor
|
|
21732
|
+
exports[code] = CodeError;
|
|
21733
|
+
exports[name] = CodeError;
|
|
21734
|
+
}
|
|
21735
|
+
});
|
|
21736
|
+
|
|
21737
|
+
// backwards-compatibility
|
|
21738
|
+
exports["I'mateapot"] = deprecate.function(exports.ImATeapot,
|
|
21739
|
+
'"I\'mateapot"; use "ImATeapot" instead');
|
|
21740
|
+
}
|
|
21741
|
+
|
|
21742
|
+
/**
|
|
21743
|
+
* Convert a string of words to a JavaScript identifier.
|
|
21744
|
+
* @private
|
|
21745
|
+
*/
|
|
21746
|
+
|
|
21747
|
+
function toIdentifier (str) {
|
|
21748
|
+
return str.split(' ').map(function (token) {
|
|
21749
|
+
return token.slice(0, 1).toUpperCase() + token.slice(1)
|
|
21750
|
+
}).join('').replace(/[^ _0-9a-z]/gi, '')
|
|
21751
|
+
}
|
|
21752
|
+
} (httpErrors$2));
|
|
21753
|
+
|
|
21754
|
+
var pathIsAbsoluteExports = {};
|
|
21755
|
+
var pathIsAbsolute$1 = {
|
|
21756
|
+
get exports(){ return pathIsAbsoluteExports; },
|
|
21757
|
+
set exports(v){ pathIsAbsoluteExports = v; },
|
|
21758
|
+
};
|
|
21759
|
+
|
|
21760
|
+
function posix(path) {
|
|
21761
|
+
return path.charAt(0) === '/';
|
|
21762
|
+
}
|
|
21763
|
+
|
|
21764
|
+
function win32(path) {
|
|
21765
|
+
// https://github.com/nodejs/node/blob/b3fcc245fb25539909ef1d5eaa01dbf92e168633/lib/path.js#L56
|
|
21766
|
+
var splitDeviceRe = /^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?([\\\/])?([\s\S]*?)$/;
|
|
21767
|
+
var result = splitDeviceRe.exec(path);
|
|
21768
|
+
var device = result[1] || '';
|
|
21769
|
+
var isUnc = Boolean(device && device.charAt(1) !== ':');
|
|
21770
|
+
|
|
21771
|
+
// UNC paths are always absolute
|
|
21772
|
+
return Boolean(result[2] || isUnc);
|
|
21773
|
+
}
|
|
21774
|
+
|
|
21775
|
+
pathIsAbsolute$1.exports = process.platform === 'win32' ? win32 : posix;
|
|
21776
|
+
pathIsAbsoluteExports.posix = posix;
|
|
21777
|
+
pathIsAbsoluteExports.win32 = win32;
|
|
21778
|
+
|
|
21779
|
+
/*!
|
|
21780
|
+
* resolve-path
|
|
21781
|
+
* Copyright(c) 2014 Jonathan Ong
|
|
21782
|
+
* Copyright(c) 2015-2018 Douglas Christopher Wilson
|
|
21783
|
+
* MIT Licensed
|
|
21784
|
+
*/
|
|
21785
|
+
|
|
21786
|
+
/**
|
|
21787
|
+
* Module dependencies.
|
|
21788
|
+
* @private
|
|
21789
|
+
*/
|
|
21790
|
+
|
|
21791
|
+
var createError$2 = httpErrorsExports$2;
|
|
21792
|
+
var join = require$$1$3.join;
|
|
21793
|
+
var normalize$2 = require$$1$3.normalize;
|
|
21794
|
+
var pathIsAbsolute = pathIsAbsoluteExports;
|
|
21795
|
+
var resolve$2 = require$$1$3.resolve;
|
|
21796
|
+
var sep$1 = require$$1$3.sep;
|
|
21797
|
+
|
|
21798
|
+
/**
|
|
21799
|
+
* Module exports.
|
|
21800
|
+
* @public
|
|
21801
|
+
*/
|
|
21802
|
+
|
|
21803
|
+
var resolvePath_1 = resolvePath$1;
|
|
21804
|
+
|
|
21805
|
+
/**
|
|
21806
|
+
* Module variables.
|
|
21807
|
+
* @private
|
|
21808
|
+
*/
|
|
21809
|
+
|
|
21810
|
+
var UP_PATH_REGEXP = /(?:^|[\\/])\.\.(?:[\\/]|$)/;
|
|
21811
|
+
|
|
21812
|
+
/**
|
|
21813
|
+
* Resolve relative path against a root path
|
|
21814
|
+
*
|
|
21815
|
+
* @param {string} rootPath
|
|
21816
|
+
* @param {string} relativePath
|
|
21817
|
+
* @return {string}
|
|
21818
|
+
* @public
|
|
21819
|
+
*/
|
|
21820
|
+
|
|
21821
|
+
function resolvePath$1 (rootPath, relativePath) {
|
|
21822
|
+
var path = relativePath;
|
|
21823
|
+
var root = rootPath;
|
|
21824
|
+
|
|
21825
|
+
// root is optional, similar to root.resolve
|
|
21826
|
+
if (arguments.length === 1) {
|
|
21827
|
+
path = rootPath;
|
|
21828
|
+
root = process.cwd();
|
|
21829
|
+
}
|
|
21830
|
+
|
|
21831
|
+
if (root == null) {
|
|
21832
|
+
throw new TypeError('argument rootPath is required')
|
|
21833
|
+
}
|
|
21834
|
+
|
|
21835
|
+
if (typeof root !== 'string') {
|
|
21836
|
+
throw new TypeError('argument rootPath must be a string')
|
|
21837
|
+
}
|
|
21838
|
+
|
|
21839
|
+
if (path == null) {
|
|
21840
|
+
throw new TypeError('argument relativePath is required')
|
|
21841
|
+
}
|
|
21842
|
+
|
|
21843
|
+
if (typeof path !== 'string') {
|
|
21844
|
+
throw new TypeError('argument relativePath must be a string')
|
|
21845
|
+
}
|
|
21846
|
+
|
|
21847
|
+
// containing NULL bytes is malicious
|
|
21848
|
+
if (path.indexOf('\0') !== -1) {
|
|
21849
|
+
throw createError$2(400, 'Malicious Path')
|
|
21850
|
+
}
|
|
21851
|
+
|
|
21852
|
+
// path should never be absolute
|
|
21853
|
+
if (pathIsAbsolute.posix(path) || pathIsAbsolute.win32(path)) {
|
|
21854
|
+
throw createError$2(400, 'Malicious Path')
|
|
21855
|
+
}
|
|
21856
|
+
|
|
21857
|
+
// path outside root
|
|
21858
|
+
if (UP_PATH_REGEXP.test(normalize$2('.' + sep$1 + path))) {
|
|
21859
|
+
throw createError$2(403)
|
|
21860
|
+
}
|
|
21861
|
+
|
|
21862
|
+
// join the relative path
|
|
21863
|
+
return normalize$2(join(resolve$2(root), path))
|
|
21864
|
+
}
|
|
21865
|
+
|
|
21866
|
+
/**
|
|
21867
|
+
* Module dependencies.
|
|
21868
|
+
*/
|
|
21869
|
+
|
|
21870
|
+
const fs$q = require$$0$8;
|
|
21871
|
+
const util$b = require$$1$2;
|
|
21872
|
+
const debug$u = srcExports$2('koa-send');
|
|
21873
|
+
const resolvePath = resolvePath_1;
|
|
21874
|
+
const createError$1 = httpErrorsExports$3;
|
|
21875
|
+
const assert$3 = require$$2$3;
|
|
21876
|
+
|
|
21877
|
+
const stat$5 = util$b.promisify(fs$q.stat);
|
|
21878
|
+
const access = util$b.promisify(fs$q.access);
|
|
21879
|
+
|
|
21880
|
+
async function exists (path) {
|
|
21881
|
+
try {
|
|
21882
|
+
await access(path);
|
|
21883
|
+
return true
|
|
21884
|
+
} catch (e) {
|
|
21885
|
+
return false
|
|
21886
|
+
}
|
|
21887
|
+
}
|
|
21888
|
+
|
|
21889
|
+
const {
|
|
21890
|
+
normalize: normalize$1,
|
|
21891
|
+
basename,
|
|
21892
|
+
extname,
|
|
21893
|
+
resolve: resolve$1,
|
|
21894
|
+
parse: parse$i,
|
|
21895
|
+
sep
|
|
21896
|
+
} = require$$1$3;
|
|
21897
|
+
|
|
21898
|
+
/**
|
|
21899
|
+
* Expose `send()`.
|
|
21900
|
+
*/
|
|
21901
|
+
|
|
21902
|
+
var koaSend = send$1;
|
|
21903
|
+
|
|
21904
|
+
/**
|
|
21905
|
+
* Send file at `path` with the
|
|
21906
|
+
* given `options` to the koa `ctx`.
|
|
21907
|
+
*
|
|
21908
|
+
* @param {Context} ctx
|
|
21909
|
+
* @param {String} path
|
|
21910
|
+
* @param {Object} [opts]
|
|
21911
|
+
* @return {Promise}
|
|
21912
|
+
* @api public
|
|
21913
|
+
*/
|
|
21914
|
+
|
|
21915
|
+
async function send$1 (ctx, path, opts = {}) {
|
|
21916
|
+
assert$3(ctx, 'koa context required');
|
|
21917
|
+
assert$3(path, 'pathname required');
|
|
21918
|
+
|
|
21919
|
+
// options
|
|
21920
|
+
debug$u('send "%s" %j', path, opts);
|
|
21921
|
+
const root = opts.root ? normalize$1(resolve$1(opts.root)) : '';
|
|
21922
|
+
const trailingSlash = path[path.length - 1] === '/';
|
|
21923
|
+
path = path.substr(parse$i(path).root.length);
|
|
21924
|
+
const index = opts.index;
|
|
21925
|
+
const maxage = opts.maxage || opts.maxAge || 0;
|
|
21926
|
+
const immutable = opts.immutable || false;
|
|
21927
|
+
const hidden = opts.hidden || false;
|
|
21928
|
+
const format = opts.format !== false;
|
|
21929
|
+
const extensions = Array.isArray(opts.extensions) ? opts.extensions : false;
|
|
21930
|
+
const brotli = opts.brotli !== false;
|
|
21931
|
+
const gzip = opts.gzip !== false;
|
|
21932
|
+
const setHeaders = opts.setHeaders;
|
|
21933
|
+
|
|
21934
|
+
if (setHeaders && typeof setHeaders !== 'function') {
|
|
21935
|
+
throw new TypeError('option setHeaders must be function')
|
|
21936
|
+
}
|
|
21937
|
+
|
|
21938
|
+
// normalize path
|
|
21939
|
+
path = decode$8(path);
|
|
21940
|
+
|
|
21941
|
+
if (path === -1) return ctx.throw(400, 'failed to decode')
|
|
21942
|
+
|
|
21943
|
+
// index file support
|
|
21944
|
+
if (index && trailingSlash) path += index;
|
|
21945
|
+
|
|
21946
|
+
path = resolvePath(root, path);
|
|
21947
|
+
|
|
21948
|
+
// hidden file support, ignore
|
|
21949
|
+
if (!hidden && isHidden(root, path)) return
|
|
21950
|
+
|
|
21951
|
+
let encodingExt = '';
|
|
21952
|
+
// serve brotli file when possible otherwise gzipped file when possible
|
|
21953
|
+
if (ctx.acceptsEncodings('br', 'identity') === 'br' && brotli && (await exists(path + '.br'))) {
|
|
21954
|
+
path = path + '.br';
|
|
21955
|
+
ctx.set('Content-Encoding', 'br');
|
|
21956
|
+
ctx.res.removeHeader('Content-Length');
|
|
21957
|
+
encodingExt = '.br';
|
|
21958
|
+
} else if (ctx.acceptsEncodings('gzip', 'identity') === 'gzip' && gzip && (await exists(path + '.gz'))) {
|
|
21959
|
+
path = path + '.gz';
|
|
21960
|
+
ctx.set('Content-Encoding', 'gzip');
|
|
21961
|
+
ctx.res.removeHeader('Content-Length');
|
|
21962
|
+
encodingExt = '.gz';
|
|
21963
|
+
}
|
|
21964
|
+
|
|
21965
|
+
if (extensions && !/\./.exec(basename(path))) {
|
|
21966
|
+
const list = [].concat(extensions);
|
|
21967
|
+
for (let i = 0; i < list.length; i++) {
|
|
21968
|
+
let ext = list[i];
|
|
21969
|
+
if (typeof ext !== 'string') {
|
|
21970
|
+
throw new TypeError('option extensions must be array of strings or false')
|
|
21971
|
+
}
|
|
21972
|
+
if (!/^\./.exec(ext)) ext = `.${ext}`;
|
|
21973
|
+
if (await exists(`${path}${ext}`)) {
|
|
21974
|
+
path = `${path}${ext}`;
|
|
21975
|
+
break
|
|
21976
|
+
}
|
|
21977
|
+
}
|
|
21978
|
+
}
|
|
21979
|
+
|
|
21980
|
+
// stat
|
|
21981
|
+
let stats;
|
|
21982
|
+
try {
|
|
21983
|
+
stats = await stat$5(path);
|
|
21984
|
+
|
|
21985
|
+
// Format the path to serve static file servers
|
|
21986
|
+
// and not require a trailing slash for directories,
|
|
21987
|
+
// so that you can do both `/directory` and `/directory/`
|
|
21988
|
+
if (stats.isDirectory()) {
|
|
21989
|
+
if (format && index) {
|
|
21990
|
+
path += `/${index}`;
|
|
21991
|
+
stats = await stat$5(path);
|
|
21992
|
+
} else {
|
|
21993
|
+
return
|
|
21994
|
+
}
|
|
21995
|
+
}
|
|
21996
|
+
} catch (err) {
|
|
21997
|
+
const notfound = ['ENOENT', 'ENAMETOOLONG', 'ENOTDIR'];
|
|
21998
|
+
if (notfound.includes(err.code)) {
|
|
21999
|
+
throw createError$1(404, err)
|
|
22000
|
+
}
|
|
22001
|
+
err.status = 500;
|
|
22002
|
+
throw err
|
|
22003
|
+
}
|
|
22004
|
+
|
|
22005
|
+
if (setHeaders) setHeaders(ctx.res, path, stats);
|
|
22006
|
+
|
|
22007
|
+
// stream
|
|
22008
|
+
ctx.set('Content-Length', stats.size);
|
|
22009
|
+
if (!ctx.response.get('Last-Modified')) ctx.set('Last-Modified', stats.mtime.toUTCString());
|
|
22010
|
+
if (!ctx.response.get('Cache-Control')) {
|
|
22011
|
+
const directives = [`max-age=${(maxage / 1000 | 0)}`];
|
|
22012
|
+
if (immutable) {
|
|
22013
|
+
directives.push('immutable');
|
|
22014
|
+
}
|
|
22015
|
+
ctx.set('Cache-Control', directives.join(','));
|
|
22016
|
+
}
|
|
22017
|
+
if (!ctx.type) ctx.type = type(path, encodingExt);
|
|
22018
|
+
ctx.body = fs$q.createReadStream(path);
|
|
22019
|
+
|
|
22020
|
+
return path
|
|
22021
|
+
}
|
|
22022
|
+
|
|
22023
|
+
/**
|
|
22024
|
+
* Check if it's hidden.
|
|
22025
|
+
*/
|
|
22026
|
+
|
|
22027
|
+
function isHidden (root, path) {
|
|
22028
|
+
path = path.substr(root.length).split(sep);
|
|
22029
|
+
for (let i = 0; i < path.length; i++) {
|
|
22030
|
+
if (path[i][0] === '.') return true
|
|
22031
|
+
}
|
|
22032
|
+
return false
|
|
22033
|
+
}
|
|
22034
|
+
|
|
22035
|
+
/**
|
|
22036
|
+
* File type.
|
|
22037
|
+
*/
|
|
22038
|
+
|
|
22039
|
+
function type (file, ext) {
|
|
22040
|
+
return ext !== '' ? extname(basename(file, ext)) : extname(file)
|
|
22041
|
+
}
|
|
22042
|
+
|
|
22043
|
+
/**
|
|
22044
|
+
* Decode `path`.
|
|
22045
|
+
*/
|
|
22046
|
+
|
|
22047
|
+
function decode$8 (path) {
|
|
22048
|
+
try {
|
|
22049
|
+
return decodeURIComponent(path)
|
|
22050
|
+
} catch (err) {
|
|
22051
|
+
return -1
|
|
22052
|
+
}
|
|
22053
|
+
}
|
|
22054
|
+
|
|
22055
|
+
/**
|
|
22056
|
+
* Module dependencies.
|
|
22057
|
+
*/
|
|
22058
|
+
|
|
22059
|
+
const debug$t = srcExports$1('koa-static');
|
|
22060
|
+
const { resolve } = require$$1$3;
|
|
22061
|
+
const assert$2 = require$$2$3;
|
|
22062
|
+
const send = koaSend;
|
|
22063
|
+
|
|
22064
|
+
/**
|
|
22065
|
+
* Expose `serve()`.
|
|
22066
|
+
*/
|
|
22067
|
+
|
|
22068
|
+
var koaStatic = serve;
|
|
22069
|
+
|
|
22070
|
+
/**
|
|
22071
|
+
* Serve static files from `root`.
|
|
22072
|
+
*
|
|
22073
|
+
* @param {String} root
|
|
22074
|
+
* @param {Object} [opts]
|
|
22075
|
+
* @return {Function}
|
|
22076
|
+
* @api public
|
|
22077
|
+
*/
|
|
22078
|
+
|
|
22079
|
+
function serve (root, opts) {
|
|
22080
|
+
opts = Object.assign({}, opts);
|
|
22081
|
+
|
|
22082
|
+
assert$2(root, 'root directory is required to serve files');
|
|
22083
|
+
|
|
22084
|
+
// options
|
|
22085
|
+
debug$t('static "%s" %j', root, opts);
|
|
22086
|
+
opts.root = resolve(root);
|
|
22087
|
+
if (opts.index !== false) opts.index = opts.index || 'index.html';
|
|
22088
|
+
|
|
22089
|
+
if (!opts.defer) {
|
|
22090
|
+
return async function serve (ctx, next) {
|
|
22091
|
+
let done = false;
|
|
22092
|
+
|
|
22093
|
+
if (ctx.method === 'HEAD' || ctx.method === 'GET') {
|
|
22094
|
+
try {
|
|
22095
|
+
done = await send(ctx, ctx.path, opts);
|
|
22096
|
+
} catch (err) {
|
|
22097
|
+
if (err.status !== 404) {
|
|
22098
|
+
throw err
|
|
22099
|
+
}
|
|
22100
|
+
}
|
|
22101
|
+
}
|
|
22102
|
+
|
|
22103
|
+
if (!done) {
|
|
22104
|
+
await next();
|
|
22105
|
+
}
|
|
22106
|
+
}
|
|
22107
|
+
}
|
|
22108
|
+
|
|
22109
|
+
return async function serve (ctx, next) {
|
|
22110
|
+
await next();
|
|
22111
|
+
|
|
22112
|
+
if (ctx.method !== 'HEAD' && ctx.method !== 'GET') return
|
|
22113
|
+
// response is already handled
|
|
22114
|
+
if (ctx.body != null || ctx.status !== 404) return // eslint-disable-line
|
|
22115
|
+
|
|
22116
|
+
try {
|
|
22117
|
+
await send(ctx, ctx.path, opts);
|
|
22118
|
+
} catch (err) {
|
|
22119
|
+
if (err.status !== 404) {
|
|
22120
|
+
throw err
|
|
22121
|
+
}
|
|
22122
|
+
}
|
|
22123
|
+
}
|
|
22124
|
+
}
|
|
22125
|
+
|
|
21417
22126
|
var srcExports = {};
|
|
21418
22127
|
var src$3 = {
|
|
21419
22128
|
get exports(){ return srcExports; },
|
|
@@ -22279,715 +22988,6 @@ function requireNode () {
|
|
|
22279
22988
|
}
|
|
22280
22989
|
} (src$3));
|
|
22281
22990
|
|
|
22282
|
-
var httpErrorsExports$2 = {};
|
|
22283
|
-
var httpErrors$2 = {
|
|
22284
|
-
get exports(){ return httpErrorsExports$2; },
|
|
22285
|
-
set exports(v){ httpErrorsExports$2 = v; },
|
|
22286
|
-
};
|
|
22287
|
-
|
|
22288
|
-
var setprototypeof$1 = Object.setPrototypeOf || ({__proto__:[]} instanceof Array ? setProtoOf$1 : mixinProperties$1);
|
|
22289
|
-
|
|
22290
|
-
function setProtoOf$1(obj, proto) {
|
|
22291
|
-
obj.__proto__ = proto;
|
|
22292
|
-
return obj;
|
|
22293
|
-
}
|
|
22294
|
-
|
|
22295
|
-
function mixinProperties$1(obj, proto) {
|
|
22296
|
-
for (var prop in proto) {
|
|
22297
|
-
if (!obj.hasOwnProperty(prop)) {
|
|
22298
|
-
obj[prop] = proto[prop];
|
|
22299
|
-
}
|
|
22300
|
-
}
|
|
22301
|
-
return obj;
|
|
22302
|
-
}
|
|
22303
|
-
|
|
22304
|
-
var inheritsExports = {};
|
|
22305
|
-
var inherits = {
|
|
22306
|
-
get exports(){ return inheritsExports; },
|
|
22307
|
-
set exports(v){ inheritsExports = v; },
|
|
22308
|
-
};
|
|
22309
|
-
|
|
22310
|
-
var inherits_browserExports = {};
|
|
22311
|
-
var inherits_browser = {
|
|
22312
|
-
get exports(){ return inherits_browserExports; },
|
|
22313
|
-
set exports(v){ inherits_browserExports = v; },
|
|
22314
|
-
};
|
|
22315
|
-
|
|
22316
|
-
var hasRequiredInherits_browser;
|
|
22317
|
-
|
|
22318
|
-
function requireInherits_browser () {
|
|
22319
|
-
if (hasRequiredInherits_browser) return inherits_browserExports;
|
|
22320
|
-
hasRequiredInherits_browser = 1;
|
|
22321
|
-
if (typeof Object.create === 'function') {
|
|
22322
|
-
// implementation from standard node.js 'util' module
|
|
22323
|
-
inherits_browser.exports = function inherits(ctor, superCtor) {
|
|
22324
|
-
ctor.super_ = superCtor;
|
|
22325
|
-
ctor.prototype = Object.create(superCtor.prototype, {
|
|
22326
|
-
constructor: {
|
|
22327
|
-
value: ctor,
|
|
22328
|
-
enumerable: false,
|
|
22329
|
-
writable: true,
|
|
22330
|
-
configurable: true
|
|
22331
|
-
}
|
|
22332
|
-
});
|
|
22333
|
-
};
|
|
22334
|
-
} else {
|
|
22335
|
-
// old school shim for old browsers
|
|
22336
|
-
inherits_browser.exports = function inherits(ctor, superCtor) {
|
|
22337
|
-
ctor.super_ = superCtor;
|
|
22338
|
-
var TempCtor = function () {};
|
|
22339
|
-
TempCtor.prototype = superCtor.prototype;
|
|
22340
|
-
ctor.prototype = new TempCtor();
|
|
22341
|
-
ctor.prototype.constructor = ctor;
|
|
22342
|
-
};
|
|
22343
|
-
}
|
|
22344
|
-
return inherits_browserExports;
|
|
22345
|
-
}
|
|
22346
|
-
|
|
22347
|
-
(function (module) {
|
|
22348
|
-
try {
|
|
22349
|
-
var util = require('util');
|
|
22350
|
-
if (typeof util.inherits !== 'function') throw '';
|
|
22351
|
-
module.exports = util.inherits;
|
|
22352
|
-
} catch (e) {
|
|
22353
|
-
module.exports = requireInherits_browser();
|
|
22354
|
-
}
|
|
22355
|
-
} (inherits));
|
|
22356
|
-
|
|
22357
|
-
/*!
|
|
22358
|
-
* http-errors
|
|
22359
|
-
* Copyright(c) 2014 Jonathan Ong
|
|
22360
|
-
* Copyright(c) 2016 Douglas Christopher Wilson
|
|
22361
|
-
* MIT Licensed
|
|
22362
|
-
*/
|
|
22363
|
-
|
|
22364
|
-
(function (module) {
|
|
22365
|
-
|
|
22366
|
-
/**
|
|
22367
|
-
* Module dependencies.
|
|
22368
|
-
* @private
|
|
22369
|
-
*/
|
|
22370
|
-
|
|
22371
|
-
var deprecate = depd_1$1('http-errors');
|
|
22372
|
-
var setPrototypeOf = setprototypeof$1;
|
|
22373
|
-
var statuses = statuses$2;
|
|
22374
|
-
var inherits = inheritsExports;
|
|
22375
|
-
|
|
22376
|
-
/**
|
|
22377
|
-
* Module exports.
|
|
22378
|
-
* @public
|
|
22379
|
-
*/
|
|
22380
|
-
|
|
22381
|
-
module.exports = createError;
|
|
22382
|
-
module.exports.HttpError = createHttpErrorConstructor();
|
|
22383
|
-
|
|
22384
|
-
// Populate exports for all constructors
|
|
22385
|
-
populateConstructorExports(module.exports, statuses.codes, module.exports.HttpError);
|
|
22386
|
-
|
|
22387
|
-
/**
|
|
22388
|
-
* Get the code class of a status code.
|
|
22389
|
-
* @private
|
|
22390
|
-
*/
|
|
22391
|
-
|
|
22392
|
-
function codeClass (status) {
|
|
22393
|
-
return Number(String(status).charAt(0) + '00')
|
|
22394
|
-
}
|
|
22395
|
-
|
|
22396
|
-
/**
|
|
22397
|
-
* Create a new HTTP Error.
|
|
22398
|
-
*
|
|
22399
|
-
* @returns {Error}
|
|
22400
|
-
* @public
|
|
22401
|
-
*/
|
|
22402
|
-
|
|
22403
|
-
function createError () {
|
|
22404
|
-
// so much arity going on ~_~
|
|
22405
|
-
var err;
|
|
22406
|
-
var msg;
|
|
22407
|
-
var status = 500;
|
|
22408
|
-
var props = {};
|
|
22409
|
-
for (var i = 0; i < arguments.length; i++) {
|
|
22410
|
-
var arg = arguments[i];
|
|
22411
|
-
if (arg instanceof Error) {
|
|
22412
|
-
err = arg;
|
|
22413
|
-
status = err.status || err.statusCode || status;
|
|
22414
|
-
continue
|
|
22415
|
-
}
|
|
22416
|
-
switch (typeof arg) {
|
|
22417
|
-
case 'string':
|
|
22418
|
-
msg = arg;
|
|
22419
|
-
break
|
|
22420
|
-
case 'number':
|
|
22421
|
-
status = arg;
|
|
22422
|
-
if (i !== 0) {
|
|
22423
|
-
deprecate('non-first-argument status code; replace with createError(' + arg + ', ...)');
|
|
22424
|
-
}
|
|
22425
|
-
break
|
|
22426
|
-
case 'object':
|
|
22427
|
-
props = arg;
|
|
22428
|
-
break
|
|
22429
|
-
}
|
|
22430
|
-
}
|
|
22431
|
-
|
|
22432
|
-
if (typeof status === 'number' && (status < 400 || status >= 600)) {
|
|
22433
|
-
deprecate('non-error status code; use only 4xx or 5xx status codes');
|
|
22434
|
-
}
|
|
22435
|
-
|
|
22436
|
-
if (typeof status !== 'number' ||
|
|
22437
|
-
(!statuses[status] && (status < 400 || status >= 600))) {
|
|
22438
|
-
status = 500;
|
|
22439
|
-
}
|
|
22440
|
-
|
|
22441
|
-
// constructor
|
|
22442
|
-
var HttpError = createError[status] || createError[codeClass(status)];
|
|
22443
|
-
|
|
22444
|
-
if (!err) {
|
|
22445
|
-
// create error
|
|
22446
|
-
err = HttpError
|
|
22447
|
-
? new HttpError(msg)
|
|
22448
|
-
: new Error(msg || statuses[status]);
|
|
22449
|
-
Error.captureStackTrace(err, createError);
|
|
22450
|
-
}
|
|
22451
|
-
|
|
22452
|
-
if (!HttpError || !(err instanceof HttpError) || err.status !== status) {
|
|
22453
|
-
// add properties to generic error
|
|
22454
|
-
err.expose = status < 500;
|
|
22455
|
-
err.status = err.statusCode = status;
|
|
22456
|
-
}
|
|
22457
|
-
|
|
22458
|
-
for (var key in props) {
|
|
22459
|
-
if (key !== 'status' && key !== 'statusCode') {
|
|
22460
|
-
err[key] = props[key];
|
|
22461
|
-
}
|
|
22462
|
-
}
|
|
22463
|
-
|
|
22464
|
-
return err
|
|
22465
|
-
}
|
|
22466
|
-
|
|
22467
|
-
/**
|
|
22468
|
-
* Create HTTP error abstract base class.
|
|
22469
|
-
* @private
|
|
22470
|
-
*/
|
|
22471
|
-
|
|
22472
|
-
function createHttpErrorConstructor () {
|
|
22473
|
-
function HttpError () {
|
|
22474
|
-
throw new TypeError('cannot construct abstract class')
|
|
22475
|
-
}
|
|
22476
|
-
|
|
22477
|
-
inherits(HttpError, Error);
|
|
22478
|
-
|
|
22479
|
-
return HttpError
|
|
22480
|
-
}
|
|
22481
|
-
|
|
22482
|
-
/**
|
|
22483
|
-
* Create a constructor for a client error.
|
|
22484
|
-
* @private
|
|
22485
|
-
*/
|
|
22486
|
-
|
|
22487
|
-
function createClientErrorConstructor (HttpError, name, code) {
|
|
22488
|
-
var className = name.match(/Error$/) ? name : name + 'Error';
|
|
22489
|
-
|
|
22490
|
-
function ClientError (message) {
|
|
22491
|
-
// create the error object
|
|
22492
|
-
var msg = message != null ? message : statuses[code];
|
|
22493
|
-
var err = new Error(msg);
|
|
22494
|
-
|
|
22495
|
-
// capture a stack trace to the construction point
|
|
22496
|
-
Error.captureStackTrace(err, ClientError);
|
|
22497
|
-
|
|
22498
|
-
// adjust the [[Prototype]]
|
|
22499
|
-
setPrototypeOf(err, ClientError.prototype);
|
|
22500
|
-
|
|
22501
|
-
// redefine the error message
|
|
22502
|
-
Object.defineProperty(err, 'message', {
|
|
22503
|
-
enumerable: true,
|
|
22504
|
-
configurable: true,
|
|
22505
|
-
value: msg,
|
|
22506
|
-
writable: true
|
|
22507
|
-
});
|
|
22508
|
-
|
|
22509
|
-
// redefine the error name
|
|
22510
|
-
Object.defineProperty(err, 'name', {
|
|
22511
|
-
enumerable: false,
|
|
22512
|
-
configurable: true,
|
|
22513
|
-
value: className,
|
|
22514
|
-
writable: true
|
|
22515
|
-
});
|
|
22516
|
-
|
|
22517
|
-
return err
|
|
22518
|
-
}
|
|
22519
|
-
|
|
22520
|
-
inherits(ClientError, HttpError);
|
|
22521
|
-
|
|
22522
|
-
ClientError.prototype.status = code;
|
|
22523
|
-
ClientError.prototype.statusCode = code;
|
|
22524
|
-
ClientError.prototype.expose = true;
|
|
22525
|
-
|
|
22526
|
-
return ClientError
|
|
22527
|
-
}
|
|
22528
|
-
|
|
22529
|
-
/**
|
|
22530
|
-
* Create a constructor for a server error.
|
|
22531
|
-
* @private
|
|
22532
|
-
*/
|
|
22533
|
-
|
|
22534
|
-
function createServerErrorConstructor (HttpError, name, code) {
|
|
22535
|
-
var className = name.match(/Error$/) ? name : name + 'Error';
|
|
22536
|
-
|
|
22537
|
-
function ServerError (message) {
|
|
22538
|
-
// create the error object
|
|
22539
|
-
var msg = message != null ? message : statuses[code];
|
|
22540
|
-
var err = new Error(msg);
|
|
22541
|
-
|
|
22542
|
-
// capture a stack trace to the construction point
|
|
22543
|
-
Error.captureStackTrace(err, ServerError);
|
|
22544
|
-
|
|
22545
|
-
// adjust the [[Prototype]]
|
|
22546
|
-
setPrototypeOf(err, ServerError.prototype);
|
|
22547
|
-
|
|
22548
|
-
// redefine the error message
|
|
22549
|
-
Object.defineProperty(err, 'message', {
|
|
22550
|
-
enumerable: true,
|
|
22551
|
-
configurable: true,
|
|
22552
|
-
value: msg,
|
|
22553
|
-
writable: true
|
|
22554
|
-
});
|
|
22555
|
-
|
|
22556
|
-
// redefine the error name
|
|
22557
|
-
Object.defineProperty(err, 'name', {
|
|
22558
|
-
enumerable: false,
|
|
22559
|
-
configurable: true,
|
|
22560
|
-
value: className,
|
|
22561
|
-
writable: true
|
|
22562
|
-
});
|
|
22563
|
-
|
|
22564
|
-
return err
|
|
22565
|
-
}
|
|
22566
|
-
|
|
22567
|
-
inherits(ServerError, HttpError);
|
|
22568
|
-
|
|
22569
|
-
ServerError.prototype.status = code;
|
|
22570
|
-
ServerError.prototype.statusCode = code;
|
|
22571
|
-
ServerError.prototype.expose = false;
|
|
22572
|
-
|
|
22573
|
-
return ServerError
|
|
22574
|
-
}
|
|
22575
|
-
|
|
22576
|
-
/**
|
|
22577
|
-
* Populate the exports object with constructors for every error class.
|
|
22578
|
-
* @private
|
|
22579
|
-
*/
|
|
22580
|
-
|
|
22581
|
-
function populateConstructorExports (exports, codes, HttpError) {
|
|
22582
|
-
codes.forEach(function forEachCode (code) {
|
|
22583
|
-
var CodeError;
|
|
22584
|
-
var name = toIdentifier(statuses[code]);
|
|
22585
|
-
|
|
22586
|
-
switch (codeClass(code)) {
|
|
22587
|
-
case 400:
|
|
22588
|
-
CodeError = createClientErrorConstructor(HttpError, name, code);
|
|
22589
|
-
break
|
|
22590
|
-
case 500:
|
|
22591
|
-
CodeError = createServerErrorConstructor(HttpError, name, code);
|
|
22592
|
-
break
|
|
22593
|
-
}
|
|
22594
|
-
|
|
22595
|
-
if (CodeError) {
|
|
22596
|
-
// export the constructor
|
|
22597
|
-
exports[code] = CodeError;
|
|
22598
|
-
exports[name] = CodeError;
|
|
22599
|
-
}
|
|
22600
|
-
});
|
|
22601
|
-
|
|
22602
|
-
// backwards-compatibility
|
|
22603
|
-
exports["I'mateapot"] = deprecate.function(exports.ImATeapot,
|
|
22604
|
-
'"I\'mateapot"; use "ImATeapot" instead');
|
|
22605
|
-
}
|
|
22606
|
-
|
|
22607
|
-
/**
|
|
22608
|
-
* Convert a string of words to a JavaScript identifier.
|
|
22609
|
-
* @private
|
|
22610
|
-
*/
|
|
22611
|
-
|
|
22612
|
-
function toIdentifier (str) {
|
|
22613
|
-
return str.split(' ').map(function (token) {
|
|
22614
|
-
return token.slice(0, 1).toUpperCase() + token.slice(1)
|
|
22615
|
-
}).join('').replace(/[^ _0-9a-z]/gi, '')
|
|
22616
|
-
}
|
|
22617
|
-
} (httpErrors$2));
|
|
22618
|
-
|
|
22619
|
-
var pathIsAbsoluteExports = {};
|
|
22620
|
-
var pathIsAbsolute$1 = {
|
|
22621
|
-
get exports(){ return pathIsAbsoluteExports; },
|
|
22622
|
-
set exports(v){ pathIsAbsoluteExports = v; },
|
|
22623
|
-
};
|
|
22624
|
-
|
|
22625
|
-
function posix(path) {
|
|
22626
|
-
return path.charAt(0) === '/';
|
|
22627
|
-
}
|
|
22628
|
-
|
|
22629
|
-
function win32(path) {
|
|
22630
|
-
// https://github.com/nodejs/node/blob/b3fcc245fb25539909ef1d5eaa01dbf92e168633/lib/path.js#L56
|
|
22631
|
-
var splitDeviceRe = /^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?([\\\/])?([\s\S]*?)$/;
|
|
22632
|
-
var result = splitDeviceRe.exec(path);
|
|
22633
|
-
var device = result[1] || '';
|
|
22634
|
-
var isUnc = Boolean(device && device.charAt(1) !== ':');
|
|
22635
|
-
|
|
22636
|
-
// UNC paths are always absolute
|
|
22637
|
-
return Boolean(result[2] || isUnc);
|
|
22638
|
-
}
|
|
22639
|
-
|
|
22640
|
-
pathIsAbsolute$1.exports = process.platform === 'win32' ? win32 : posix;
|
|
22641
|
-
pathIsAbsoluteExports.posix = posix;
|
|
22642
|
-
pathIsAbsoluteExports.win32 = win32;
|
|
22643
|
-
|
|
22644
|
-
/*!
|
|
22645
|
-
* resolve-path
|
|
22646
|
-
* Copyright(c) 2014 Jonathan Ong
|
|
22647
|
-
* Copyright(c) 2015-2018 Douglas Christopher Wilson
|
|
22648
|
-
* MIT Licensed
|
|
22649
|
-
*/
|
|
22650
|
-
|
|
22651
|
-
/**
|
|
22652
|
-
* Module dependencies.
|
|
22653
|
-
* @private
|
|
22654
|
-
*/
|
|
22655
|
-
|
|
22656
|
-
var createError$2 = httpErrorsExports$2;
|
|
22657
|
-
var join = require$$1$3.join;
|
|
22658
|
-
var normalize$2 = require$$1$3.normalize;
|
|
22659
|
-
var pathIsAbsolute = pathIsAbsoluteExports;
|
|
22660
|
-
var resolve$2 = require$$1$3.resolve;
|
|
22661
|
-
var sep$1 = require$$1$3.sep;
|
|
22662
|
-
|
|
22663
|
-
/**
|
|
22664
|
-
* Module exports.
|
|
22665
|
-
* @public
|
|
22666
|
-
*/
|
|
22667
|
-
|
|
22668
|
-
var resolvePath_1 = resolvePath$1;
|
|
22669
|
-
|
|
22670
|
-
/**
|
|
22671
|
-
* Module variables.
|
|
22672
|
-
* @private
|
|
22673
|
-
*/
|
|
22674
|
-
|
|
22675
|
-
var UP_PATH_REGEXP = /(?:^|[\\/])\.\.(?:[\\/]|$)/;
|
|
22676
|
-
|
|
22677
|
-
/**
|
|
22678
|
-
* Resolve relative path against a root path
|
|
22679
|
-
*
|
|
22680
|
-
* @param {string} rootPath
|
|
22681
|
-
* @param {string} relativePath
|
|
22682
|
-
* @return {string}
|
|
22683
|
-
* @public
|
|
22684
|
-
*/
|
|
22685
|
-
|
|
22686
|
-
function resolvePath$1 (rootPath, relativePath) {
|
|
22687
|
-
var path = relativePath;
|
|
22688
|
-
var root = rootPath;
|
|
22689
|
-
|
|
22690
|
-
// root is optional, similar to root.resolve
|
|
22691
|
-
if (arguments.length === 1) {
|
|
22692
|
-
path = rootPath;
|
|
22693
|
-
root = process.cwd();
|
|
22694
|
-
}
|
|
22695
|
-
|
|
22696
|
-
if (root == null) {
|
|
22697
|
-
throw new TypeError('argument rootPath is required')
|
|
22698
|
-
}
|
|
22699
|
-
|
|
22700
|
-
if (typeof root !== 'string') {
|
|
22701
|
-
throw new TypeError('argument rootPath must be a string')
|
|
22702
|
-
}
|
|
22703
|
-
|
|
22704
|
-
if (path == null) {
|
|
22705
|
-
throw new TypeError('argument relativePath is required')
|
|
22706
|
-
}
|
|
22707
|
-
|
|
22708
|
-
if (typeof path !== 'string') {
|
|
22709
|
-
throw new TypeError('argument relativePath must be a string')
|
|
22710
|
-
}
|
|
22711
|
-
|
|
22712
|
-
// containing NULL bytes is malicious
|
|
22713
|
-
if (path.indexOf('\0') !== -1) {
|
|
22714
|
-
throw createError$2(400, 'Malicious Path')
|
|
22715
|
-
}
|
|
22716
|
-
|
|
22717
|
-
// path should never be absolute
|
|
22718
|
-
if (pathIsAbsolute.posix(path) || pathIsAbsolute.win32(path)) {
|
|
22719
|
-
throw createError$2(400, 'Malicious Path')
|
|
22720
|
-
}
|
|
22721
|
-
|
|
22722
|
-
// path outside root
|
|
22723
|
-
if (UP_PATH_REGEXP.test(normalize$2('.' + sep$1 + path))) {
|
|
22724
|
-
throw createError$2(403)
|
|
22725
|
-
}
|
|
22726
|
-
|
|
22727
|
-
// join the relative path
|
|
22728
|
-
return normalize$2(join(resolve$2(root), path))
|
|
22729
|
-
}
|
|
22730
|
-
|
|
22731
|
-
/**
|
|
22732
|
-
* Module dependencies.
|
|
22733
|
-
*/
|
|
22734
|
-
|
|
22735
|
-
const fs$q = require$$0$8;
|
|
22736
|
-
const util$b = require$$1$2;
|
|
22737
|
-
const debug$u = srcExports('koa-send');
|
|
22738
|
-
const resolvePath = resolvePath_1;
|
|
22739
|
-
const createError$1 = httpErrorsExports$3;
|
|
22740
|
-
const assert$3 = require$$2$3;
|
|
22741
|
-
|
|
22742
|
-
const stat$5 = util$b.promisify(fs$q.stat);
|
|
22743
|
-
const access = util$b.promisify(fs$q.access);
|
|
22744
|
-
|
|
22745
|
-
async function exists (path) {
|
|
22746
|
-
try {
|
|
22747
|
-
await access(path);
|
|
22748
|
-
return true
|
|
22749
|
-
} catch (e) {
|
|
22750
|
-
return false
|
|
22751
|
-
}
|
|
22752
|
-
}
|
|
22753
|
-
|
|
22754
|
-
const {
|
|
22755
|
-
normalize: normalize$1,
|
|
22756
|
-
basename,
|
|
22757
|
-
extname,
|
|
22758
|
-
resolve: resolve$1,
|
|
22759
|
-
parse: parse$i,
|
|
22760
|
-
sep
|
|
22761
|
-
} = require$$1$3;
|
|
22762
|
-
|
|
22763
|
-
/**
|
|
22764
|
-
* Expose `send()`.
|
|
22765
|
-
*/
|
|
22766
|
-
|
|
22767
|
-
var koaSend = send$1;
|
|
22768
|
-
|
|
22769
|
-
/**
|
|
22770
|
-
* Send file at `path` with the
|
|
22771
|
-
* given `options` to the koa `ctx`.
|
|
22772
|
-
*
|
|
22773
|
-
* @param {Context} ctx
|
|
22774
|
-
* @param {String} path
|
|
22775
|
-
* @param {Object} [opts]
|
|
22776
|
-
* @return {Promise}
|
|
22777
|
-
* @api public
|
|
22778
|
-
*/
|
|
22779
|
-
|
|
22780
|
-
async function send$1 (ctx, path, opts = {}) {
|
|
22781
|
-
assert$3(ctx, 'koa context required');
|
|
22782
|
-
assert$3(path, 'pathname required');
|
|
22783
|
-
|
|
22784
|
-
// options
|
|
22785
|
-
debug$u('send "%s" %j', path, opts);
|
|
22786
|
-
const root = opts.root ? normalize$1(resolve$1(opts.root)) : '';
|
|
22787
|
-
const trailingSlash = path[path.length - 1] === '/';
|
|
22788
|
-
path = path.substr(parse$i(path).root.length);
|
|
22789
|
-
const index = opts.index;
|
|
22790
|
-
const maxage = opts.maxage || opts.maxAge || 0;
|
|
22791
|
-
const immutable = opts.immutable || false;
|
|
22792
|
-
const hidden = opts.hidden || false;
|
|
22793
|
-
const format = opts.format !== false;
|
|
22794
|
-
const extensions = Array.isArray(opts.extensions) ? opts.extensions : false;
|
|
22795
|
-
const brotli = opts.brotli !== false;
|
|
22796
|
-
const gzip = opts.gzip !== false;
|
|
22797
|
-
const setHeaders = opts.setHeaders;
|
|
22798
|
-
|
|
22799
|
-
if (setHeaders && typeof setHeaders !== 'function') {
|
|
22800
|
-
throw new TypeError('option setHeaders must be function')
|
|
22801
|
-
}
|
|
22802
|
-
|
|
22803
|
-
// normalize path
|
|
22804
|
-
path = decode$8(path);
|
|
22805
|
-
|
|
22806
|
-
if (path === -1) return ctx.throw(400, 'failed to decode')
|
|
22807
|
-
|
|
22808
|
-
// index file support
|
|
22809
|
-
if (index && trailingSlash) path += index;
|
|
22810
|
-
|
|
22811
|
-
path = resolvePath(root, path);
|
|
22812
|
-
|
|
22813
|
-
// hidden file support, ignore
|
|
22814
|
-
if (!hidden && isHidden(root, path)) return
|
|
22815
|
-
|
|
22816
|
-
let encodingExt = '';
|
|
22817
|
-
// serve brotli file when possible otherwise gzipped file when possible
|
|
22818
|
-
if (ctx.acceptsEncodings('br', 'identity') === 'br' && brotli && (await exists(path + '.br'))) {
|
|
22819
|
-
path = path + '.br';
|
|
22820
|
-
ctx.set('Content-Encoding', 'br');
|
|
22821
|
-
ctx.res.removeHeader('Content-Length');
|
|
22822
|
-
encodingExt = '.br';
|
|
22823
|
-
} else if (ctx.acceptsEncodings('gzip', 'identity') === 'gzip' && gzip && (await exists(path + '.gz'))) {
|
|
22824
|
-
path = path + '.gz';
|
|
22825
|
-
ctx.set('Content-Encoding', 'gzip');
|
|
22826
|
-
ctx.res.removeHeader('Content-Length');
|
|
22827
|
-
encodingExt = '.gz';
|
|
22828
|
-
}
|
|
22829
|
-
|
|
22830
|
-
if (extensions && !/\./.exec(basename(path))) {
|
|
22831
|
-
const list = [].concat(extensions);
|
|
22832
|
-
for (let i = 0; i < list.length; i++) {
|
|
22833
|
-
let ext = list[i];
|
|
22834
|
-
if (typeof ext !== 'string') {
|
|
22835
|
-
throw new TypeError('option extensions must be array of strings or false')
|
|
22836
|
-
}
|
|
22837
|
-
if (!/^\./.exec(ext)) ext = `.${ext}`;
|
|
22838
|
-
if (await exists(`${path}${ext}`)) {
|
|
22839
|
-
path = `${path}${ext}`;
|
|
22840
|
-
break
|
|
22841
|
-
}
|
|
22842
|
-
}
|
|
22843
|
-
}
|
|
22844
|
-
|
|
22845
|
-
// stat
|
|
22846
|
-
let stats;
|
|
22847
|
-
try {
|
|
22848
|
-
stats = await stat$5(path);
|
|
22849
|
-
|
|
22850
|
-
// Format the path to serve static file servers
|
|
22851
|
-
// and not require a trailing slash for directories,
|
|
22852
|
-
// so that you can do both `/directory` and `/directory/`
|
|
22853
|
-
if (stats.isDirectory()) {
|
|
22854
|
-
if (format && index) {
|
|
22855
|
-
path += `/${index}`;
|
|
22856
|
-
stats = await stat$5(path);
|
|
22857
|
-
} else {
|
|
22858
|
-
return
|
|
22859
|
-
}
|
|
22860
|
-
}
|
|
22861
|
-
} catch (err) {
|
|
22862
|
-
const notfound = ['ENOENT', 'ENAMETOOLONG', 'ENOTDIR'];
|
|
22863
|
-
if (notfound.includes(err.code)) {
|
|
22864
|
-
throw createError$1(404, err)
|
|
22865
|
-
}
|
|
22866
|
-
err.status = 500;
|
|
22867
|
-
throw err
|
|
22868
|
-
}
|
|
22869
|
-
|
|
22870
|
-
if (setHeaders) setHeaders(ctx.res, path, stats);
|
|
22871
|
-
|
|
22872
|
-
// stream
|
|
22873
|
-
ctx.set('Content-Length', stats.size);
|
|
22874
|
-
if (!ctx.response.get('Last-Modified')) ctx.set('Last-Modified', stats.mtime.toUTCString());
|
|
22875
|
-
if (!ctx.response.get('Cache-Control')) {
|
|
22876
|
-
const directives = [`max-age=${(maxage / 1000 | 0)}`];
|
|
22877
|
-
if (immutable) {
|
|
22878
|
-
directives.push('immutable');
|
|
22879
|
-
}
|
|
22880
|
-
ctx.set('Cache-Control', directives.join(','));
|
|
22881
|
-
}
|
|
22882
|
-
if (!ctx.type) ctx.type = type(path, encodingExt);
|
|
22883
|
-
ctx.body = fs$q.createReadStream(path);
|
|
22884
|
-
|
|
22885
|
-
return path
|
|
22886
|
-
}
|
|
22887
|
-
|
|
22888
|
-
/**
|
|
22889
|
-
* Check if it's hidden.
|
|
22890
|
-
*/
|
|
22891
|
-
|
|
22892
|
-
function isHidden (root, path) {
|
|
22893
|
-
path = path.substr(root.length).split(sep);
|
|
22894
|
-
for (let i = 0; i < path.length; i++) {
|
|
22895
|
-
if (path[i][0] === '.') return true
|
|
22896
|
-
}
|
|
22897
|
-
return false
|
|
22898
|
-
}
|
|
22899
|
-
|
|
22900
|
-
/**
|
|
22901
|
-
* File type.
|
|
22902
|
-
*/
|
|
22903
|
-
|
|
22904
|
-
function type (file, ext) {
|
|
22905
|
-
return ext !== '' ? extname(basename(file, ext)) : extname(file)
|
|
22906
|
-
}
|
|
22907
|
-
|
|
22908
|
-
/**
|
|
22909
|
-
* Decode `path`.
|
|
22910
|
-
*/
|
|
22911
|
-
|
|
22912
|
-
function decode$8 (path) {
|
|
22913
|
-
try {
|
|
22914
|
-
return decodeURIComponent(path)
|
|
22915
|
-
} catch (err) {
|
|
22916
|
-
return -1
|
|
22917
|
-
}
|
|
22918
|
-
}
|
|
22919
|
-
|
|
22920
|
-
/**
|
|
22921
|
-
* Module dependencies.
|
|
22922
|
-
*/
|
|
22923
|
-
|
|
22924
|
-
const debug$t = srcExports$1('koa-static');
|
|
22925
|
-
const { resolve } = require$$1$3;
|
|
22926
|
-
const assert$2 = require$$2$3;
|
|
22927
|
-
const send = koaSend;
|
|
22928
|
-
|
|
22929
|
-
/**
|
|
22930
|
-
* Expose `serve()`.
|
|
22931
|
-
*/
|
|
22932
|
-
|
|
22933
|
-
var koaStatic = serve;
|
|
22934
|
-
|
|
22935
|
-
/**
|
|
22936
|
-
* Serve static files from `root`.
|
|
22937
|
-
*
|
|
22938
|
-
* @param {String} root
|
|
22939
|
-
* @param {Object} [opts]
|
|
22940
|
-
* @return {Function}
|
|
22941
|
-
* @api public
|
|
22942
|
-
*/
|
|
22943
|
-
|
|
22944
|
-
function serve (root, opts) {
|
|
22945
|
-
opts = Object.assign({}, opts);
|
|
22946
|
-
|
|
22947
|
-
assert$2(root, 'root directory is required to serve files');
|
|
22948
|
-
|
|
22949
|
-
// options
|
|
22950
|
-
debug$t('static "%s" %j', root, opts);
|
|
22951
|
-
opts.root = resolve(root);
|
|
22952
|
-
if (opts.index !== false) opts.index = opts.index || 'index.html';
|
|
22953
|
-
|
|
22954
|
-
if (!opts.defer) {
|
|
22955
|
-
return async function serve (ctx, next) {
|
|
22956
|
-
let done = false;
|
|
22957
|
-
|
|
22958
|
-
if (ctx.method === 'HEAD' || ctx.method === 'GET') {
|
|
22959
|
-
try {
|
|
22960
|
-
done = await send(ctx, ctx.path, opts);
|
|
22961
|
-
} catch (err) {
|
|
22962
|
-
if (err.status !== 404) {
|
|
22963
|
-
throw err
|
|
22964
|
-
}
|
|
22965
|
-
}
|
|
22966
|
-
}
|
|
22967
|
-
|
|
22968
|
-
if (!done) {
|
|
22969
|
-
await next();
|
|
22970
|
-
}
|
|
22971
|
-
}
|
|
22972
|
-
}
|
|
22973
|
-
|
|
22974
|
-
return async function serve (ctx, next) {
|
|
22975
|
-
await next();
|
|
22976
|
-
|
|
22977
|
-
if (ctx.method !== 'HEAD' && ctx.method !== 'GET') return
|
|
22978
|
-
// response is already handled
|
|
22979
|
-
if (ctx.body != null || ctx.status !== 404) return // eslint-disable-line
|
|
22980
|
-
|
|
22981
|
-
try {
|
|
22982
|
-
await send(ctx, ctx.path, opts);
|
|
22983
|
-
} catch (err) {
|
|
22984
|
-
if (err.status !== 404) {
|
|
22985
|
-
throw err
|
|
22986
|
-
}
|
|
22987
|
-
}
|
|
22988
|
-
}
|
|
22989
|
-
}
|
|
22990
|
-
|
|
22991
22991
|
/**
|
|
22992
22992
|
* Module dependencies.
|
|
22993
22993
|
*/
|
|
@@ -82911,9 +82911,11 @@ async function createServer(item) {
|
|
|
82911
82911
|
}
|
|
82912
82912
|
async function bulkCreateServer(items) {
|
|
82913
82913
|
await prisma.$transaction(async (prisma2) => {
|
|
82914
|
-
const
|
|
82915
|
-
await Promise.all(
|
|
82916
|
-
|
|
82914
|
+
const preMap = {};
|
|
82915
|
+
await Promise.all(
|
|
82916
|
+
items.map((item) => prisma2.server.create({ data: item }).then((server) => preMap[server.username] = server.id))
|
|
82917
|
+
);
|
|
82918
|
+
const newOrder = Array.from(orderMap.keys()).concat(items.map((item) => preMap[item.username]));
|
|
82917
82919
|
await updateOrder(newOrder.join(","), prisma2);
|
|
82918
82920
|
});
|
|
82919
82921
|
emitter.emit("update");
|
|
@@ -176234,7 +176236,7 @@ var __importDefault$3 = (commonjsGlobal && commonjsGlobal.__importDefault) || fu
|
|
|
176234
176236
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
176235
176237
|
};
|
|
176236
176238
|
const events_1 = require$$0$9;
|
|
176237
|
-
const debug_1$2 = __importDefault$3(srcExports);
|
|
176239
|
+
const debug_1$2 = __importDefault$3(srcExports$2);
|
|
176238
176240
|
const promisify_1 = __importDefault$3(promisify$1);
|
|
176239
176241
|
const debug$2 = debug_1$2.default('agent-base');
|
|
176240
176242
|
function isAgent(v) {
|