nodestatus-server 1.2.7-beta.4 → 1.2.8-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/bin/status-server-run.js +13 -10
- package/bin/status-server.js +7 -4
- package/build/app.js +1151 -2212
- package/build/dist/hotaru-admin/assets/{LayoutHandler-4ab98254.js → LayoutHandler-a88af57b.js} +22 -22
- package/build/dist/hotaru-admin/assets/{Login-b137505a.js → Login-3f718f9e.js} +1 -1
- package/build/dist/hotaru-admin/assets/{UserOutlined-c7a36e46.js → UserOutlined-e45e7ca2.js} +1 -1
- package/build/dist/hotaru-admin/assets/{index-e73521eb.js → index-372f4f56.js} +2 -2
- package/build/dist/hotaru-admin/index.html +1 -1
- package/build/dist/hotaru-theme/assets/{index-d4dd98f1.js → index-734a7c4f.js} +1 -1
- package/build/dist/hotaru-theme/index.html +1 -1
- package/package.json +10 -8
- package/scripts/init.js +9 -6
- package/prisma/.env +0 -1
package/build/app.js
CHANGED
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
1
|
+
import require$$1$3, { resolve as resolve$3, dirname } from 'path';
|
|
2
|
+
import require$$0$b, { fileURLToPath } from 'url';
|
|
3
|
+
import require$$0$5 from 'tty';
|
|
4
|
+
import require$$1$2 from 'util';
|
|
5
|
+
import require$$0$6, { homedir, platform as platform$1 } from 'os';
|
|
6
|
+
import require$$2$3 from 'assert';
|
|
7
|
+
import require$$0$7 from 'buffer';
|
|
8
|
+
import require$$0$8 from 'fs';
|
|
9
|
+
import Stream$7, { Readable as Readable$1 } from 'stream';
|
|
10
|
+
import require$$0$9 from 'events';
|
|
11
|
+
import require$$0$a, { timingSafeEqual } from 'crypto';
|
|
12
|
+
import require$$2$4, { Server } from 'http';
|
|
13
|
+
import require$$1$4, { isIPv4 } from 'net';
|
|
14
|
+
import require$$5$1 from 'querystring';
|
|
15
|
+
import require$$17 from 'async_hooks';
|
|
16
|
+
import require$$0$c from 'constants';
|
|
17
|
+
import zlib$3 from 'zlib';
|
|
18
|
+
import dotenv from 'dotenv';
|
|
19
|
+
import require$$1$5 from 'child_process';
|
|
20
|
+
import require$$4$3 from 'process';
|
|
21
|
+
import require$$1$6 from 'string_decoder';
|
|
22
|
+
import require$$0$d from 'domain';
|
|
23
|
+
import { PrismaClient } from '@prisma/client';
|
|
24
|
+
import { randomBytes as randomBytes$1 } from 'node:crypto';
|
|
25
|
+
import timers from 'timers/promises';
|
|
26
|
+
import require$$4$4 from 'tls';
|
|
27
|
+
import require$$2$5 from 'https';
|
|
28
|
+
import require$$0$e from 'punycode';
|
|
29
29
|
|
|
30
30
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
31
31
|
|
|
@@ -20608,11 +20608,11 @@ var browser$1 = {
|
|
|
20608
20608
|
*/
|
|
20609
20609
|
|
|
20610
20610
|
var s = 1000;
|
|
20611
|
-
var m = s * 60;
|
|
20612
|
-
var h = m * 60;
|
|
20613
|
-
var d = h * 24;
|
|
20614
|
-
var w = d * 7;
|
|
20615
|
-
var y = d * 365.25;
|
|
20611
|
+
var m$1 = s * 60;
|
|
20612
|
+
var h = m$1 * 60;
|
|
20613
|
+
var d$1 = h * 24;
|
|
20614
|
+
var w$1 = d$1 * 7;
|
|
20615
|
+
var y = d$1 * 365.25;
|
|
20616
20616
|
|
|
20617
20617
|
/**
|
|
20618
20618
|
* Parse or format the given `val`.
|
|
@@ -20673,11 +20673,11 @@ function parse$j(str) {
|
|
|
20673
20673
|
case 'weeks':
|
|
20674
20674
|
case 'week':
|
|
20675
20675
|
case 'w':
|
|
20676
|
-
return n * w;
|
|
20676
|
+
return n * w$1;
|
|
20677
20677
|
case 'days':
|
|
20678
20678
|
case 'day':
|
|
20679
20679
|
case 'd':
|
|
20680
|
-
return n * d;
|
|
20680
|
+
return n * d$1;
|
|
20681
20681
|
case 'hours':
|
|
20682
20682
|
case 'hour':
|
|
20683
20683
|
case 'hrs':
|
|
@@ -20689,7 +20689,7 @@ function parse$j(str) {
|
|
|
20689
20689
|
case 'mins':
|
|
20690
20690
|
case 'min':
|
|
20691
20691
|
case 'm':
|
|
20692
|
-
return n * m;
|
|
20692
|
+
return n * m$1;
|
|
20693
20693
|
case 'seconds':
|
|
20694
20694
|
case 'second':
|
|
20695
20695
|
case 'secs':
|
|
@@ -20717,14 +20717,14 @@ function parse$j(str) {
|
|
|
20717
20717
|
|
|
20718
20718
|
function fmtShort(ms) {
|
|
20719
20719
|
var msAbs = Math.abs(ms);
|
|
20720
|
-
if (msAbs >= d) {
|
|
20721
|
-
return Math.round(ms / d) + 'd';
|
|
20720
|
+
if (msAbs >= d$1) {
|
|
20721
|
+
return Math.round(ms / d$1) + 'd';
|
|
20722
20722
|
}
|
|
20723
20723
|
if (msAbs >= h) {
|
|
20724
20724
|
return Math.round(ms / h) + 'h';
|
|
20725
20725
|
}
|
|
20726
|
-
if (msAbs >= m) {
|
|
20727
|
-
return Math.round(ms / m) + 'm';
|
|
20726
|
+
if (msAbs >= m$1) {
|
|
20727
|
+
return Math.round(ms / m$1) + 'm';
|
|
20728
20728
|
}
|
|
20729
20729
|
if (msAbs >= s) {
|
|
20730
20730
|
return Math.round(ms / s) + 's';
|
|
@@ -20742,14 +20742,14 @@ function fmtShort(ms) {
|
|
|
20742
20742
|
|
|
20743
20743
|
function fmtLong(ms) {
|
|
20744
20744
|
var msAbs = Math.abs(ms);
|
|
20745
|
-
if (msAbs >= d) {
|
|
20746
|
-
return plural(ms, msAbs, d, 'day');
|
|
20745
|
+
if (msAbs >= d$1) {
|
|
20746
|
+
return plural(ms, msAbs, d$1, 'day');
|
|
20747
20747
|
}
|
|
20748
20748
|
if (msAbs >= h) {
|
|
20749
20749
|
return plural(ms, msAbs, h, 'hour');
|
|
20750
20750
|
}
|
|
20751
|
-
if (msAbs >= m) {
|
|
20752
|
-
return plural(ms, msAbs, m, 'minute');
|
|
20751
|
+
if (msAbs >= m$1) {
|
|
20752
|
+
return plural(ms, msAbs, m$1, 'minute');
|
|
20753
20753
|
}
|
|
20754
20754
|
if (msAbs >= s) {
|
|
20755
20755
|
return plural(ms, msAbs, s, 'second');
|
|
@@ -23131,7 +23131,7 @@ var url$3 = require$$0$b;
|
|
|
23131
23131
|
function historyApiFallback(options) {
|
|
23132
23132
|
var _this = this;
|
|
23133
23133
|
options = options || {};
|
|
23134
|
-
var logger = getLogger$
|
|
23134
|
+
var logger = getLogger$2(options);
|
|
23135
23135
|
return function (ctx, next) { return __awaiter$2(_this, void 0, void 0, function () {
|
|
23136
23136
|
var isFlag_1, parsedUrl, rewriteTarget, i, rewrite, match;
|
|
23137
23137
|
return __generator$1(this, function (_a) {
|
|
@@ -23212,7 +23212,7 @@ function acceptsHtml(header, options) {
|
|
|
23212
23212
|
}
|
|
23213
23213
|
return false;
|
|
23214
23214
|
}
|
|
23215
|
-
function getLogger$
|
|
23215
|
+
function getLogger$2(options) {
|
|
23216
23216
|
if (options && options.logger) {
|
|
23217
23217
|
return options.logger;
|
|
23218
23218
|
}
|
|
@@ -24289,7 +24289,7 @@ var appenders$2 = {
|
|
|
24289
24289
|
set exports(v){ appendersExports = v; },
|
|
24290
24290
|
};
|
|
24291
24291
|
|
|
24292
|
-
var cjs
|
|
24292
|
+
var cjs = {};
|
|
24293
24293
|
|
|
24294
24294
|
/*! (c) 2020 Andrea Giammarchi */
|
|
24295
24295
|
|
|
@@ -24352,7 +24352,7 @@ const parse$h = (text, reviver) => {
|
|
|
24352
24352
|
value;
|
|
24353
24353
|
return $.call({'': tmp}, '', tmp);
|
|
24354
24354
|
};
|
|
24355
|
-
cjs
|
|
24355
|
+
cjs.parse = parse$h;
|
|
24356
24356
|
|
|
24357
24357
|
const stringify$8 = (value, replacer, space) => {
|
|
24358
24358
|
const $ = replacer && typeof replacer === object ?
|
|
@@ -24383,14 +24383,14 @@ const stringify$8 = (value, replacer, space) => {
|
|
|
24383
24383
|
return after;
|
|
24384
24384
|
}
|
|
24385
24385
|
};
|
|
24386
|
-
cjs
|
|
24386
|
+
cjs.stringify = stringify$8;
|
|
24387
24387
|
|
|
24388
24388
|
const toJSON = any => $parse(stringify$8(any));
|
|
24389
|
-
cjs
|
|
24389
|
+
cjs.toJSON = toJSON;
|
|
24390
24390
|
const fromJSON = any => parse$h($stringify(any));
|
|
24391
|
-
cjs
|
|
24391
|
+
cjs.fromJSON = fromJSON;
|
|
24392
24392
|
|
|
24393
|
-
const flatted = cjs
|
|
24393
|
+
const flatted = cjs;
|
|
24394
24394
|
const levels$4 = levels$5;
|
|
24395
24395
|
|
|
24396
24396
|
/**
|
|
@@ -24839,7 +24839,7 @@ if (typeof process.chdir === 'function') {
|
|
|
24839
24839
|
if (Object.setPrototypeOf) Object.setPrototypeOf(process.chdir, chdir);
|
|
24840
24840
|
}
|
|
24841
24841
|
|
|
24842
|
-
var polyfills$
|
|
24842
|
+
var polyfills$2 = patch$3;
|
|
24843
24843
|
|
|
24844
24844
|
function patch$3 (fs) {
|
|
24845
24845
|
// (re-)implement some things that are known busted or missing.
|
|
@@ -25162,7 +25162,7 @@ function patch$3 (fs) {
|
|
|
25162
25162
|
|
|
25163
25163
|
var Stream$4 = Stream$7.Stream;
|
|
25164
25164
|
|
|
25165
|
-
var legacyStreams = legacy$1;
|
|
25165
|
+
var legacyStreams$1 = legacy$1;
|
|
25166
25166
|
|
|
25167
25167
|
function legacy$1 (fs) {
|
|
25168
25168
|
return {
|
|
@@ -25279,7 +25279,7 @@ function legacy$1 (fs) {
|
|
|
25279
25279
|
}
|
|
25280
25280
|
}
|
|
25281
25281
|
|
|
25282
|
-
var clone_1 = clone$2;
|
|
25282
|
+
var clone_1$1 = clone$2;
|
|
25283
25283
|
|
|
25284
25284
|
var getPrototypeOf = Object.getPrototypeOf || function (obj) {
|
|
25285
25285
|
return obj.__proto__
|
|
@@ -25302,9 +25302,9 @@ function clone$2 (obj) {
|
|
|
25302
25302
|
}
|
|
25303
25303
|
|
|
25304
25304
|
var fs$o = require$$0$8;
|
|
25305
|
-
var polyfills = polyfills$
|
|
25306
|
-
var legacy = legacyStreams;
|
|
25307
|
-
var clone$1 = clone_1;
|
|
25305
|
+
var polyfills$1 = polyfills$2;
|
|
25306
|
+
var legacy = legacyStreams$1;
|
|
25307
|
+
var clone$1 = clone_1$1;
|
|
25308
25308
|
|
|
25309
25309
|
var util$8 = require$$1$2;
|
|
25310
25310
|
|
|
@@ -25396,15 +25396,15 @@ if (!commonjsGlobal[gracefulQueue]) {
|
|
|
25396
25396
|
publishQueue(commonjsGlobal, fs$o[gracefulQueue]);
|
|
25397
25397
|
}
|
|
25398
25398
|
|
|
25399
|
-
var gracefulFs = patch$2(clone$1(fs$o));
|
|
25399
|
+
var gracefulFs$1 = patch$2(clone$1(fs$o));
|
|
25400
25400
|
if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs$o.__patched) {
|
|
25401
|
-
gracefulFs = patch$2(fs$o);
|
|
25401
|
+
gracefulFs$1 = patch$2(fs$o);
|
|
25402
25402
|
fs$o.__patched = true;
|
|
25403
25403
|
}
|
|
25404
25404
|
|
|
25405
25405
|
function patch$2 (fs) {
|
|
25406
25406
|
// Everything that references the open() function needs to be in here
|
|
25407
|
-
polyfills(fs);
|
|
25407
|
+
polyfills$1(fs);
|
|
25408
25408
|
fs.gracefulify = patch$2;
|
|
25409
25409
|
|
|
25410
25410
|
fs.createReadStream = createReadStream;
|
|
@@ -25735,7 +25735,7 @@ function retry () {
|
|
|
25735
25735
|
// This is adapted from https://github.com/normalize/mz
|
|
25736
25736
|
// Copyright (c) 2014-2016 Jonathan Ong me@jongleberry.com and Contributors
|
|
25737
25737
|
const u = universalify$1.fromCallback;
|
|
25738
|
-
const fs = gracefulFs;
|
|
25738
|
+
const fs = gracefulFs$1;
|
|
25739
25739
|
|
|
25740
25740
|
const api = [
|
|
25741
25741
|
'access',
|
|
@@ -25934,7 +25934,7 @@ var pathExists_1 = {
|
|
|
25934
25934
|
pathExistsSync: fs$m.existsSync
|
|
25935
25935
|
};
|
|
25936
25936
|
|
|
25937
|
-
const fs$l = gracefulFs;
|
|
25937
|
+
const fs$l = gracefulFs$1;
|
|
25938
25938
|
|
|
25939
25939
|
function utimesMillis$1 (path, atime, mtime, callback) {
|
|
25940
25940
|
// if (!HAS_MILLIS_RES) return fs.utimes(path, atime, mtime, callback)
|
|
@@ -26112,7 +26112,7 @@ var stat$4 = {
|
|
|
26112
26112
|
areIdentical: areIdentical$2
|
|
26113
26113
|
};
|
|
26114
26114
|
|
|
26115
|
-
const fs$j = gracefulFs;
|
|
26115
|
+
const fs$j = gracefulFs$1;
|
|
26116
26116
|
const path$i = require$$1$3;
|
|
26117
26117
|
const mkdirs$1 = mkdirs$2.mkdirs;
|
|
26118
26118
|
const pathExists$5 = pathExists_1.pathExists;
|
|
@@ -26346,7 +26346,7 @@ function copyLink$1 (resolvedSrc, dest, cb) {
|
|
|
26346
26346
|
|
|
26347
26347
|
var copy_1 = copy$2;
|
|
26348
26348
|
|
|
26349
|
-
const fs$i = gracefulFs;
|
|
26349
|
+
const fs$i = gracefulFs$1;
|
|
26350
26350
|
const path$h = require$$1$3;
|
|
26351
26351
|
const mkdirsSync$1 = mkdirs$2.mkdirsSync;
|
|
26352
26352
|
const utimesMillisSync = utimes.utimesMillisSync;
|
|
@@ -26520,7 +26520,7 @@ var copy$1 = {
|
|
|
26520
26520
|
copySync: copySync_1
|
|
26521
26521
|
};
|
|
26522
26522
|
|
|
26523
|
-
const fs$h = gracefulFs;
|
|
26523
|
+
const fs$h = gracefulFs$1;
|
|
26524
26524
|
const path$g = require$$1$3;
|
|
26525
26525
|
const assert = require$$2$3;
|
|
26526
26526
|
|
|
@@ -26821,7 +26821,7 @@ function rmkidsSync (p, options) {
|
|
|
26821
26821
|
var rimraf_1 = rimraf$1;
|
|
26822
26822
|
rimraf$1.sync = rimrafSync;
|
|
26823
26823
|
|
|
26824
|
-
const fs$g = gracefulFs;
|
|
26824
|
+
const fs$g = gracefulFs$1;
|
|
26825
26825
|
const u$7 = universalify$1.fromCallback;
|
|
26826
26826
|
const rimraf = rimraf_1;
|
|
26827
26827
|
|
|
@@ -26882,7 +26882,7 @@ var empty = {
|
|
|
26882
26882
|
|
|
26883
26883
|
const u$5 = universalify$1.fromCallback;
|
|
26884
26884
|
const path$e = require$$1$3;
|
|
26885
|
-
const fs$e = gracefulFs;
|
|
26885
|
+
const fs$e = gracefulFs$1;
|
|
26886
26886
|
const mkdir$2 = mkdirs$2;
|
|
26887
26887
|
|
|
26888
26888
|
function createFile$1 (file, callback) {
|
|
@@ -26950,7 +26950,7 @@ var file = {
|
|
|
26950
26950
|
|
|
26951
26951
|
const u$4 = universalify$1.fromCallback;
|
|
26952
26952
|
const path$d = require$$1$3;
|
|
26953
|
-
const fs$d = gracefulFs;
|
|
26953
|
+
const fs$d = gracefulFs$1;
|
|
26954
26954
|
const mkdir$1 = mkdirs$2;
|
|
26955
26955
|
const pathExists$4 = pathExists_1.pathExists;
|
|
26956
26956
|
const { areIdentical: areIdentical$1 } = stat$4;
|
|
@@ -27012,7 +27012,7 @@ var link = {
|
|
|
27012
27012
|
};
|
|
27013
27013
|
|
|
27014
27014
|
const path$c = require$$1$3;
|
|
27015
|
-
const fs$c = gracefulFs;
|
|
27015
|
+
const fs$c = gracefulFs$1;
|
|
27016
27016
|
const pathExists$3 = pathExists_1.pathExists;
|
|
27017
27017
|
|
|
27018
27018
|
/**
|
|
@@ -27109,7 +27109,7 @@ var symlinkPaths_1 = {
|
|
|
27109
27109
|
symlinkPathsSync: symlinkPathsSync$1
|
|
27110
27110
|
};
|
|
27111
27111
|
|
|
27112
|
-
const fs$b = gracefulFs;
|
|
27112
|
+
const fs$b = gracefulFs$1;
|
|
27113
27113
|
|
|
27114
27114
|
function symlinkType$1 (srcpath, type, callback) {
|
|
27115
27115
|
callback = (typeof type === 'function') ? type : callback;
|
|
@@ -27242,6 +27242,985 @@ var ensure = {
|
|
|
27242
27242
|
ensureSymlinkSync: createSymlinkSync
|
|
27243
27243
|
};
|
|
27244
27244
|
|
|
27245
|
+
var polyfills;
|
|
27246
|
+
var hasRequiredPolyfills;
|
|
27247
|
+
|
|
27248
|
+
function requirePolyfills () {
|
|
27249
|
+
if (hasRequiredPolyfills) return polyfills;
|
|
27250
|
+
hasRequiredPolyfills = 1;
|
|
27251
|
+
var constants = require$$0$c;
|
|
27252
|
+
|
|
27253
|
+
var origCwd = process.cwd;
|
|
27254
|
+
var cwd = null;
|
|
27255
|
+
|
|
27256
|
+
var platform = process.env.GRACEFUL_FS_PLATFORM || process.platform;
|
|
27257
|
+
|
|
27258
|
+
process.cwd = function() {
|
|
27259
|
+
if (!cwd)
|
|
27260
|
+
cwd = origCwd.call(process);
|
|
27261
|
+
return cwd
|
|
27262
|
+
};
|
|
27263
|
+
try {
|
|
27264
|
+
process.cwd();
|
|
27265
|
+
} catch (er) {}
|
|
27266
|
+
|
|
27267
|
+
// This check is needed until node.js 12 is required
|
|
27268
|
+
if (typeof process.chdir === 'function') {
|
|
27269
|
+
var chdir = process.chdir;
|
|
27270
|
+
process.chdir = function (d) {
|
|
27271
|
+
cwd = null;
|
|
27272
|
+
chdir.call(process, d);
|
|
27273
|
+
};
|
|
27274
|
+
if (Object.setPrototypeOf) Object.setPrototypeOf(process.chdir, chdir);
|
|
27275
|
+
}
|
|
27276
|
+
|
|
27277
|
+
polyfills = patch;
|
|
27278
|
+
|
|
27279
|
+
function patch (fs) {
|
|
27280
|
+
// (re-)implement some things that are known busted or missing.
|
|
27281
|
+
|
|
27282
|
+
// lchmod, broken prior to 0.6.2
|
|
27283
|
+
// back-port the fix here.
|
|
27284
|
+
if (constants.hasOwnProperty('O_SYMLINK') &&
|
|
27285
|
+
process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)) {
|
|
27286
|
+
patchLchmod(fs);
|
|
27287
|
+
}
|
|
27288
|
+
|
|
27289
|
+
// lutimes implementation, or no-op
|
|
27290
|
+
if (!fs.lutimes) {
|
|
27291
|
+
patchLutimes(fs);
|
|
27292
|
+
}
|
|
27293
|
+
|
|
27294
|
+
// https://github.com/isaacs/node-graceful-fs/issues/4
|
|
27295
|
+
// Chown should not fail on einval or eperm if non-root.
|
|
27296
|
+
// It should not fail on enosys ever, as this just indicates
|
|
27297
|
+
// that a fs doesn't support the intended operation.
|
|
27298
|
+
|
|
27299
|
+
fs.chown = chownFix(fs.chown);
|
|
27300
|
+
fs.fchown = chownFix(fs.fchown);
|
|
27301
|
+
fs.lchown = chownFix(fs.lchown);
|
|
27302
|
+
|
|
27303
|
+
fs.chmod = chmodFix(fs.chmod);
|
|
27304
|
+
fs.fchmod = chmodFix(fs.fchmod);
|
|
27305
|
+
fs.lchmod = chmodFix(fs.lchmod);
|
|
27306
|
+
|
|
27307
|
+
fs.chownSync = chownFixSync(fs.chownSync);
|
|
27308
|
+
fs.fchownSync = chownFixSync(fs.fchownSync);
|
|
27309
|
+
fs.lchownSync = chownFixSync(fs.lchownSync);
|
|
27310
|
+
|
|
27311
|
+
fs.chmodSync = chmodFixSync(fs.chmodSync);
|
|
27312
|
+
fs.fchmodSync = chmodFixSync(fs.fchmodSync);
|
|
27313
|
+
fs.lchmodSync = chmodFixSync(fs.lchmodSync);
|
|
27314
|
+
|
|
27315
|
+
fs.stat = statFix(fs.stat);
|
|
27316
|
+
fs.fstat = statFix(fs.fstat);
|
|
27317
|
+
fs.lstat = statFix(fs.lstat);
|
|
27318
|
+
|
|
27319
|
+
fs.statSync = statFixSync(fs.statSync);
|
|
27320
|
+
fs.fstatSync = statFixSync(fs.fstatSync);
|
|
27321
|
+
fs.lstatSync = statFixSync(fs.lstatSync);
|
|
27322
|
+
|
|
27323
|
+
// if lchmod/lchown do not exist, then make them no-ops
|
|
27324
|
+
if (fs.chmod && !fs.lchmod) {
|
|
27325
|
+
fs.lchmod = function (path, mode, cb) {
|
|
27326
|
+
if (cb) process.nextTick(cb);
|
|
27327
|
+
};
|
|
27328
|
+
fs.lchmodSync = function () {};
|
|
27329
|
+
}
|
|
27330
|
+
if (fs.chown && !fs.lchown) {
|
|
27331
|
+
fs.lchown = function (path, uid, gid, cb) {
|
|
27332
|
+
if (cb) process.nextTick(cb);
|
|
27333
|
+
};
|
|
27334
|
+
fs.lchownSync = function () {};
|
|
27335
|
+
}
|
|
27336
|
+
|
|
27337
|
+
// on Windows, A/V software can lock the directory, causing this
|
|
27338
|
+
// to fail with an EACCES or EPERM if the directory contains newly
|
|
27339
|
+
// created files. Try again on failure, for up to 60 seconds.
|
|
27340
|
+
|
|
27341
|
+
// Set the timeout this long because some Windows Anti-Virus, such as Parity
|
|
27342
|
+
// bit9, may lock files for up to a minute, causing npm package install
|
|
27343
|
+
// failures. Also, take care to yield the scheduler. Windows scheduling gives
|
|
27344
|
+
// CPU to a busy looping process, which can cause the program causing the lock
|
|
27345
|
+
// contention to be starved of CPU by node, so the contention doesn't resolve.
|
|
27346
|
+
if (platform === "win32") {
|
|
27347
|
+
fs.rename = typeof fs.rename !== 'function' ? fs.rename
|
|
27348
|
+
: (function (fs$rename) {
|
|
27349
|
+
function rename (from, to, cb) {
|
|
27350
|
+
var start = Date.now();
|
|
27351
|
+
var backoff = 0;
|
|
27352
|
+
fs$rename(from, to, function CB (er) {
|
|
27353
|
+
if (er
|
|
27354
|
+
&& (er.code === "EACCES" || er.code === "EPERM" || er.code === "EBUSY")
|
|
27355
|
+
&& Date.now() - start < 60000) {
|
|
27356
|
+
setTimeout(function() {
|
|
27357
|
+
fs.stat(to, function (stater, st) {
|
|
27358
|
+
if (stater && stater.code === "ENOENT")
|
|
27359
|
+
fs$rename(from, to, CB);
|
|
27360
|
+
else
|
|
27361
|
+
cb(er);
|
|
27362
|
+
});
|
|
27363
|
+
}, backoff);
|
|
27364
|
+
if (backoff < 100)
|
|
27365
|
+
backoff += 10;
|
|
27366
|
+
return;
|
|
27367
|
+
}
|
|
27368
|
+
if (cb) cb(er);
|
|
27369
|
+
});
|
|
27370
|
+
}
|
|
27371
|
+
if (Object.setPrototypeOf) Object.setPrototypeOf(rename, fs$rename);
|
|
27372
|
+
return rename
|
|
27373
|
+
})(fs.rename);
|
|
27374
|
+
}
|
|
27375
|
+
|
|
27376
|
+
// if read() returns EAGAIN, then just try it again.
|
|
27377
|
+
fs.read = typeof fs.read !== 'function' ? fs.read
|
|
27378
|
+
: (function (fs$read) {
|
|
27379
|
+
function read (fd, buffer, offset, length, position, callback_) {
|
|
27380
|
+
var callback;
|
|
27381
|
+
if (callback_ && typeof callback_ === 'function') {
|
|
27382
|
+
var eagCounter = 0;
|
|
27383
|
+
callback = function (er, _, __) {
|
|
27384
|
+
if (er && er.code === 'EAGAIN' && eagCounter < 10) {
|
|
27385
|
+
eagCounter ++;
|
|
27386
|
+
return fs$read.call(fs, fd, buffer, offset, length, position, callback)
|
|
27387
|
+
}
|
|
27388
|
+
callback_.apply(this, arguments);
|
|
27389
|
+
};
|
|
27390
|
+
}
|
|
27391
|
+
return fs$read.call(fs, fd, buffer, offset, length, position, callback)
|
|
27392
|
+
}
|
|
27393
|
+
|
|
27394
|
+
// This ensures `util.promisify` works as it does for native `fs.read`.
|
|
27395
|
+
if (Object.setPrototypeOf) Object.setPrototypeOf(read, fs$read);
|
|
27396
|
+
return read
|
|
27397
|
+
})(fs.read);
|
|
27398
|
+
|
|
27399
|
+
fs.readSync = typeof fs.readSync !== 'function' ? fs.readSync
|
|
27400
|
+
: (function (fs$readSync) { return function (fd, buffer, offset, length, position) {
|
|
27401
|
+
var eagCounter = 0;
|
|
27402
|
+
while (true) {
|
|
27403
|
+
try {
|
|
27404
|
+
return fs$readSync.call(fs, fd, buffer, offset, length, position)
|
|
27405
|
+
} catch (er) {
|
|
27406
|
+
if (er.code === 'EAGAIN' && eagCounter < 10) {
|
|
27407
|
+
eagCounter ++;
|
|
27408
|
+
continue
|
|
27409
|
+
}
|
|
27410
|
+
throw er
|
|
27411
|
+
}
|
|
27412
|
+
}
|
|
27413
|
+
}})(fs.readSync);
|
|
27414
|
+
|
|
27415
|
+
function patchLchmod (fs) {
|
|
27416
|
+
fs.lchmod = function (path, mode, callback) {
|
|
27417
|
+
fs.open( path
|
|
27418
|
+
, constants.O_WRONLY | constants.O_SYMLINK
|
|
27419
|
+
, mode
|
|
27420
|
+
, function (err, fd) {
|
|
27421
|
+
if (err) {
|
|
27422
|
+
if (callback) callback(err);
|
|
27423
|
+
return
|
|
27424
|
+
}
|
|
27425
|
+
// prefer to return the chmod error, if one occurs,
|
|
27426
|
+
// but still try to close, and report closing errors if they occur.
|
|
27427
|
+
fs.fchmod(fd, mode, function (err) {
|
|
27428
|
+
fs.close(fd, function(err2) {
|
|
27429
|
+
if (callback) callback(err || err2);
|
|
27430
|
+
});
|
|
27431
|
+
});
|
|
27432
|
+
});
|
|
27433
|
+
};
|
|
27434
|
+
|
|
27435
|
+
fs.lchmodSync = function (path, mode) {
|
|
27436
|
+
var fd = fs.openSync(path, constants.O_WRONLY | constants.O_SYMLINK, mode);
|
|
27437
|
+
|
|
27438
|
+
// prefer to return the chmod error, if one occurs,
|
|
27439
|
+
// but still try to close, and report closing errors if they occur.
|
|
27440
|
+
var threw = true;
|
|
27441
|
+
var ret;
|
|
27442
|
+
try {
|
|
27443
|
+
ret = fs.fchmodSync(fd, mode);
|
|
27444
|
+
threw = false;
|
|
27445
|
+
} finally {
|
|
27446
|
+
if (threw) {
|
|
27447
|
+
try {
|
|
27448
|
+
fs.closeSync(fd);
|
|
27449
|
+
} catch (er) {}
|
|
27450
|
+
} else {
|
|
27451
|
+
fs.closeSync(fd);
|
|
27452
|
+
}
|
|
27453
|
+
}
|
|
27454
|
+
return ret
|
|
27455
|
+
};
|
|
27456
|
+
}
|
|
27457
|
+
|
|
27458
|
+
function patchLutimes (fs) {
|
|
27459
|
+
if (constants.hasOwnProperty("O_SYMLINK") && fs.futimes) {
|
|
27460
|
+
fs.lutimes = function (path, at, mt, cb) {
|
|
27461
|
+
fs.open(path, constants.O_SYMLINK, function (er, fd) {
|
|
27462
|
+
if (er) {
|
|
27463
|
+
if (cb) cb(er);
|
|
27464
|
+
return
|
|
27465
|
+
}
|
|
27466
|
+
fs.futimes(fd, at, mt, function (er) {
|
|
27467
|
+
fs.close(fd, function (er2) {
|
|
27468
|
+
if (cb) cb(er || er2);
|
|
27469
|
+
});
|
|
27470
|
+
});
|
|
27471
|
+
});
|
|
27472
|
+
};
|
|
27473
|
+
|
|
27474
|
+
fs.lutimesSync = function (path, at, mt) {
|
|
27475
|
+
var fd = fs.openSync(path, constants.O_SYMLINK);
|
|
27476
|
+
var ret;
|
|
27477
|
+
var threw = true;
|
|
27478
|
+
try {
|
|
27479
|
+
ret = fs.futimesSync(fd, at, mt);
|
|
27480
|
+
threw = false;
|
|
27481
|
+
} finally {
|
|
27482
|
+
if (threw) {
|
|
27483
|
+
try {
|
|
27484
|
+
fs.closeSync(fd);
|
|
27485
|
+
} catch (er) {}
|
|
27486
|
+
} else {
|
|
27487
|
+
fs.closeSync(fd);
|
|
27488
|
+
}
|
|
27489
|
+
}
|
|
27490
|
+
return ret
|
|
27491
|
+
};
|
|
27492
|
+
|
|
27493
|
+
} else if (fs.futimes) {
|
|
27494
|
+
fs.lutimes = function (_a, _b, _c, cb) { if (cb) process.nextTick(cb); };
|
|
27495
|
+
fs.lutimesSync = function () {};
|
|
27496
|
+
}
|
|
27497
|
+
}
|
|
27498
|
+
|
|
27499
|
+
function chmodFix (orig) {
|
|
27500
|
+
if (!orig) return orig
|
|
27501
|
+
return function (target, mode, cb) {
|
|
27502
|
+
return orig.call(fs, target, mode, function (er) {
|
|
27503
|
+
if (chownErOk(er)) er = null;
|
|
27504
|
+
if (cb) cb.apply(this, arguments);
|
|
27505
|
+
})
|
|
27506
|
+
}
|
|
27507
|
+
}
|
|
27508
|
+
|
|
27509
|
+
function chmodFixSync (orig) {
|
|
27510
|
+
if (!orig) return orig
|
|
27511
|
+
return function (target, mode) {
|
|
27512
|
+
try {
|
|
27513
|
+
return orig.call(fs, target, mode)
|
|
27514
|
+
} catch (er) {
|
|
27515
|
+
if (!chownErOk(er)) throw er
|
|
27516
|
+
}
|
|
27517
|
+
}
|
|
27518
|
+
}
|
|
27519
|
+
|
|
27520
|
+
|
|
27521
|
+
function chownFix (orig) {
|
|
27522
|
+
if (!orig) return orig
|
|
27523
|
+
return function (target, uid, gid, cb) {
|
|
27524
|
+
return orig.call(fs, target, uid, gid, function (er) {
|
|
27525
|
+
if (chownErOk(er)) er = null;
|
|
27526
|
+
if (cb) cb.apply(this, arguments);
|
|
27527
|
+
})
|
|
27528
|
+
}
|
|
27529
|
+
}
|
|
27530
|
+
|
|
27531
|
+
function chownFixSync (orig) {
|
|
27532
|
+
if (!orig) return orig
|
|
27533
|
+
return function (target, uid, gid) {
|
|
27534
|
+
try {
|
|
27535
|
+
return orig.call(fs, target, uid, gid)
|
|
27536
|
+
} catch (er) {
|
|
27537
|
+
if (!chownErOk(er)) throw er
|
|
27538
|
+
}
|
|
27539
|
+
}
|
|
27540
|
+
}
|
|
27541
|
+
|
|
27542
|
+
function statFix (orig) {
|
|
27543
|
+
if (!orig) return orig
|
|
27544
|
+
// Older versions of Node erroneously returned signed integers for
|
|
27545
|
+
// uid + gid.
|
|
27546
|
+
return function (target, options, cb) {
|
|
27547
|
+
if (typeof options === 'function') {
|
|
27548
|
+
cb = options;
|
|
27549
|
+
options = null;
|
|
27550
|
+
}
|
|
27551
|
+
function callback (er, stats) {
|
|
27552
|
+
if (stats) {
|
|
27553
|
+
if (stats.uid < 0) stats.uid += 0x100000000;
|
|
27554
|
+
if (stats.gid < 0) stats.gid += 0x100000000;
|
|
27555
|
+
}
|
|
27556
|
+
if (cb) cb.apply(this, arguments);
|
|
27557
|
+
}
|
|
27558
|
+
return options ? orig.call(fs, target, options, callback)
|
|
27559
|
+
: orig.call(fs, target, callback)
|
|
27560
|
+
}
|
|
27561
|
+
}
|
|
27562
|
+
|
|
27563
|
+
function statFixSync (orig) {
|
|
27564
|
+
if (!orig) return orig
|
|
27565
|
+
// Older versions of Node erroneously returned signed integers for
|
|
27566
|
+
// uid + gid.
|
|
27567
|
+
return function (target, options) {
|
|
27568
|
+
var stats = options ? orig.call(fs, target, options)
|
|
27569
|
+
: orig.call(fs, target);
|
|
27570
|
+
if (stats) {
|
|
27571
|
+
if (stats.uid < 0) stats.uid += 0x100000000;
|
|
27572
|
+
if (stats.gid < 0) stats.gid += 0x100000000;
|
|
27573
|
+
}
|
|
27574
|
+
return stats;
|
|
27575
|
+
}
|
|
27576
|
+
}
|
|
27577
|
+
|
|
27578
|
+
// ENOSYS means that the fs doesn't support the op. Just ignore
|
|
27579
|
+
// that, because it doesn't matter.
|
|
27580
|
+
//
|
|
27581
|
+
// if there's no getuid, or if getuid() is something other
|
|
27582
|
+
// than 0, and the error is EINVAL or EPERM, then just ignore
|
|
27583
|
+
// it.
|
|
27584
|
+
//
|
|
27585
|
+
// This specific case is a silent failure in cp, install, tar,
|
|
27586
|
+
// and most other unix tools that manage permissions.
|
|
27587
|
+
//
|
|
27588
|
+
// When running as root, or if other types of errors are
|
|
27589
|
+
// encountered, then it's strict.
|
|
27590
|
+
function chownErOk (er) {
|
|
27591
|
+
if (!er)
|
|
27592
|
+
return true
|
|
27593
|
+
|
|
27594
|
+
if (er.code === "ENOSYS")
|
|
27595
|
+
return true
|
|
27596
|
+
|
|
27597
|
+
var nonroot = !process.getuid || process.getuid() !== 0;
|
|
27598
|
+
if (nonroot) {
|
|
27599
|
+
if (er.code === "EINVAL" || er.code === "EPERM")
|
|
27600
|
+
return true
|
|
27601
|
+
}
|
|
27602
|
+
|
|
27603
|
+
return false
|
|
27604
|
+
}
|
|
27605
|
+
}
|
|
27606
|
+
return polyfills;
|
|
27607
|
+
}
|
|
27608
|
+
|
|
27609
|
+
var legacyStreams;
|
|
27610
|
+
var hasRequiredLegacyStreams;
|
|
27611
|
+
|
|
27612
|
+
function requireLegacyStreams () {
|
|
27613
|
+
if (hasRequiredLegacyStreams) return legacyStreams;
|
|
27614
|
+
hasRequiredLegacyStreams = 1;
|
|
27615
|
+
var Stream = Stream$7.Stream;
|
|
27616
|
+
|
|
27617
|
+
legacyStreams = legacy;
|
|
27618
|
+
|
|
27619
|
+
function legacy (fs) {
|
|
27620
|
+
return {
|
|
27621
|
+
ReadStream: ReadStream,
|
|
27622
|
+
WriteStream: WriteStream
|
|
27623
|
+
}
|
|
27624
|
+
|
|
27625
|
+
function ReadStream (path, options) {
|
|
27626
|
+
if (!(this instanceof ReadStream)) return new ReadStream(path, options);
|
|
27627
|
+
|
|
27628
|
+
Stream.call(this);
|
|
27629
|
+
|
|
27630
|
+
var self = this;
|
|
27631
|
+
|
|
27632
|
+
this.path = path;
|
|
27633
|
+
this.fd = null;
|
|
27634
|
+
this.readable = true;
|
|
27635
|
+
this.paused = false;
|
|
27636
|
+
|
|
27637
|
+
this.flags = 'r';
|
|
27638
|
+
this.mode = 438; /*=0666*/
|
|
27639
|
+
this.bufferSize = 64 * 1024;
|
|
27640
|
+
|
|
27641
|
+
options = options || {};
|
|
27642
|
+
|
|
27643
|
+
// Mixin options into this
|
|
27644
|
+
var keys = Object.keys(options);
|
|
27645
|
+
for (var index = 0, length = keys.length; index < length; index++) {
|
|
27646
|
+
var key = keys[index];
|
|
27647
|
+
this[key] = options[key];
|
|
27648
|
+
}
|
|
27649
|
+
|
|
27650
|
+
if (this.encoding) this.setEncoding(this.encoding);
|
|
27651
|
+
|
|
27652
|
+
if (this.start !== undefined) {
|
|
27653
|
+
if ('number' !== typeof this.start) {
|
|
27654
|
+
throw TypeError('start must be a Number');
|
|
27655
|
+
}
|
|
27656
|
+
if (this.end === undefined) {
|
|
27657
|
+
this.end = Infinity;
|
|
27658
|
+
} else if ('number' !== typeof this.end) {
|
|
27659
|
+
throw TypeError('end must be a Number');
|
|
27660
|
+
}
|
|
27661
|
+
|
|
27662
|
+
if (this.start > this.end) {
|
|
27663
|
+
throw new Error('start must be <= end');
|
|
27664
|
+
}
|
|
27665
|
+
|
|
27666
|
+
this.pos = this.start;
|
|
27667
|
+
}
|
|
27668
|
+
|
|
27669
|
+
if (this.fd !== null) {
|
|
27670
|
+
process.nextTick(function() {
|
|
27671
|
+
self._read();
|
|
27672
|
+
});
|
|
27673
|
+
return;
|
|
27674
|
+
}
|
|
27675
|
+
|
|
27676
|
+
fs.open(this.path, this.flags, this.mode, function (err, fd) {
|
|
27677
|
+
if (err) {
|
|
27678
|
+
self.emit('error', err);
|
|
27679
|
+
self.readable = false;
|
|
27680
|
+
return;
|
|
27681
|
+
}
|
|
27682
|
+
|
|
27683
|
+
self.fd = fd;
|
|
27684
|
+
self.emit('open', fd);
|
|
27685
|
+
self._read();
|
|
27686
|
+
});
|
|
27687
|
+
}
|
|
27688
|
+
|
|
27689
|
+
function WriteStream (path, options) {
|
|
27690
|
+
if (!(this instanceof WriteStream)) return new WriteStream(path, options);
|
|
27691
|
+
|
|
27692
|
+
Stream.call(this);
|
|
27693
|
+
|
|
27694
|
+
this.path = path;
|
|
27695
|
+
this.fd = null;
|
|
27696
|
+
this.writable = true;
|
|
27697
|
+
|
|
27698
|
+
this.flags = 'w';
|
|
27699
|
+
this.encoding = 'binary';
|
|
27700
|
+
this.mode = 438; /*=0666*/
|
|
27701
|
+
this.bytesWritten = 0;
|
|
27702
|
+
|
|
27703
|
+
options = options || {};
|
|
27704
|
+
|
|
27705
|
+
// Mixin options into this
|
|
27706
|
+
var keys = Object.keys(options);
|
|
27707
|
+
for (var index = 0, length = keys.length; index < length; index++) {
|
|
27708
|
+
var key = keys[index];
|
|
27709
|
+
this[key] = options[key];
|
|
27710
|
+
}
|
|
27711
|
+
|
|
27712
|
+
if (this.start !== undefined) {
|
|
27713
|
+
if ('number' !== typeof this.start) {
|
|
27714
|
+
throw TypeError('start must be a Number');
|
|
27715
|
+
}
|
|
27716
|
+
if (this.start < 0) {
|
|
27717
|
+
throw new Error('start must be >= zero');
|
|
27718
|
+
}
|
|
27719
|
+
|
|
27720
|
+
this.pos = this.start;
|
|
27721
|
+
}
|
|
27722
|
+
|
|
27723
|
+
this.busy = false;
|
|
27724
|
+
this._queue = [];
|
|
27725
|
+
|
|
27726
|
+
if (this.fd === null) {
|
|
27727
|
+
this._open = fs.open;
|
|
27728
|
+
this._queue.push([this._open, this.path, this.flags, this.mode, undefined]);
|
|
27729
|
+
this.flush();
|
|
27730
|
+
}
|
|
27731
|
+
}
|
|
27732
|
+
}
|
|
27733
|
+
return legacyStreams;
|
|
27734
|
+
}
|
|
27735
|
+
|
|
27736
|
+
var clone_1;
|
|
27737
|
+
var hasRequiredClone;
|
|
27738
|
+
|
|
27739
|
+
function requireClone () {
|
|
27740
|
+
if (hasRequiredClone) return clone_1;
|
|
27741
|
+
hasRequiredClone = 1;
|
|
27742
|
+
|
|
27743
|
+
clone_1 = clone;
|
|
27744
|
+
|
|
27745
|
+
var getPrototypeOf = Object.getPrototypeOf || function (obj) {
|
|
27746
|
+
return obj.__proto__
|
|
27747
|
+
};
|
|
27748
|
+
|
|
27749
|
+
function clone (obj) {
|
|
27750
|
+
if (obj === null || typeof obj !== 'object')
|
|
27751
|
+
return obj
|
|
27752
|
+
|
|
27753
|
+
if (obj instanceof Object)
|
|
27754
|
+
var copy = { __proto__: getPrototypeOf(obj) };
|
|
27755
|
+
else
|
|
27756
|
+
var copy = Object.create(null);
|
|
27757
|
+
|
|
27758
|
+
Object.getOwnPropertyNames(obj).forEach(function (key) {
|
|
27759
|
+
Object.defineProperty(copy, key, Object.getOwnPropertyDescriptor(obj, key));
|
|
27760
|
+
});
|
|
27761
|
+
|
|
27762
|
+
return copy
|
|
27763
|
+
}
|
|
27764
|
+
return clone_1;
|
|
27765
|
+
}
|
|
27766
|
+
|
|
27767
|
+
var gracefulFs;
|
|
27768
|
+
var hasRequiredGracefulFs;
|
|
27769
|
+
|
|
27770
|
+
function requireGracefulFs () {
|
|
27771
|
+
if (hasRequiredGracefulFs) return gracefulFs;
|
|
27772
|
+
hasRequiredGracefulFs = 1;
|
|
27773
|
+
var fs = require$$0$8;
|
|
27774
|
+
var polyfills = requirePolyfills();
|
|
27775
|
+
var legacy = requireLegacyStreams();
|
|
27776
|
+
var clone = requireClone();
|
|
27777
|
+
|
|
27778
|
+
var util = require$$1$2;
|
|
27779
|
+
|
|
27780
|
+
/* istanbul ignore next - node 0.x polyfill */
|
|
27781
|
+
var gracefulQueue;
|
|
27782
|
+
var previousSymbol;
|
|
27783
|
+
|
|
27784
|
+
/* istanbul ignore else - node 0.x polyfill */
|
|
27785
|
+
if (typeof Symbol === 'function' && typeof Symbol.for === 'function') {
|
|
27786
|
+
gracefulQueue = Symbol.for('graceful-fs.queue');
|
|
27787
|
+
// This is used in testing by future versions
|
|
27788
|
+
previousSymbol = Symbol.for('graceful-fs.previous');
|
|
27789
|
+
} else {
|
|
27790
|
+
gracefulQueue = '___graceful-fs.queue';
|
|
27791
|
+
previousSymbol = '___graceful-fs.previous';
|
|
27792
|
+
}
|
|
27793
|
+
|
|
27794
|
+
function noop () {}
|
|
27795
|
+
|
|
27796
|
+
function publishQueue(context, queue) {
|
|
27797
|
+
Object.defineProperty(context, gracefulQueue, {
|
|
27798
|
+
get: function() {
|
|
27799
|
+
return queue
|
|
27800
|
+
}
|
|
27801
|
+
});
|
|
27802
|
+
}
|
|
27803
|
+
|
|
27804
|
+
var debug = noop;
|
|
27805
|
+
if (util.debuglog)
|
|
27806
|
+
debug = util.debuglog('gfs4');
|
|
27807
|
+
else if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || ''))
|
|
27808
|
+
debug = function() {
|
|
27809
|
+
var m = util.format.apply(util, arguments);
|
|
27810
|
+
m = 'GFS4: ' + m.split(/\n/).join('\nGFS4: ');
|
|
27811
|
+
console.error(m);
|
|
27812
|
+
};
|
|
27813
|
+
|
|
27814
|
+
// Once time initialization
|
|
27815
|
+
if (!fs[gracefulQueue]) {
|
|
27816
|
+
// This queue can be shared by multiple loaded instances
|
|
27817
|
+
var queue = commonjsGlobal[gracefulQueue] || [];
|
|
27818
|
+
publishQueue(fs, queue);
|
|
27819
|
+
|
|
27820
|
+
// Patch fs.close/closeSync to shared queue version, because we need
|
|
27821
|
+
// to retry() whenever a close happens *anywhere* in the program.
|
|
27822
|
+
// This is essential when multiple graceful-fs instances are
|
|
27823
|
+
// in play at the same time.
|
|
27824
|
+
fs.close = (function (fs$close) {
|
|
27825
|
+
function close (fd, cb) {
|
|
27826
|
+
return fs$close.call(fs, fd, function (err) {
|
|
27827
|
+
// This function uses the graceful-fs shared queue
|
|
27828
|
+
if (!err) {
|
|
27829
|
+
resetQueue();
|
|
27830
|
+
}
|
|
27831
|
+
|
|
27832
|
+
if (typeof cb === 'function')
|
|
27833
|
+
cb.apply(this, arguments);
|
|
27834
|
+
})
|
|
27835
|
+
}
|
|
27836
|
+
|
|
27837
|
+
Object.defineProperty(close, previousSymbol, {
|
|
27838
|
+
value: fs$close
|
|
27839
|
+
});
|
|
27840
|
+
return close
|
|
27841
|
+
})(fs.close);
|
|
27842
|
+
|
|
27843
|
+
fs.closeSync = (function (fs$closeSync) {
|
|
27844
|
+
function closeSync (fd) {
|
|
27845
|
+
// This function uses the graceful-fs shared queue
|
|
27846
|
+
fs$closeSync.apply(fs, arguments);
|
|
27847
|
+
resetQueue();
|
|
27848
|
+
}
|
|
27849
|
+
|
|
27850
|
+
Object.defineProperty(closeSync, previousSymbol, {
|
|
27851
|
+
value: fs$closeSync
|
|
27852
|
+
});
|
|
27853
|
+
return closeSync
|
|
27854
|
+
})(fs.closeSync);
|
|
27855
|
+
|
|
27856
|
+
if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || '')) {
|
|
27857
|
+
process.on('exit', function() {
|
|
27858
|
+
debug(fs[gracefulQueue]);
|
|
27859
|
+
require$$2$3.equal(fs[gracefulQueue].length, 0);
|
|
27860
|
+
});
|
|
27861
|
+
}
|
|
27862
|
+
}
|
|
27863
|
+
|
|
27864
|
+
if (!commonjsGlobal[gracefulQueue]) {
|
|
27865
|
+
publishQueue(commonjsGlobal, fs[gracefulQueue]);
|
|
27866
|
+
}
|
|
27867
|
+
|
|
27868
|
+
gracefulFs = patch(clone(fs));
|
|
27869
|
+
if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs.__patched) {
|
|
27870
|
+
gracefulFs = patch(fs);
|
|
27871
|
+
fs.__patched = true;
|
|
27872
|
+
}
|
|
27873
|
+
|
|
27874
|
+
function patch (fs) {
|
|
27875
|
+
// Everything that references the open() function needs to be in here
|
|
27876
|
+
polyfills(fs);
|
|
27877
|
+
fs.gracefulify = patch;
|
|
27878
|
+
|
|
27879
|
+
fs.createReadStream = createReadStream;
|
|
27880
|
+
fs.createWriteStream = createWriteStream;
|
|
27881
|
+
var fs$readFile = fs.readFile;
|
|
27882
|
+
fs.readFile = readFile;
|
|
27883
|
+
function readFile (path, options, cb) {
|
|
27884
|
+
if (typeof options === 'function')
|
|
27885
|
+
cb = options, options = null;
|
|
27886
|
+
|
|
27887
|
+
return go$readFile(path, options, cb)
|
|
27888
|
+
|
|
27889
|
+
function go$readFile (path, options, cb, startTime) {
|
|
27890
|
+
return fs$readFile(path, options, function (err) {
|
|
27891
|
+
if (err && (err.code === 'EMFILE' || err.code === 'ENFILE'))
|
|
27892
|
+
enqueue([go$readFile, [path, options, cb], err, startTime || Date.now(), Date.now()]);
|
|
27893
|
+
else {
|
|
27894
|
+
if (typeof cb === 'function')
|
|
27895
|
+
cb.apply(this, arguments);
|
|
27896
|
+
}
|
|
27897
|
+
})
|
|
27898
|
+
}
|
|
27899
|
+
}
|
|
27900
|
+
|
|
27901
|
+
var fs$writeFile = fs.writeFile;
|
|
27902
|
+
fs.writeFile = writeFile;
|
|
27903
|
+
function writeFile (path, data, options, cb) {
|
|
27904
|
+
if (typeof options === 'function')
|
|
27905
|
+
cb = options, options = null;
|
|
27906
|
+
|
|
27907
|
+
return go$writeFile(path, data, options, cb)
|
|
27908
|
+
|
|
27909
|
+
function go$writeFile (path, data, options, cb, startTime) {
|
|
27910
|
+
return fs$writeFile(path, data, options, function (err) {
|
|
27911
|
+
if (err && (err.code === 'EMFILE' || err.code === 'ENFILE'))
|
|
27912
|
+
enqueue([go$writeFile, [path, data, options, cb], err, startTime || Date.now(), Date.now()]);
|
|
27913
|
+
else {
|
|
27914
|
+
if (typeof cb === 'function')
|
|
27915
|
+
cb.apply(this, arguments);
|
|
27916
|
+
}
|
|
27917
|
+
})
|
|
27918
|
+
}
|
|
27919
|
+
}
|
|
27920
|
+
|
|
27921
|
+
var fs$appendFile = fs.appendFile;
|
|
27922
|
+
if (fs$appendFile)
|
|
27923
|
+
fs.appendFile = appendFile;
|
|
27924
|
+
function appendFile (path, data, options, cb) {
|
|
27925
|
+
if (typeof options === 'function')
|
|
27926
|
+
cb = options, options = null;
|
|
27927
|
+
|
|
27928
|
+
return go$appendFile(path, data, options, cb)
|
|
27929
|
+
|
|
27930
|
+
function go$appendFile (path, data, options, cb, startTime) {
|
|
27931
|
+
return fs$appendFile(path, data, options, function (err) {
|
|
27932
|
+
if (err && (err.code === 'EMFILE' || err.code === 'ENFILE'))
|
|
27933
|
+
enqueue([go$appendFile, [path, data, options, cb], err, startTime || Date.now(), Date.now()]);
|
|
27934
|
+
else {
|
|
27935
|
+
if (typeof cb === 'function')
|
|
27936
|
+
cb.apply(this, arguments);
|
|
27937
|
+
}
|
|
27938
|
+
})
|
|
27939
|
+
}
|
|
27940
|
+
}
|
|
27941
|
+
|
|
27942
|
+
var fs$copyFile = fs.copyFile;
|
|
27943
|
+
if (fs$copyFile)
|
|
27944
|
+
fs.copyFile = copyFile;
|
|
27945
|
+
function copyFile (src, dest, flags, cb) {
|
|
27946
|
+
if (typeof flags === 'function') {
|
|
27947
|
+
cb = flags;
|
|
27948
|
+
flags = 0;
|
|
27949
|
+
}
|
|
27950
|
+
return go$copyFile(src, dest, flags, cb)
|
|
27951
|
+
|
|
27952
|
+
function go$copyFile (src, dest, flags, cb, startTime) {
|
|
27953
|
+
return fs$copyFile(src, dest, flags, function (err) {
|
|
27954
|
+
if (err && (err.code === 'EMFILE' || err.code === 'ENFILE'))
|
|
27955
|
+
enqueue([go$copyFile, [src, dest, flags, cb], err, startTime || Date.now(), Date.now()]);
|
|
27956
|
+
else {
|
|
27957
|
+
if (typeof cb === 'function')
|
|
27958
|
+
cb.apply(this, arguments);
|
|
27959
|
+
}
|
|
27960
|
+
})
|
|
27961
|
+
}
|
|
27962
|
+
}
|
|
27963
|
+
|
|
27964
|
+
var fs$readdir = fs.readdir;
|
|
27965
|
+
fs.readdir = readdir;
|
|
27966
|
+
var noReaddirOptionVersions = /^v[0-5]\./;
|
|
27967
|
+
function readdir (path, options, cb) {
|
|
27968
|
+
if (typeof options === 'function')
|
|
27969
|
+
cb = options, options = null;
|
|
27970
|
+
|
|
27971
|
+
var go$readdir = noReaddirOptionVersions.test(process.version)
|
|
27972
|
+
? function go$readdir (path, options, cb, startTime) {
|
|
27973
|
+
return fs$readdir(path, fs$readdirCallback(
|
|
27974
|
+
path, options, cb, startTime
|
|
27975
|
+
))
|
|
27976
|
+
}
|
|
27977
|
+
: function go$readdir (path, options, cb, startTime) {
|
|
27978
|
+
return fs$readdir(path, options, fs$readdirCallback(
|
|
27979
|
+
path, options, cb, startTime
|
|
27980
|
+
))
|
|
27981
|
+
};
|
|
27982
|
+
|
|
27983
|
+
return go$readdir(path, options, cb)
|
|
27984
|
+
|
|
27985
|
+
function fs$readdirCallback (path, options, cb, startTime) {
|
|
27986
|
+
return function (err, files) {
|
|
27987
|
+
if (err && (err.code === 'EMFILE' || err.code === 'ENFILE'))
|
|
27988
|
+
enqueue([
|
|
27989
|
+
go$readdir,
|
|
27990
|
+
[path, options, cb],
|
|
27991
|
+
err,
|
|
27992
|
+
startTime || Date.now(),
|
|
27993
|
+
Date.now()
|
|
27994
|
+
]);
|
|
27995
|
+
else {
|
|
27996
|
+
if (files && files.sort)
|
|
27997
|
+
files.sort();
|
|
27998
|
+
|
|
27999
|
+
if (typeof cb === 'function')
|
|
28000
|
+
cb.call(this, err, files);
|
|
28001
|
+
}
|
|
28002
|
+
}
|
|
28003
|
+
}
|
|
28004
|
+
}
|
|
28005
|
+
|
|
28006
|
+
if (process.version.substr(0, 4) === 'v0.8') {
|
|
28007
|
+
var legStreams = legacy(fs);
|
|
28008
|
+
ReadStream = legStreams.ReadStream;
|
|
28009
|
+
WriteStream = legStreams.WriteStream;
|
|
28010
|
+
}
|
|
28011
|
+
|
|
28012
|
+
var fs$ReadStream = fs.ReadStream;
|
|
28013
|
+
if (fs$ReadStream) {
|
|
28014
|
+
ReadStream.prototype = Object.create(fs$ReadStream.prototype);
|
|
28015
|
+
ReadStream.prototype.open = ReadStream$open;
|
|
28016
|
+
}
|
|
28017
|
+
|
|
28018
|
+
var fs$WriteStream = fs.WriteStream;
|
|
28019
|
+
if (fs$WriteStream) {
|
|
28020
|
+
WriteStream.prototype = Object.create(fs$WriteStream.prototype);
|
|
28021
|
+
WriteStream.prototype.open = WriteStream$open;
|
|
28022
|
+
}
|
|
28023
|
+
|
|
28024
|
+
Object.defineProperty(fs, 'ReadStream', {
|
|
28025
|
+
get: function () {
|
|
28026
|
+
return ReadStream
|
|
28027
|
+
},
|
|
28028
|
+
set: function (val) {
|
|
28029
|
+
ReadStream = val;
|
|
28030
|
+
},
|
|
28031
|
+
enumerable: true,
|
|
28032
|
+
configurable: true
|
|
28033
|
+
});
|
|
28034
|
+
Object.defineProperty(fs, 'WriteStream', {
|
|
28035
|
+
get: function () {
|
|
28036
|
+
return WriteStream
|
|
28037
|
+
},
|
|
28038
|
+
set: function (val) {
|
|
28039
|
+
WriteStream = val;
|
|
28040
|
+
},
|
|
28041
|
+
enumerable: true,
|
|
28042
|
+
configurable: true
|
|
28043
|
+
});
|
|
28044
|
+
|
|
28045
|
+
// legacy names
|
|
28046
|
+
var FileReadStream = ReadStream;
|
|
28047
|
+
Object.defineProperty(fs, 'FileReadStream', {
|
|
28048
|
+
get: function () {
|
|
28049
|
+
return FileReadStream
|
|
28050
|
+
},
|
|
28051
|
+
set: function (val) {
|
|
28052
|
+
FileReadStream = val;
|
|
28053
|
+
},
|
|
28054
|
+
enumerable: true,
|
|
28055
|
+
configurable: true
|
|
28056
|
+
});
|
|
28057
|
+
var FileWriteStream = WriteStream;
|
|
28058
|
+
Object.defineProperty(fs, 'FileWriteStream', {
|
|
28059
|
+
get: function () {
|
|
28060
|
+
return FileWriteStream
|
|
28061
|
+
},
|
|
28062
|
+
set: function (val) {
|
|
28063
|
+
FileWriteStream = val;
|
|
28064
|
+
},
|
|
28065
|
+
enumerable: true,
|
|
28066
|
+
configurable: true
|
|
28067
|
+
});
|
|
28068
|
+
|
|
28069
|
+
function ReadStream (path, options) {
|
|
28070
|
+
if (this instanceof ReadStream)
|
|
28071
|
+
return fs$ReadStream.apply(this, arguments), this
|
|
28072
|
+
else
|
|
28073
|
+
return ReadStream.apply(Object.create(ReadStream.prototype), arguments)
|
|
28074
|
+
}
|
|
28075
|
+
|
|
28076
|
+
function ReadStream$open () {
|
|
28077
|
+
var that = this;
|
|
28078
|
+
open(that.path, that.flags, that.mode, function (err, fd) {
|
|
28079
|
+
if (err) {
|
|
28080
|
+
if (that.autoClose)
|
|
28081
|
+
that.destroy();
|
|
28082
|
+
|
|
28083
|
+
that.emit('error', err);
|
|
28084
|
+
} else {
|
|
28085
|
+
that.fd = fd;
|
|
28086
|
+
that.emit('open', fd);
|
|
28087
|
+
that.read();
|
|
28088
|
+
}
|
|
28089
|
+
});
|
|
28090
|
+
}
|
|
28091
|
+
|
|
28092
|
+
function WriteStream (path, options) {
|
|
28093
|
+
if (this instanceof WriteStream)
|
|
28094
|
+
return fs$WriteStream.apply(this, arguments), this
|
|
28095
|
+
else
|
|
28096
|
+
return WriteStream.apply(Object.create(WriteStream.prototype), arguments)
|
|
28097
|
+
}
|
|
28098
|
+
|
|
28099
|
+
function WriteStream$open () {
|
|
28100
|
+
var that = this;
|
|
28101
|
+
open(that.path, that.flags, that.mode, function (err, fd) {
|
|
28102
|
+
if (err) {
|
|
28103
|
+
that.destroy();
|
|
28104
|
+
that.emit('error', err);
|
|
28105
|
+
} else {
|
|
28106
|
+
that.fd = fd;
|
|
28107
|
+
that.emit('open', fd);
|
|
28108
|
+
}
|
|
28109
|
+
});
|
|
28110
|
+
}
|
|
28111
|
+
|
|
28112
|
+
function createReadStream (path, options) {
|
|
28113
|
+
return new fs.ReadStream(path, options)
|
|
28114
|
+
}
|
|
28115
|
+
|
|
28116
|
+
function createWriteStream (path, options) {
|
|
28117
|
+
return new fs.WriteStream(path, options)
|
|
28118
|
+
}
|
|
28119
|
+
|
|
28120
|
+
var fs$open = fs.open;
|
|
28121
|
+
fs.open = open;
|
|
28122
|
+
function open (path, flags, mode, cb) {
|
|
28123
|
+
if (typeof mode === 'function')
|
|
28124
|
+
cb = mode, mode = null;
|
|
28125
|
+
|
|
28126
|
+
return go$open(path, flags, mode, cb)
|
|
28127
|
+
|
|
28128
|
+
function go$open (path, flags, mode, cb, startTime) {
|
|
28129
|
+
return fs$open(path, flags, mode, function (err, fd) {
|
|
28130
|
+
if (err && (err.code === 'EMFILE' || err.code === 'ENFILE'))
|
|
28131
|
+
enqueue([go$open, [path, flags, mode, cb], err, startTime || Date.now(), Date.now()]);
|
|
28132
|
+
else {
|
|
28133
|
+
if (typeof cb === 'function')
|
|
28134
|
+
cb.apply(this, arguments);
|
|
28135
|
+
}
|
|
28136
|
+
})
|
|
28137
|
+
}
|
|
28138
|
+
}
|
|
28139
|
+
|
|
28140
|
+
return fs
|
|
28141
|
+
}
|
|
28142
|
+
|
|
28143
|
+
function enqueue (elem) {
|
|
28144
|
+
debug('ENQUEUE', elem[0].name, elem[1]);
|
|
28145
|
+
fs[gracefulQueue].push(elem);
|
|
28146
|
+
retry();
|
|
28147
|
+
}
|
|
28148
|
+
|
|
28149
|
+
// keep track of the timeout between retry() calls
|
|
28150
|
+
var retryTimer;
|
|
28151
|
+
|
|
28152
|
+
// reset the startTime and lastTime to now
|
|
28153
|
+
// this resets the start of the 60 second overall timeout as well as the
|
|
28154
|
+
// delay between attempts so that we'll retry these jobs sooner
|
|
28155
|
+
function resetQueue () {
|
|
28156
|
+
var now = Date.now();
|
|
28157
|
+
for (var i = 0; i < fs[gracefulQueue].length; ++i) {
|
|
28158
|
+
// entries that are only a length of 2 are from an older version, don't
|
|
28159
|
+
// bother modifying those since they'll be retried anyway.
|
|
28160
|
+
if (fs[gracefulQueue][i].length > 2) {
|
|
28161
|
+
fs[gracefulQueue][i][3] = now; // startTime
|
|
28162
|
+
fs[gracefulQueue][i][4] = now; // lastTime
|
|
28163
|
+
}
|
|
28164
|
+
}
|
|
28165
|
+
// call retry to make sure we're actively processing the queue
|
|
28166
|
+
retry();
|
|
28167
|
+
}
|
|
28168
|
+
|
|
28169
|
+
function retry () {
|
|
28170
|
+
// clear the timer and remove it to help prevent unintended concurrency
|
|
28171
|
+
clearTimeout(retryTimer);
|
|
28172
|
+
retryTimer = undefined;
|
|
28173
|
+
|
|
28174
|
+
if (fs[gracefulQueue].length === 0)
|
|
28175
|
+
return
|
|
28176
|
+
|
|
28177
|
+
var elem = fs[gracefulQueue].shift();
|
|
28178
|
+
var fn = elem[0];
|
|
28179
|
+
var args = elem[1];
|
|
28180
|
+
// these items may be unset if they were added by an older graceful-fs
|
|
28181
|
+
var err = elem[2];
|
|
28182
|
+
var startTime = elem[3];
|
|
28183
|
+
var lastTime = elem[4];
|
|
28184
|
+
|
|
28185
|
+
// if we don't have a startTime we have no way of knowing if we've waited
|
|
28186
|
+
// long enough, so go ahead and retry this item now
|
|
28187
|
+
if (startTime === undefined) {
|
|
28188
|
+
debug('RETRY', fn.name, args);
|
|
28189
|
+
fn.apply(null, args);
|
|
28190
|
+
} else if (Date.now() - startTime >= 60000) {
|
|
28191
|
+
// it's been more than 60 seconds total, bail now
|
|
28192
|
+
debug('TIMEOUT', fn.name, args);
|
|
28193
|
+
var cb = args.pop();
|
|
28194
|
+
if (typeof cb === 'function')
|
|
28195
|
+
cb.call(null, err);
|
|
28196
|
+
} else {
|
|
28197
|
+
// the amount of time between the last attempt and right now
|
|
28198
|
+
var sinceAttempt = Date.now() - lastTime;
|
|
28199
|
+
// the amount of time between when we first tried, and when we last tried
|
|
28200
|
+
// rounded up to at least 1
|
|
28201
|
+
var sinceStart = Math.max(lastTime - startTime, 1);
|
|
28202
|
+
// backoff. wait longer than the total time we've been retrying, but only
|
|
28203
|
+
// up to a maximum of 100ms
|
|
28204
|
+
var desiredDelay = Math.min(sinceStart * 1.2, 100);
|
|
28205
|
+
// it's been long enough since the last retry, do it again
|
|
28206
|
+
if (sinceAttempt >= desiredDelay) {
|
|
28207
|
+
debug('RETRY', fn.name, args);
|
|
28208
|
+
fn.apply(null, args.concat([startTime]));
|
|
28209
|
+
} else {
|
|
28210
|
+
// if we can't do this job yet, push it to the end of the queue
|
|
28211
|
+
// and let the next iteration check again
|
|
28212
|
+
fs[gracefulQueue].push(elem);
|
|
28213
|
+
}
|
|
28214
|
+
}
|
|
28215
|
+
|
|
28216
|
+
// schedule our next run if one isn't already scheduled
|
|
28217
|
+
if (retryTimer === undefined) {
|
|
28218
|
+
retryTimer = setTimeout(retry, 0);
|
|
28219
|
+
}
|
|
28220
|
+
}
|
|
28221
|
+
return gracefulFs;
|
|
28222
|
+
}
|
|
28223
|
+
|
|
27245
28224
|
function stringify$7 (obj, { EOL = '\n', finalEOL = true, replacer = null, spaces } = {}) {
|
|
27246
28225
|
const EOF = finalEOL ? EOL : '';
|
|
27247
28226
|
const str = JSON.stringify(obj, replacer, spaces);
|
|
@@ -27259,7 +28238,7 @@ var utils$b = { stringify: stringify$7, stripBom: stripBom$1 };
|
|
|
27259
28238
|
|
|
27260
28239
|
let _fs;
|
|
27261
28240
|
try {
|
|
27262
|
-
_fs =
|
|
28241
|
+
_fs = requireGracefulFs();
|
|
27263
28242
|
} catch (_) {
|
|
27264
28243
|
_fs = require$$0$8;
|
|
27265
28244
|
}
|
|
@@ -27357,7 +28336,7 @@ var jsonfile = {
|
|
|
27357
28336
|
};
|
|
27358
28337
|
|
|
27359
28338
|
const u$2 = universalify$1.fromCallback;
|
|
27360
|
-
const fs$9 = gracefulFs;
|
|
28339
|
+
const fs$9 = gracefulFs$1;
|
|
27361
28340
|
const path$a = require$$1$3;
|
|
27362
28341
|
const mkdir = mkdirs$2;
|
|
27363
28342
|
const pathExists$1 = pathExists_1.pathExists;
|
|
@@ -27432,7 +28411,7 @@ jsonFile.readJSONSync = jsonFile.readJsonSync;
|
|
|
27432
28411
|
|
|
27433
28412
|
var json$3 = jsonFile;
|
|
27434
28413
|
|
|
27435
|
-
const fs$8 = gracefulFs;
|
|
28414
|
+
const fs$8 = gracefulFs$1;
|
|
27436
28415
|
const path$9 = require$$1$3;
|
|
27437
28416
|
const copy = copy$1.copy;
|
|
27438
28417
|
const remove = remove_1.remove;
|
|
@@ -27506,7 +28485,7 @@ function moveAcrossDevice$1 (src, dest, overwrite, cb) {
|
|
|
27506
28485
|
|
|
27507
28486
|
var move_1 = move$1;
|
|
27508
28487
|
|
|
27509
|
-
const fs$7 = gracefulFs;
|
|
28488
|
+
const fs$7 = gracefulFs$1;
|
|
27510
28489
|
const path$8 = require$$1$3;
|
|
27511
28490
|
const copySync = copy$1.copySync;
|
|
27512
28491
|
const removeSync = remove_1.removeSync;
|
|
@@ -29778,7 +30757,7 @@ function shutdown(cb) {
|
|
|
29778
30757
|
* @param loggerCategoryName
|
|
29779
30758
|
* @return {Logger} instance of logger for the category
|
|
29780
30759
|
*/
|
|
29781
|
-
function getLogger(category) {
|
|
30760
|
+
function getLogger$1(category) {
|
|
29782
30761
|
if (!enabled) {
|
|
29783
30762
|
configure(
|
|
29784
30763
|
process.env.LOG4JS_CONFIG || {
|
|
@@ -29798,7 +30777,7 @@ function getLogger(category) {
|
|
|
29798
30777
|
* @property shutdown
|
|
29799
30778
|
*/
|
|
29800
30779
|
const log4js = {
|
|
29801
|
-
getLogger,
|
|
30780
|
+
getLogger: getLogger$1,
|
|
29802
30781
|
configure,
|
|
29803
30782
|
shutdown,
|
|
29804
30783
|
connectLogger,
|
|
@@ -33177,17 +34156,17 @@ const {
|
|
|
33177
34156
|
} = extraTypingsCommander;
|
|
33178
34157
|
|
|
33179
34158
|
if (process.env.NODE_ENV !== "TEST") {
|
|
33180
|
-
dotenv.config({ path:
|
|
34159
|
+
dotenv.config({ path: resolve$3(homedir(), ".nodestatus/.env.local") });
|
|
33181
34160
|
} else {
|
|
33182
|
-
process.env.DATABASE = process.env.DATABASE ? process.env.DATABASE :
|
|
34161
|
+
process.env.DATABASE = process.env.DATABASE ? process.env.DATABASE : resolve$3(__dirname, "../../db.test.sqlite");
|
|
33183
34162
|
}
|
|
33184
|
-
const program = new Command("NodeStatus").addOption(createOption("-p, --port <port>", "Web server listening port").env("PORT").default(35601).argParser((value) => parseInt(value, 10))).addOption(createOption("-i, --interval <interval>", "Update interval").env("INTERVAL").default(1500).argParser((value) => parseInt(value, 10))).addOption(createOption("-v, --verbose", "Verbose mode").env("VERBOSE").default(false)).addOption(createOption("-pi, --ping-interval <pingInterval>", "Ping interval").env("PING_INTERVAL").default(30).argParser((value) => parseInt(value, 10))).addOption(createOption("-ipc, --use-ipc", "Use IPC").env("USE_IPC").default(true)).addOption(createOption("-web, --use-web", "Use Web").env("USE_WEB").default(true)).addOption(createOption("-push, --use-push", "Use Push").env("USE_PUSH").default(true)).addOption(createOption("-wt, --web-theme <webTheme>", "Web theme").env("WEB_THEME").env("THEME").default("hotaru-theme")).addOption(createOption("-wmt, --web-title <webTitle>", "Web title").env("WEB_TITLE").default("Server Status")).addOption(createOption("-wst, --web-subtitle <webSubtitle>", "Web subtitle").env("WEB_SUBTITLE").default("Servers' Probes Set up with NodeStatus")).addOption(createOption("-wht, --web-headtitle <webHeadtitle>", "Web head title").env("WEB_HEADTITLE").default("NodeStatus")).addOption(createOption("-wu, --web-username <webUsername>", "Web username").env("WEB_USERNAME").default("admin")).addOption(createOption("-wp, --web-password <webPassword>", "Web password").env("WEB_PASSWORD").default("")).addOption(createOption("-ws, --web-secret <webSecret>", "Web jwt secret").env("WEB_SECRET").default("node-secret")).addOption(
|
|
34163
|
+
const program = new Command("NodeStatus").addOption(createOption("-p, --port <port>", "Web server listening port").env("PORT").default(35601).argParser((value) => parseInt(value, 10))).addOption(createOption("-i, --interval <interval>", "Update interval").env("INTERVAL").default(1500).argParser((value) => parseInt(value, 10))).addOption(createOption("-v, --verbose", "Verbose mode").env("VERBOSE").default(false)).addOption(createOption("-pi, --ping-interval <pingInterval>", "Ping interval").env("PING_INTERVAL").default(30).argParser((value) => parseInt(value, 10))).addOption(createOption("-ipc, --use-ipc", "Use IPC").env("USE_IPC").default(true)).addOption(createOption("-web, --use-web", "Use Web").env("USE_WEB").default(true)).addOption(createOption("-push, --use-push", "Use Push").env("USE_PUSH").default(true)).addOption(createOption("-wt, --web-theme <webTheme>", "Web theme").env("WEB_THEME").env("THEME").default("hotaru-theme")).addOption(createOption("-wmt, --web-title <webTitle>", "Web title").env("WEB_TITLE").default("Server Status")).addOption(createOption("-wst, --web-subtitle <webSubtitle>", "Web subtitle").env("WEB_SUBTITLE").default("Servers' Probes Set up with NodeStatus")).addOption(createOption("-wht, --web-headtitle <webHeadtitle>", "Web head title").env("WEB_HEADTITLE").default("NodeStatus")).addOption(createOption("-wu, --web-username <webUsername>", "Web username").env("WEB_USERNAME").default("admin")).addOption(createOption("-wp, --web-password <webPassword>", "Web password").env("WEB_PASSWORD").default("")).addOption(createOption("-ws, --web-secret <webSecret>", "Web jwt secret").env("WEB_SECRET").default("node-secret").argParser((val) => val || "node-secret")).addOption(
|
|
33185
34164
|
createOption("-ia, --ipc-address <ipcAddress>", "IPC address").env("IPC_ADDRESS").default(
|
|
33186
|
-
|
|
34165
|
+
platform$1() !== "win32" ? "/tmp/status_unix.sock" : "\\\\.\\pipe\\status_ipc"
|
|
33187
34166
|
)
|
|
33188
34167
|
).addOption(createOption("-pt, --push-timeout <pushTimeout>", "Push timeout").env("PUSH_TIMEOUT").default(120).argParser((value) => parseInt(value, 10))).addOption(createOption("-pd, --push-delay <pushDelay>", "Push delay").env("PUSH_DELAY").default(15).argParser((value) => parseInt(value, 10))).addOption(createOption("-ti, --telegram-bot-token <telegramBotToken>", "Telegram bot token").env("TGBOT_TOKEN").default("")).addOption(createOption("-tc, --telegram-chat-id <telegramChatId>", "Telegram chat id").env("TGBOT_CHATID").default("")).addOption(createOption("-tp, --telegram-proxy <telegramProxy>", "Telegram proxy").env("TGBOT_PROXY")).addOption(createOption("-tw, --telegram-web-hook <telegramWebHook>", "Telegram web hook").env("TGBOT_WEBHOOK")).parse(process.argv);
|
|
33189
34168
|
const options = program.opts();
|
|
33190
|
-
let database = process.env.DATABASE || (
|
|
34169
|
+
let database = process.env.DATABASE || (platform$1() === "win32" ? `file:${resolve$3(homedir(), ".nodestatus/db.sqlite")}` : "file:/usr/local/NodeStatus/server/db.sqlite");
|
|
33191
34170
|
if (!(database.includes("file:") || database.includes("mysql:") || database.includes("postgresql:"))) {
|
|
33192
34171
|
database = `file:${database}`;
|
|
33193
34172
|
}
|
|
@@ -81832,1429 +82811,9 @@ const verifySession = (ctx) => {
|
|
|
81832
82811
|
ctx.body = createRes(1, "Verification failure");
|
|
81833
82812
|
};
|
|
81834
82813
|
|
|
81835
|
-
var bcryptjsExports = {};
|
|
81836
|
-
var bcryptjs = {
|
|
81837
|
-
get exports(){ return bcryptjsExports; },
|
|
81838
|
-
set exports(v){ bcryptjsExports = v; },
|
|
81839
|
-
};
|
|
81840
|
-
|
|
81841
|
-
var bcryptExports = {};
|
|
81842
|
-
var bcrypt = {
|
|
81843
|
-
get exports(){ return bcryptExports; },
|
|
81844
|
-
set exports(v){ bcryptExports = v; },
|
|
81845
|
-
};
|
|
81846
|
-
|
|
81847
|
-
/*
|
|
81848
|
-
Copyright (c) 2012 Nevins Bartolomeo <nevins.bartolomeo@gmail.com>
|
|
81849
|
-
Copyright (c) 2012 Shane Girish <shaneGirish@gmail.com>
|
|
81850
|
-
Copyright (c) 2014 Daniel Wirtz <dcode@dcode.io>
|
|
81851
|
-
|
|
81852
|
-
Redistribution and use in source and binary forms, with or without
|
|
81853
|
-
modification, are permitted provided that the following conditions
|
|
81854
|
-
are met:
|
|
81855
|
-
1. Redistributions of source code must retain the above copyright
|
|
81856
|
-
notice, this list of conditions and the following disclaimer.
|
|
81857
|
-
2. Redistributions in binary form must reproduce the above copyright
|
|
81858
|
-
notice, this list of conditions and the following disclaimer in the
|
|
81859
|
-
documentation and/or other materials provided with the distribution.
|
|
81860
|
-
3. The name of the author may not be used to endorse or promote products
|
|
81861
|
-
derived from this software without specific prior written permission.
|
|
81862
|
-
|
|
81863
|
-
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
|
81864
|
-
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|
81865
|
-
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
81866
|
-
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
81867
|
-
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|
81868
|
-
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
81869
|
-
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
81870
|
-
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
81871
|
-
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|
81872
|
-
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
81873
|
-
*/
|
|
81874
|
-
|
|
81875
|
-
(function (module) {
|
|
81876
|
-
/**
|
|
81877
|
-
* @license bcrypt.js (c) 2013 Daniel Wirtz <dcode@dcode.io>
|
|
81878
|
-
* Released under the Apache License, Version 2.0
|
|
81879
|
-
* see: https://github.com/dcodeIO/bcrypt.js for details
|
|
81880
|
-
*/
|
|
81881
|
-
(function(global, factory) {
|
|
81882
|
-
|
|
81883
|
-
/* AMD */ if (typeof commonjsRequire === 'function' && 'object' === "object" && module && module["exports"])
|
|
81884
|
-
module["exports"] = factory();
|
|
81885
|
-
/* Global */ else
|
|
81886
|
-
(global["dcodeIO"] = global["dcodeIO"] || {})["bcrypt"] = factory();
|
|
81887
|
-
|
|
81888
|
-
}(commonjsGlobal, function() {
|
|
81889
|
-
|
|
81890
|
-
/**
|
|
81891
|
-
* bcrypt namespace.
|
|
81892
|
-
* @type {Object.<string,*>}
|
|
81893
|
-
*/
|
|
81894
|
-
var bcrypt = {};
|
|
81895
|
-
|
|
81896
|
-
/**
|
|
81897
|
-
* The random implementation to use as a fallback.
|
|
81898
|
-
* @type {?function(number):!Array.<number>}
|
|
81899
|
-
* @inner
|
|
81900
|
-
*/
|
|
81901
|
-
var randomFallback = null;
|
|
81902
|
-
|
|
81903
|
-
/**
|
|
81904
|
-
* Generates cryptographically secure random bytes.
|
|
81905
|
-
* @function
|
|
81906
|
-
* @param {number} len Bytes length
|
|
81907
|
-
* @returns {!Array.<number>} Random bytes
|
|
81908
|
-
* @throws {Error} If no random implementation is available
|
|
81909
|
-
* @inner
|
|
81910
|
-
*/
|
|
81911
|
-
function random(len) {
|
|
81912
|
-
/* node */ if (module && module['exports'])
|
|
81913
|
-
try {
|
|
81914
|
-
return require("crypto")['randomBytes'](len);
|
|
81915
|
-
} catch (e) {}
|
|
81916
|
-
/* WCA */ try {
|
|
81917
|
-
var a; (self['crypto']||self['msCrypto'])['getRandomValues'](a = new Uint32Array(len));
|
|
81918
|
-
return Array.prototype.slice.call(a);
|
|
81919
|
-
} catch (e) {}
|
|
81920
|
-
/* fallback */ if (!randomFallback)
|
|
81921
|
-
throw Error("Neither WebCryptoAPI nor a crypto module is available. Use bcrypt.setRandomFallback to set an alternative");
|
|
81922
|
-
return randomFallback(len);
|
|
81923
|
-
}
|
|
81924
|
-
|
|
81925
|
-
// Test if any secure randomness source is available
|
|
81926
|
-
var randomAvailable = false;
|
|
81927
|
-
try {
|
|
81928
|
-
random(1);
|
|
81929
|
-
randomAvailable = true;
|
|
81930
|
-
} catch (e) {}
|
|
81931
|
-
|
|
81932
|
-
// Default fallback, if any
|
|
81933
|
-
randomFallback = null;
|
|
81934
|
-
/**
|
|
81935
|
-
* Sets the pseudo random number generator to use as a fallback if neither node's `crypto` module nor the Web Crypto
|
|
81936
|
-
* API is available. Please note: It is highly important that the PRNG used is cryptographically secure and that it
|
|
81937
|
-
* is seeded properly!
|
|
81938
|
-
* @param {?function(number):!Array.<number>} random Function taking the number of bytes to generate as its
|
|
81939
|
-
* sole argument, returning the corresponding array of cryptographically secure random byte values.
|
|
81940
|
-
* @see http://nodejs.org/api/crypto.html
|
|
81941
|
-
* @see http://www.w3.org/TR/WebCryptoAPI/
|
|
81942
|
-
*/
|
|
81943
|
-
bcrypt.setRandomFallback = function(random) {
|
|
81944
|
-
randomFallback = random;
|
|
81945
|
-
};
|
|
81946
|
-
|
|
81947
|
-
/**
|
|
81948
|
-
* Synchronously generates a salt.
|
|
81949
|
-
* @param {number=} rounds Number of rounds to use, defaults to 10 if omitted
|
|
81950
|
-
* @param {number=} seed_length Not supported.
|
|
81951
|
-
* @returns {string} Resulting salt
|
|
81952
|
-
* @throws {Error} If a random fallback is required but not set
|
|
81953
|
-
* @expose
|
|
81954
|
-
*/
|
|
81955
|
-
bcrypt.genSaltSync = function(rounds, seed_length) {
|
|
81956
|
-
rounds = rounds || GENSALT_DEFAULT_LOG2_ROUNDS;
|
|
81957
|
-
if (typeof rounds !== 'number')
|
|
81958
|
-
throw Error("Illegal arguments: "+(typeof rounds)+", "+(typeof seed_length));
|
|
81959
|
-
if (rounds < 4)
|
|
81960
|
-
rounds = 4;
|
|
81961
|
-
else if (rounds > 31)
|
|
81962
|
-
rounds = 31;
|
|
81963
|
-
var salt = [];
|
|
81964
|
-
salt.push("$2a$");
|
|
81965
|
-
if (rounds < 10)
|
|
81966
|
-
salt.push("0");
|
|
81967
|
-
salt.push(rounds.toString());
|
|
81968
|
-
salt.push('$');
|
|
81969
|
-
salt.push(base64_encode(random(BCRYPT_SALT_LEN), BCRYPT_SALT_LEN)); // May throw
|
|
81970
|
-
return salt.join('');
|
|
81971
|
-
};
|
|
81972
|
-
|
|
81973
|
-
/**
|
|
81974
|
-
* Asynchronously generates a salt.
|
|
81975
|
-
* @param {(number|function(Error, string=))=} rounds Number of rounds to use, defaults to 10 if omitted
|
|
81976
|
-
* @param {(number|function(Error, string=))=} seed_length Not supported.
|
|
81977
|
-
* @param {function(Error, string=)=} callback Callback receiving the error, if any, and the resulting salt
|
|
81978
|
-
* @returns {!Promise} If `callback` has been omitted
|
|
81979
|
-
* @throws {Error} If `callback` is present but not a function
|
|
81980
|
-
* @expose
|
|
81981
|
-
*/
|
|
81982
|
-
bcrypt.genSalt = function(rounds, seed_length, callback) {
|
|
81983
|
-
if (typeof seed_length === 'function')
|
|
81984
|
-
callback = seed_length,
|
|
81985
|
-
seed_length = undefined; // Not supported.
|
|
81986
|
-
if (typeof rounds === 'function')
|
|
81987
|
-
callback = rounds,
|
|
81988
|
-
rounds = undefined;
|
|
81989
|
-
if (typeof rounds === 'undefined')
|
|
81990
|
-
rounds = GENSALT_DEFAULT_LOG2_ROUNDS;
|
|
81991
|
-
else if (typeof rounds !== 'number')
|
|
81992
|
-
throw Error("illegal arguments: "+(typeof rounds));
|
|
81993
|
-
|
|
81994
|
-
function _async(callback) {
|
|
81995
|
-
nextTick(function() { // Pretty thin, but salting is fast enough
|
|
81996
|
-
try {
|
|
81997
|
-
callback(null, bcrypt.genSaltSync(rounds));
|
|
81998
|
-
} catch (err) {
|
|
81999
|
-
callback(err);
|
|
82000
|
-
}
|
|
82001
|
-
});
|
|
82002
|
-
}
|
|
82003
|
-
|
|
82004
|
-
if (callback) {
|
|
82005
|
-
if (typeof callback !== 'function')
|
|
82006
|
-
throw Error("Illegal callback: "+typeof(callback));
|
|
82007
|
-
_async(callback);
|
|
82008
|
-
} else
|
|
82009
|
-
return new Promise(function(resolve, reject) {
|
|
82010
|
-
_async(function(err, res) {
|
|
82011
|
-
if (err) {
|
|
82012
|
-
reject(err);
|
|
82013
|
-
return;
|
|
82014
|
-
}
|
|
82015
|
-
resolve(res);
|
|
82016
|
-
});
|
|
82017
|
-
});
|
|
82018
|
-
};
|
|
82019
|
-
|
|
82020
|
-
/**
|
|
82021
|
-
* Synchronously generates a hash for the given string.
|
|
82022
|
-
* @param {string} s String to hash
|
|
82023
|
-
* @param {(number|string)=} salt Salt length to generate or salt to use, default to 10
|
|
82024
|
-
* @returns {string} Resulting hash
|
|
82025
|
-
* @expose
|
|
82026
|
-
*/
|
|
82027
|
-
bcrypt.hashSync = function(s, salt) {
|
|
82028
|
-
if (typeof salt === 'undefined')
|
|
82029
|
-
salt = GENSALT_DEFAULT_LOG2_ROUNDS;
|
|
82030
|
-
if (typeof salt === 'number')
|
|
82031
|
-
salt = bcrypt.genSaltSync(salt);
|
|
82032
|
-
if (typeof s !== 'string' || typeof salt !== 'string')
|
|
82033
|
-
throw Error("Illegal arguments: "+(typeof s)+', '+(typeof salt));
|
|
82034
|
-
return _hash(s, salt);
|
|
82035
|
-
};
|
|
82036
|
-
|
|
82037
|
-
/**
|
|
82038
|
-
* Asynchronously generates a hash for the given string.
|
|
82039
|
-
* @param {string} s String to hash
|
|
82040
|
-
* @param {number|string} salt Salt length to generate or salt to use
|
|
82041
|
-
* @param {function(Error, string=)=} callback Callback receiving the error, if any, and the resulting hash
|
|
82042
|
-
* @param {function(number)=} progressCallback Callback successively called with the percentage of rounds completed
|
|
82043
|
-
* (0.0 - 1.0), maximally once per `MAX_EXECUTION_TIME = 100` ms.
|
|
82044
|
-
* @returns {!Promise} If `callback` has been omitted
|
|
82045
|
-
* @throws {Error} If `callback` is present but not a function
|
|
82046
|
-
* @expose
|
|
82047
|
-
*/
|
|
82048
|
-
bcrypt.hash = function(s, salt, callback, progressCallback) {
|
|
82049
|
-
|
|
82050
|
-
function _async(callback) {
|
|
82051
|
-
if (typeof s === 'string' && typeof salt === 'number')
|
|
82052
|
-
bcrypt.genSalt(salt, function(err, salt) {
|
|
82053
|
-
_hash(s, salt, callback, progressCallback);
|
|
82054
|
-
});
|
|
82055
|
-
else if (typeof s === 'string' && typeof salt === 'string')
|
|
82056
|
-
_hash(s, salt, callback, progressCallback);
|
|
82057
|
-
else
|
|
82058
|
-
nextTick(callback.bind(this, Error("Illegal arguments: "+(typeof s)+', '+(typeof salt))));
|
|
82059
|
-
}
|
|
82060
|
-
|
|
82061
|
-
if (callback) {
|
|
82062
|
-
if (typeof callback !== 'function')
|
|
82063
|
-
throw Error("Illegal callback: "+typeof(callback));
|
|
82064
|
-
_async(callback);
|
|
82065
|
-
} else
|
|
82066
|
-
return new Promise(function(resolve, reject) {
|
|
82067
|
-
_async(function(err, res) {
|
|
82068
|
-
if (err) {
|
|
82069
|
-
reject(err);
|
|
82070
|
-
return;
|
|
82071
|
-
}
|
|
82072
|
-
resolve(res);
|
|
82073
|
-
});
|
|
82074
|
-
});
|
|
82075
|
-
};
|
|
82076
|
-
|
|
82077
|
-
/**
|
|
82078
|
-
* Compares two strings of the same length in constant time.
|
|
82079
|
-
* @param {string} known Must be of the correct length
|
|
82080
|
-
* @param {string} unknown Must be the same length as `known`
|
|
82081
|
-
* @returns {boolean}
|
|
82082
|
-
* @inner
|
|
82083
|
-
*/
|
|
82084
|
-
function safeStringCompare(known, unknown) {
|
|
82085
|
-
var right = 0,
|
|
82086
|
-
wrong = 0;
|
|
82087
|
-
for (var i=0, k=known.length; i<k; ++i) {
|
|
82088
|
-
if (known.charCodeAt(i) === unknown.charCodeAt(i))
|
|
82089
|
-
++right;
|
|
82090
|
-
else
|
|
82091
|
-
++wrong;
|
|
82092
|
-
}
|
|
82093
|
-
// Prevent removal of unused variables (never true, actually)
|
|
82094
|
-
if (right < 0)
|
|
82095
|
-
return false;
|
|
82096
|
-
return wrong === 0;
|
|
82097
|
-
}
|
|
82098
|
-
|
|
82099
|
-
/**
|
|
82100
|
-
* Synchronously tests a string against a hash.
|
|
82101
|
-
* @param {string} s String to compare
|
|
82102
|
-
* @param {string} hash Hash to test against
|
|
82103
|
-
* @returns {boolean} true if matching, otherwise false
|
|
82104
|
-
* @throws {Error} If an argument is illegal
|
|
82105
|
-
* @expose
|
|
82106
|
-
*/
|
|
82107
|
-
bcrypt.compareSync = function(s, hash) {
|
|
82108
|
-
if (typeof s !== "string" || typeof hash !== "string")
|
|
82109
|
-
throw Error("Illegal arguments: "+(typeof s)+', '+(typeof hash));
|
|
82110
|
-
if (hash.length !== 60)
|
|
82111
|
-
return false;
|
|
82112
|
-
return safeStringCompare(bcrypt.hashSync(s, hash.substr(0, hash.length-31)), hash);
|
|
82113
|
-
};
|
|
82114
|
-
|
|
82115
|
-
/**
|
|
82116
|
-
* Asynchronously compares the given data against the given hash.
|
|
82117
|
-
* @param {string} s Data to compare
|
|
82118
|
-
* @param {string} hash Data to be compared to
|
|
82119
|
-
* @param {function(Error, boolean)=} callback Callback receiving the error, if any, otherwise the result
|
|
82120
|
-
* @param {function(number)=} progressCallback Callback successively called with the percentage of rounds completed
|
|
82121
|
-
* (0.0 - 1.0), maximally once per `MAX_EXECUTION_TIME = 100` ms.
|
|
82122
|
-
* @returns {!Promise} If `callback` has been omitted
|
|
82123
|
-
* @throws {Error} If `callback` is present but not a function
|
|
82124
|
-
* @expose
|
|
82125
|
-
*/
|
|
82126
|
-
bcrypt.compare = function(s, hash, callback, progressCallback) {
|
|
82127
|
-
|
|
82128
|
-
function _async(callback) {
|
|
82129
|
-
if (typeof s !== "string" || typeof hash !== "string") {
|
|
82130
|
-
nextTick(callback.bind(this, Error("Illegal arguments: "+(typeof s)+', '+(typeof hash))));
|
|
82131
|
-
return;
|
|
82132
|
-
}
|
|
82133
|
-
if (hash.length !== 60) {
|
|
82134
|
-
nextTick(callback.bind(this, null, false));
|
|
82135
|
-
return;
|
|
82136
|
-
}
|
|
82137
|
-
bcrypt.hash(s, hash.substr(0, 29), function(err, comp) {
|
|
82138
|
-
if (err)
|
|
82139
|
-
callback(err);
|
|
82140
|
-
else
|
|
82141
|
-
callback(null, safeStringCompare(comp, hash));
|
|
82142
|
-
}, progressCallback);
|
|
82143
|
-
}
|
|
82144
|
-
|
|
82145
|
-
if (callback) {
|
|
82146
|
-
if (typeof callback !== 'function')
|
|
82147
|
-
throw Error("Illegal callback: "+typeof(callback));
|
|
82148
|
-
_async(callback);
|
|
82149
|
-
} else
|
|
82150
|
-
return new Promise(function(resolve, reject) {
|
|
82151
|
-
_async(function(err, res) {
|
|
82152
|
-
if (err) {
|
|
82153
|
-
reject(err);
|
|
82154
|
-
return;
|
|
82155
|
-
}
|
|
82156
|
-
resolve(res);
|
|
82157
|
-
});
|
|
82158
|
-
});
|
|
82159
|
-
};
|
|
82160
|
-
|
|
82161
|
-
/**
|
|
82162
|
-
* Gets the number of rounds used to encrypt the specified hash.
|
|
82163
|
-
* @param {string} hash Hash to extract the used number of rounds from
|
|
82164
|
-
* @returns {number} Number of rounds used
|
|
82165
|
-
* @throws {Error} If `hash` is not a string
|
|
82166
|
-
* @expose
|
|
82167
|
-
*/
|
|
82168
|
-
bcrypt.getRounds = function(hash) {
|
|
82169
|
-
if (typeof hash !== "string")
|
|
82170
|
-
throw Error("Illegal arguments: "+(typeof hash));
|
|
82171
|
-
return parseInt(hash.split("$")[2], 10);
|
|
82172
|
-
};
|
|
82173
|
-
|
|
82174
|
-
/**
|
|
82175
|
-
* Gets the salt portion from a hash. Does not validate the hash.
|
|
82176
|
-
* @param {string} hash Hash to extract the salt from
|
|
82177
|
-
* @returns {string} Extracted salt part
|
|
82178
|
-
* @throws {Error} If `hash` is not a string or otherwise invalid
|
|
82179
|
-
* @expose
|
|
82180
|
-
*/
|
|
82181
|
-
bcrypt.getSalt = function(hash) {
|
|
82182
|
-
if (typeof hash !== 'string')
|
|
82183
|
-
throw Error("Illegal arguments: "+(typeof hash));
|
|
82184
|
-
if (hash.length !== 60)
|
|
82185
|
-
throw Error("Illegal hash length: "+hash.length+" != 60");
|
|
82186
|
-
return hash.substring(0, 29);
|
|
82187
|
-
};
|
|
82188
|
-
|
|
82189
|
-
/**
|
|
82190
|
-
* Continues with the callback on the next tick.
|
|
82191
|
-
* @function
|
|
82192
|
-
* @param {function(...[*])} callback Callback to execute
|
|
82193
|
-
* @inner
|
|
82194
|
-
*/
|
|
82195
|
-
var nextTick = typeof process !== 'undefined' && process && typeof process.nextTick === 'function'
|
|
82196
|
-
? (typeof setImmediate === 'function' ? setImmediate : process.nextTick)
|
|
82197
|
-
: setTimeout;
|
|
82198
|
-
|
|
82199
|
-
/**
|
|
82200
|
-
* Converts a JavaScript string to UTF8 bytes.
|
|
82201
|
-
* @param {string} str String
|
|
82202
|
-
* @returns {!Array.<number>} UTF8 bytes
|
|
82203
|
-
* @inner
|
|
82204
|
-
*/
|
|
82205
|
-
function stringToBytes(str) {
|
|
82206
|
-
var out = [],
|
|
82207
|
-
i = 0;
|
|
82208
|
-
utfx.encodeUTF16toUTF8(function() {
|
|
82209
|
-
if (i >= str.length) return null;
|
|
82210
|
-
return str.charCodeAt(i++);
|
|
82211
|
-
}, function(b) {
|
|
82212
|
-
out.push(b);
|
|
82213
|
-
});
|
|
82214
|
-
return out;
|
|
82215
|
-
}
|
|
82216
|
-
|
|
82217
|
-
// A base64 implementation for the bcrypt algorithm. This is partly non-standard.
|
|
82218
|
-
|
|
82219
|
-
/**
|
|
82220
|
-
* bcrypt's own non-standard base64 dictionary.
|
|
82221
|
-
* @type {!Array.<string>}
|
|
82222
|
-
* @const
|
|
82223
|
-
* @inner
|
|
82224
|
-
**/
|
|
82225
|
-
var BASE64_CODE = "./ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".split('');
|
|
82226
|
-
|
|
82227
|
-
/**
|
|
82228
|
-
* @type {!Array.<number>}
|
|
82229
|
-
* @const
|
|
82230
|
-
* @inner
|
|
82231
|
-
**/
|
|
82232
|
-
var BASE64_INDEX = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
|
82233
|
-
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
|
82234
|
-
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0,
|
|
82235
|
-
1, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, -1, -1, -1, -1, -1, -1,
|
|
82236
|
-
-1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
|
|
82237
|
-
20, 21, 22, 23, 24, 25, 26, 27, -1, -1, -1, -1, -1, -1, 28, 29, 30,
|
|
82238
|
-
31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
|
|
82239
|
-
48, 49, 50, 51, 52, 53, -1, -1, -1, -1, -1];
|
|
82240
|
-
|
|
82241
|
-
/**
|
|
82242
|
-
* @type {!function(...number):string}
|
|
82243
|
-
* @inner
|
|
82244
|
-
*/
|
|
82245
|
-
var stringFromCharCode = String.fromCharCode;
|
|
82246
|
-
|
|
82247
|
-
/**
|
|
82248
|
-
* Encodes a byte array to base64 with up to len bytes of input.
|
|
82249
|
-
* @param {!Array.<number>} b Byte array
|
|
82250
|
-
* @param {number} len Maximum input length
|
|
82251
|
-
* @returns {string}
|
|
82252
|
-
* @inner
|
|
82253
|
-
*/
|
|
82254
|
-
function base64_encode(b, len) {
|
|
82255
|
-
var off = 0,
|
|
82256
|
-
rs = [],
|
|
82257
|
-
c1, c2;
|
|
82258
|
-
if (len <= 0 || len > b.length)
|
|
82259
|
-
throw Error("Illegal len: "+len);
|
|
82260
|
-
while (off < len) {
|
|
82261
|
-
c1 = b[off++] & 0xff;
|
|
82262
|
-
rs.push(BASE64_CODE[(c1 >> 2) & 0x3f]);
|
|
82263
|
-
c1 = (c1 & 0x03) << 4;
|
|
82264
|
-
if (off >= len) {
|
|
82265
|
-
rs.push(BASE64_CODE[c1 & 0x3f]);
|
|
82266
|
-
break;
|
|
82267
|
-
}
|
|
82268
|
-
c2 = b[off++] & 0xff;
|
|
82269
|
-
c1 |= (c2 >> 4) & 0x0f;
|
|
82270
|
-
rs.push(BASE64_CODE[c1 & 0x3f]);
|
|
82271
|
-
c1 = (c2 & 0x0f) << 2;
|
|
82272
|
-
if (off >= len) {
|
|
82273
|
-
rs.push(BASE64_CODE[c1 & 0x3f]);
|
|
82274
|
-
break;
|
|
82275
|
-
}
|
|
82276
|
-
c2 = b[off++] & 0xff;
|
|
82277
|
-
c1 |= (c2 >> 6) & 0x03;
|
|
82278
|
-
rs.push(BASE64_CODE[c1 & 0x3f]);
|
|
82279
|
-
rs.push(BASE64_CODE[c2 & 0x3f]);
|
|
82280
|
-
}
|
|
82281
|
-
return rs.join('');
|
|
82282
|
-
}
|
|
82283
|
-
|
|
82284
|
-
/**
|
|
82285
|
-
* Decodes a base64 encoded string to up to len bytes of output.
|
|
82286
|
-
* @param {string} s String to decode
|
|
82287
|
-
* @param {number} len Maximum output length
|
|
82288
|
-
* @returns {!Array.<number>}
|
|
82289
|
-
* @inner
|
|
82290
|
-
*/
|
|
82291
|
-
function base64_decode(s, len) {
|
|
82292
|
-
var off = 0,
|
|
82293
|
-
slen = s.length,
|
|
82294
|
-
olen = 0,
|
|
82295
|
-
rs = [],
|
|
82296
|
-
c1, c2, c3, c4, o, code;
|
|
82297
|
-
if (len <= 0)
|
|
82298
|
-
throw Error("Illegal len: "+len);
|
|
82299
|
-
while (off < slen - 1 && olen < len) {
|
|
82300
|
-
code = s.charCodeAt(off++);
|
|
82301
|
-
c1 = code < BASE64_INDEX.length ? BASE64_INDEX[code] : -1;
|
|
82302
|
-
code = s.charCodeAt(off++);
|
|
82303
|
-
c2 = code < BASE64_INDEX.length ? BASE64_INDEX[code] : -1;
|
|
82304
|
-
if (c1 == -1 || c2 == -1)
|
|
82305
|
-
break;
|
|
82306
|
-
o = (c1 << 2) >>> 0;
|
|
82307
|
-
o |= (c2 & 0x30) >> 4;
|
|
82308
|
-
rs.push(stringFromCharCode(o));
|
|
82309
|
-
if (++olen >= len || off >= slen)
|
|
82310
|
-
break;
|
|
82311
|
-
code = s.charCodeAt(off++);
|
|
82312
|
-
c3 = code < BASE64_INDEX.length ? BASE64_INDEX[code] : -1;
|
|
82313
|
-
if (c3 == -1)
|
|
82314
|
-
break;
|
|
82315
|
-
o = ((c2 & 0x0f) << 4) >>> 0;
|
|
82316
|
-
o |= (c3 & 0x3c) >> 2;
|
|
82317
|
-
rs.push(stringFromCharCode(o));
|
|
82318
|
-
if (++olen >= len || off >= slen)
|
|
82319
|
-
break;
|
|
82320
|
-
code = s.charCodeAt(off++);
|
|
82321
|
-
c4 = code < BASE64_INDEX.length ? BASE64_INDEX[code] : -1;
|
|
82322
|
-
o = ((c3 & 0x03) << 6) >>> 0;
|
|
82323
|
-
o |= c4;
|
|
82324
|
-
rs.push(stringFromCharCode(o));
|
|
82325
|
-
++olen;
|
|
82326
|
-
}
|
|
82327
|
-
var res = [];
|
|
82328
|
-
for (off = 0; off<olen; off++)
|
|
82329
|
-
res.push(rs[off].charCodeAt(0));
|
|
82330
|
-
return res;
|
|
82331
|
-
}
|
|
82332
|
-
|
|
82333
|
-
/**
|
|
82334
|
-
* utfx-embeddable (c) 2014 Daniel Wirtz <dcode@dcode.io>
|
|
82335
|
-
* Released under the Apache License, Version 2.0
|
|
82336
|
-
* see: https://github.com/dcodeIO/utfx for details
|
|
82337
|
-
*/
|
|
82338
|
-
var utfx = function() {
|
|
82339
|
-
|
|
82340
|
-
/**
|
|
82341
|
-
* utfx namespace.
|
|
82342
|
-
* @inner
|
|
82343
|
-
* @type {!Object.<string,*>}
|
|
82344
|
-
*/
|
|
82345
|
-
var utfx = {};
|
|
82346
|
-
|
|
82347
|
-
/**
|
|
82348
|
-
* Maximum valid code point.
|
|
82349
|
-
* @type {number}
|
|
82350
|
-
* @const
|
|
82351
|
-
*/
|
|
82352
|
-
utfx.MAX_CODEPOINT = 0x10FFFF;
|
|
82353
|
-
|
|
82354
|
-
/**
|
|
82355
|
-
* Encodes UTF8 code points to UTF8 bytes.
|
|
82356
|
-
* @param {(!function():number|null) | number} src Code points source, either as a function returning the next code point
|
|
82357
|
-
* respectively `null` if there are no more code points left or a single numeric code point.
|
|
82358
|
-
* @param {!function(number)} dst Bytes destination as a function successively called with the next byte
|
|
82359
|
-
*/
|
|
82360
|
-
utfx.encodeUTF8 = function(src, dst) {
|
|
82361
|
-
var cp = null;
|
|
82362
|
-
if (typeof src === 'number')
|
|
82363
|
-
cp = src,
|
|
82364
|
-
src = function() { return null; };
|
|
82365
|
-
while (cp !== null || (cp = src()) !== null) {
|
|
82366
|
-
if (cp < 0x80)
|
|
82367
|
-
dst(cp&0x7F);
|
|
82368
|
-
else if (cp < 0x800)
|
|
82369
|
-
dst(((cp>>6)&0x1F)|0xC0),
|
|
82370
|
-
dst((cp&0x3F)|0x80);
|
|
82371
|
-
else if (cp < 0x10000)
|
|
82372
|
-
dst(((cp>>12)&0x0F)|0xE0),
|
|
82373
|
-
dst(((cp>>6)&0x3F)|0x80),
|
|
82374
|
-
dst((cp&0x3F)|0x80);
|
|
82375
|
-
else
|
|
82376
|
-
dst(((cp>>18)&0x07)|0xF0),
|
|
82377
|
-
dst(((cp>>12)&0x3F)|0x80),
|
|
82378
|
-
dst(((cp>>6)&0x3F)|0x80),
|
|
82379
|
-
dst((cp&0x3F)|0x80);
|
|
82380
|
-
cp = null;
|
|
82381
|
-
}
|
|
82382
|
-
};
|
|
82383
|
-
|
|
82384
|
-
/**
|
|
82385
|
-
* Decodes UTF8 bytes to UTF8 code points.
|
|
82386
|
-
* @param {!function():number|null} src Bytes source as a function returning the next byte respectively `null` if there
|
|
82387
|
-
* are no more bytes left.
|
|
82388
|
-
* @param {!function(number)} dst Code points destination as a function successively called with each decoded code point.
|
|
82389
|
-
* @throws {RangeError} If a starting byte is invalid in UTF8
|
|
82390
|
-
* @throws {Error} If the last sequence is truncated. Has an array property `bytes` holding the
|
|
82391
|
-
* remaining bytes.
|
|
82392
|
-
*/
|
|
82393
|
-
utfx.decodeUTF8 = function(src, dst) {
|
|
82394
|
-
var a, b, c, d, fail = function(b) {
|
|
82395
|
-
b = b.slice(0, b.indexOf(null));
|
|
82396
|
-
var err = Error(b.toString());
|
|
82397
|
-
err.name = "TruncatedError";
|
|
82398
|
-
err['bytes'] = b;
|
|
82399
|
-
throw err;
|
|
82400
|
-
};
|
|
82401
|
-
while ((a = src()) !== null) {
|
|
82402
|
-
if ((a&0x80) === 0)
|
|
82403
|
-
dst(a);
|
|
82404
|
-
else if ((a&0xE0) === 0xC0)
|
|
82405
|
-
((b = src()) === null) && fail([a, b]),
|
|
82406
|
-
dst(((a&0x1F)<<6) | (b&0x3F));
|
|
82407
|
-
else if ((a&0xF0) === 0xE0)
|
|
82408
|
-
((b=src()) === null || (c=src()) === null) && fail([a, b, c]),
|
|
82409
|
-
dst(((a&0x0F)<<12) | ((b&0x3F)<<6) | (c&0x3F));
|
|
82410
|
-
else if ((a&0xF8) === 0xF0)
|
|
82411
|
-
((b=src()) === null || (c=src()) === null || (d=src()) === null) && fail([a, b, c ,d]),
|
|
82412
|
-
dst(((a&0x07)<<18) | ((b&0x3F)<<12) | ((c&0x3F)<<6) | (d&0x3F));
|
|
82413
|
-
else throw RangeError("Illegal starting byte: "+a);
|
|
82414
|
-
}
|
|
82415
|
-
};
|
|
82416
|
-
|
|
82417
|
-
/**
|
|
82418
|
-
* Converts UTF16 characters to UTF8 code points.
|
|
82419
|
-
* @param {!function():number|null} src Characters source as a function returning the next char code respectively
|
|
82420
|
-
* `null` if there are no more characters left.
|
|
82421
|
-
* @param {!function(number)} dst Code points destination as a function successively called with each converted code
|
|
82422
|
-
* point.
|
|
82423
|
-
*/
|
|
82424
|
-
utfx.UTF16toUTF8 = function(src, dst) {
|
|
82425
|
-
var c1, c2 = null;
|
|
82426
|
-
while (true) {
|
|
82427
|
-
if ((c1 = c2 !== null ? c2 : src()) === null)
|
|
82428
|
-
break;
|
|
82429
|
-
if (c1 >= 0xD800 && c1 <= 0xDFFF) {
|
|
82430
|
-
if ((c2 = src()) !== null) {
|
|
82431
|
-
if (c2 >= 0xDC00 && c2 <= 0xDFFF) {
|
|
82432
|
-
dst((c1-0xD800)*0x400+c2-0xDC00+0x10000);
|
|
82433
|
-
c2 = null; continue;
|
|
82434
|
-
}
|
|
82435
|
-
}
|
|
82436
|
-
}
|
|
82437
|
-
dst(c1);
|
|
82438
|
-
}
|
|
82439
|
-
if (c2 !== null) dst(c2);
|
|
82440
|
-
};
|
|
82441
|
-
|
|
82442
|
-
/**
|
|
82443
|
-
* Converts UTF8 code points to UTF16 characters.
|
|
82444
|
-
* @param {(!function():number|null) | number} src Code points source, either as a function returning the next code point
|
|
82445
|
-
* respectively `null` if there are no more code points left or a single numeric code point.
|
|
82446
|
-
* @param {!function(number)} dst Characters destination as a function successively called with each converted char code.
|
|
82447
|
-
* @throws {RangeError} If a code point is out of range
|
|
82448
|
-
*/
|
|
82449
|
-
utfx.UTF8toUTF16 = function(src, dst) {
|
|
82450
|
-
var cp = null;
|
|
82451
|
-
if (typeof src === 'number')
|
|
82452
|
-
cp = src, src = function() { return null; };
|
|
82453
|
-
while (cp !== null || (cp = src()) !== null) {
|
|
82454
|
-
if (cp <= 0xFFFF)
|
|
82455
|
-
dst(cp);
|
|
82456
|
-
else
|
|
82457
|
-
cp -= 0x10000,
|
|
82458
|
-
dst((cp>>10)+0xD800),
|
|
82459
|
-
dst((cp%0x400)+0xDC00);
|
|
82460
|
-
cp = null;
|
|
82461
|
-
}
|
|
82462
|
-
};
|
|
82463
|
-
|
|
82464
|
-
/**
|
|
82465
|
-
* Converts and encodes UTF16 characters to UTF8 bytes.
|
|
82466
|
-
* @param {!function():number|null} src Characters source as a function returning the next char code respectively `null`
|
|
82467
|
-
* if there are no more characters left.
|
|
82468
|
-
* @param {!function(number)} dst Bytes destination as a function successively called with the next byte.
|
|
82469
|
-
*/
|
|
82470
|
-
utfx.encodeUTF16toUTF8 = function(src, dst) {
|
|
82471
|
-
utfx.UTF16toUTF8(src, function(cp) {
|
|
82472
|
-
utfx.encodeUTF8(cp, dst);
|
|
82473
|
-
});
|
|
82474
|
-
};
|
|
82475
|
-
|
|
82476
|
-
/**
|
|
82477
|
-
* Decodes and converts UTF8 bytes to UTF16 characters.
|
|
82478
|
-
* @param {!function():number|null} src Bytes source as a function returning the next byte respectively `null` if there
|
|
82479
|
-
* are no more bytes left.
|
|
82480
|
-
* @param {!function(number)} dst Characters destination as a function successively called with each converted char code.
|
|
82481
|
-
* @throws {RangeError} If a starting byte is invalid in UTF8
|
|
82482
|
-
* @throws {Error} If the last sequence is truncated. Has an array property `bytes` holding the remaining bytes.
|
|
82483
|
-
*/
|
|
82484
|
-
utfx.decodeUTF8toUTF16 = function(src, dst) {
|
|
82485
|
-
utfx.decodeUTF8(src, function(cp) {
|
|
82486
|
-
utfx.UTF8toUTF16(cp, dst);
|
|
82487
|
-
});
|
|
82488
|
-
};
|
|
82489
|
-
|
|
82490
|
-
/**
|
|
82491
|
-
* Calculates the byte length of an UTF8 code point.
|
|
82492
|
-
* @param {number} cp UTF8 code point
|
|
82493
|
-
* @returns {number} Byte length
|
|
82494
|
-
*/
|
|
82495
|
-
utfx.calculateCodePoint = function(cp) {
|
|
82496
|
-
return (cp < 0x80) ? 1 : (cp < 0x800) ? 2 : (cp < 0x10000) ? 3 : 4;
|
|
82497
|
-
};
|
|
82498
|
-
|
|
82499
|
-
/**
|
|
82500
|
-
* Calculates the number of UTF8 bytes required to store UTF8 code points.
|
|
82501
|
-
* @param {(!function():number|null)} src Code points source as a function returning the next code point respectively
|
|
82502
|
-
* `null` if there are no more code points left.
|
|
82503
|
-
* @returns {number} The number of UTF8 bytes required
|
|
82504
|
-
*/
|
|
82505
|
-
utfx.calculateUTF8 = function(src) {
|
|
82506
|
-
var cp, l=0;
|
|
82507
|
-
while ((cp = src()) !== null)
|
|
82508
|
-
l += utfx.calculateCodePoint(cp);
|
|
82509
|
-
return l;
|
|
82510
|
-
};
|
|
82511
|
-
|
|
82512
|
-
/**
|
|
82513
|
-
* Calculates the number of UTF8 code points respectively UTF8 bytes required to store UTF16 char codes.
|
|
82514
|
-
* @param {(!function():number|null)} src Characters source as a function returning the next char code respectively
|
|
82515
|
-
* `null` if there are no more characters left.
|
|
82516
|
-
* @returns {!Array.<number>} The number of UTF8 code points at index 0 and the number of UTF8 bytes required at index 1.
|
|
82517
|
-
*/
|
|
82518
|
-
utfx.calculateUTF16asUTF8 = function(src) {
|
|
82519
|
-
var n=0, l=0;
|
|
82520
|
-
utfx.UTF16toUTF8(src, function(cp) {
|
|
82521
|
-
++n; l += utfx.calculateCodePoint(cp);
|
|
82522
|
-
});
|
|
82523
|
-
return [n,l];
|
|
82524
|
-
};
|
|
82525
|
-
|
|
82526
|
-
return utfx;
|
|
82527
|
-
}();
|
|
82528
|
-
|
|
82529
|
-
Date.now = Date.now || function() { return +new Date; };
|
|
82530
|
-
|
|
82531
|
-
/**
|
|
82532
|
-
* @type {number}
|
|
82533
|
-
* @const
|
|
82534
|
-
* @inner
|
|
82535
|
-
*/
|
|
82536
|
-
var BCRYPT_SALT_LEN = 16;
|
|
82537
|
-
|
|
82538
|
-
/**
|
|
82539
|
-
* @type {number}
|
|
82540
|
-
* @const
|
|
82541
|
-
* @inner
|
|
82542
|
-
*/
|
|
82543
|
-
var GENSALT_DEFAULT_LOG2_ROUNDS = 10;
|
|
82544
|
-
|
|
82545
|
-
/**
|
|
82546
|
-
* @type {number}
|
|
82547
|
-
* @const
|
|
82548
|
-
* @inner
|
|
82549
|
-
*/
|
|
82550
|
-
var BLOWFISH_NUM_ROUNDS = 16;
|
|
82551
|
-
|
|
82552
|
-
/**
|
|
82553
|
-
* @type {number}
|
|
82554
|
-
* @const
|
|
82555
|
-
* @inner
|
|
82556
|
-
*/
|
|
82557
|
-
var MAX_EXECUTION_TIME = 100;
|
|
82558
|
-
|
|
82559
|
-
/**
|
|
82560
|
-
* @type {Array.<number>}
|
|
82561
|
-
* @const
|
|
82562
|
-
* @inner
|
|
82563
|
-
*/
|
|
82564
|
-
var P_ORIG = [
|
|
82565
|
-
0x243f6a88, 0x85a308d3, 0x13198a2e, 0x03707344, 0xa4093822,
|
|
82566
|
-
0x299f31d0, 0x082efa98, 0xec4e6c89, 0x452821e6, 0x38d01377,
|
|
82567
|
-
0xbe5466cf, 0x34e90c6c, 0xc0ac29b7, 0xc97c50dd, 0x3f84d5b5,
|
|
82568
|
-
0xb5470917, 0x9216d5d9, 0x8979fb1b
|
|
82569
|
-
];
|
|
82570
|
-
|
|
82571
|
-
/**
|
|
82572
|
-
* @type {Array.<number>}
|
|
82573
|
-
* @const
|
|
82574
|
-
* @inner
|
|
82575
|
-
*/
|
|
82576
|
-
var S_ORIG = [
|
|
82577
|
-
0xd1310ba6, 0x98dfb5ac, 0x2ffd72db, 0xd01adfb7, 0xb8e1afed,
|
|
82578
|
-
0x6a267e96, 0xba7c9045, 0xf12c7f99, 0x24a19947, 0xb3916cf7,
|
|
82579
|
-
0x0801f2e2, 0x858efc16, 0x636920d8, 0x71574e69, 0xa458fea3,
|
|
82580
|
-
0xf4933d7e, 0x0d95748f, 0x728eb658, 0x718bcd58, 0x82154aee,
|
|
82581
|
-
0x7b54a41d, 0xc25a59b5, 0x9c30d539, 0x2af26013, 0xc5d1b023,
|
|
82582
|
-
0x286085f0, 0xca417918, 0xb8db38ef, 0x8e79dcb0, 0x603a180e,
|
|
82583
|
-
0x6c9e0e8b, 0xb01e8a3e, 0xd71577c1, 0xbd314b27, 0x78af2fda,
|
|
82584
|
-
0x55605c60, 0xe65525f3, 0xaa55ab94, 0x57489862, 0x63e81440,
|
|
82585
|
-
0x55ca396a, 0x2aab10b6, 0xb4cc5c34, 0x1141e8ce, 0xa15486af,
|
|
82586
|
-
0x7c72e993, 0xb3ee1411, 0x636fbc2a, 0x2ba9c55d, 0x741831f6,
|
|
82587
|
-
0xce5c3e16, 0x9b87931e, 0xafd6ba33, 0x6c24cf5c, 0x7a325381,
|
|
82588
|
-
0x28958677, 0x3b8f4898, 0x6b4bb9af, 0xc4bfe81b, 0x66282193,
|
|
82589
|
-
0x61d809cc, 0xfb21a991, 0x487cac60, 0x5dec8032, 0xef845d5d,
|
|
82590
|
-
0xe98575b1, 0xdc262302, 0xeb651b88, 0x23893e81, 0xd396acc5,
|
|
82591
|
-
0x0f6d6ff3, 0x83f44239, 0x2e0b4482, 0xa4842004, 0x69c8f04a,
|
|
82592
|
-
0x9e1f9b5e, 0x21c66842, 0xf6e96c9a, 0x670c9c61, 0xabd388f0,
|
|
82593
|
-
0x6a51a0d2, 0xd8542f68, 0x960fa728, 0xab5133a3, 0x6eef0b6c,
|
|
82594
|
-
0x137a3be4, 0xba3bf050, 0x7efb2a98, 0xa1f1651d, 0x39af0176,
|
|
82595
|
-
0x66ca593e, 0x82430e88, 0x8cee8619, 0x456f9fb4, 0x7d84a5c3,
|
|
82596
|
-
0x3b8b5ebe, 0xe06f75d8, 0x85c12073, 0x401a449f, 0x56c16aa6,
|
|
82597
|
-
0x4ed3aa62, 0x363f7706, 0x1bfedf72, 0x429b023d, 0x37d0d724,
|
|
82598
|
-
0xd00a1248, 0xdb0fead3, 0x49f1c09b, 0x075372c9, 0x80991b7b,
|
|
82599
|
-
0x25d479d8, 0xf6e8def7, 0xe3fe501a, 0xb6794c3b, 0x976ce0bd,
|
|
82600
|
-
0x04c006ba, 0xc1a94fb6, 0x409f60c4, 0x5e5c9ec2, 0x196a2463,
|
|
82601
|
-
0x68fb6faf, 0x3e6c53b5, 0x1339b2eb, 0x3b52ec6f, 0x6dfc511f,
|
|
82602
|
-
0x9b30952c, 0xcc814544, 0xaf5ebd09, 0xbee3d004, 0xde334afd,
|
|
82603
|
-
0x660f2807, 0x192e4bb3, 0xc0cba857, 0x45c8740f, 0xd20b5f39,
|
|
82604
|
-
0xb9d3fbdb, 0x5579c0bd, 0x1a60320a, 0xd6a100c6, 0x402c7279,
|
|
82605
|
-
0x679f25fe, 0xfb1fa3cc, 0x8ea5e9f8, 0xdb3222f8, 0x3c7516df,
|
|
82606
|
-
0xfd616b15, 0x2f501ec8, 0xad0552ab, 0x323db5fa, 0xfd238760,
|
|
82607
|
-
0x53317b48, 0x3e00df82, 0x9e5c57bb, 0xca6f8ca0, 0x1a87562e,
|
|
82608
|
-
0xdf1769db, 0xd542a8f6, 0x287effc3, 0xac6732c6, 0x8c4f5573,
|
|
82609
|
-
0x695b27b0, 0xbbca58c8, 0xe1ffa35d, 0xb8f011a0, 0x10fa3d98,
|
|
82610
|
-
0xfd2183b8, 0x4afcb56c, 0x2dd1d35b, 0x9a53e479, 0xb6f84565,
|
|
82611
|
-
0xd28e49bc, 0x4bfb9790, 0xe1ddf2da, 0xa4cb7e33, 0x62fb1341,
|
|
82612
|
-
0xcee4c6e8, 0xef20cada, 0x36774c01, 0xd07e9efe, 0x2bf11fb4,
|
|
82613
|
-
0x95dbda4d, 0xae909198, 0xeaad8e71, 0x6b93d5a0, 0xd08ed1d0,
|
|
82614
|
-
0xafc725e0, 0x8e3c5b2f, 0x8e7594b7, 0x8ff6e2fb, 0xf2122b64,
|
|
82615
|
-
0x8888b812, 0x900df01c, 0x4fad5ea0, 0x688fc31c, 0xd1cff191,
|
|
82616
|
-
0xb3a8c1ad, 0x2f2f2218, 0xbe0e1777, 0xea752dfe, 0x8b021fa1,
|
|
82617
|
-
0xe5a0cc0f, 0xb56f74e8, 0x18acf3d6, 0xce89e299, 0xb4a84fe0,
|
|
82618
|
-
0xfd13e0b7, 0x7cc43b81, 0xd2ada8d9, 0x165fa266, 0x80957705,
|
|
82619
|
-
0x93cc7314, 0x211a1477, 0xe6ad2065, 0x77b5fa86, 0xc75442f5,
|
|
82620
|
-
0xfb9d35cf, 0xebcdaf0c, 0x7b3e89a0, 0xd6411bd3, 0xae1e7e49,
|
|
82621
|
-
0x00250e2d, 0x2071b35e, 0x226800bb, 0x57b8e0af, 0x2464369b,
|
|
82622
|
-
0xf009b91e, 0x5563911d, 0x59dfa6aa, 0x78c14389, 0xd95a537f,
|
|
82623
|
-
0x207d5ba2, 0x02e5b9c5, 0x83260376, 0x6295cfa9, 0x11c81968,
|
|
82624
|
-
0x4e734a41, 0xb3472dca, 0x7b14a94a, 0x1b510052, 0x9a532915,
|
|
82625
|
-
0xd60f573f, 0xbc9bc6e4, 0x2b60a476, 0x81e67400, 0x08ba6fb5,
|
|
82626
|
-
0x571be91f, 0xf296ec6b, 0x2a0dd915, 0xb6636521, 0xe7b9f9b6,
|
|
82627
|
-
0xff34052e, 0xc5855664, 0x53b02d5d, 0xa99f8fa1, 0x08ba4799,
|
|
82628
|
-
0x6e85076a, 0x4b7a70e9, 0xb5b32944, 0xdb75092e, 0xc4192623,
|
|
82629
|
-
0xad6ea6b0, 0x49a7df7d, 0x9cee60b8, 0x8fedb266, 0xecaa8c71,
|
|
82630
|
-
0x699a17ff, 0x5664526c, 0xc2b19ee1, 0x193602a5, 0x75094c29,
|
|
82631
|
-
0xa0591340, 0xe4183a3e, 0x3f54989a, 0x5b429d65, 0x6b8fe4d6,
|
|
82632
|
-
0x99f73fd6, 0xa1d29c07, 0xefe830f5, 0x4d2d38e6, 0xf0255dc1,
|
|
82633
|
-
0x4cdd2086, 0x8470eb26, 0x6382e9c6, 0x021ecc5e, 0x09686b3f,
|
|
82634
|
-
0x3ebaefc9, 0x3c971814, 0x6b6a70a1, 0x687f3584, 0x52a0e286,
|
|
82635
|
-
0xb79c5305, 0xaa500737, 0x3e07841c, 0x7fdeae5c, 0x8e7d44ec,
|
|
82636
|
-
0x5716f2b8, 0xb03ada37, 0xf0500c0d, 0xf01c1f04, 0x0200b3ff,
|
|
82637
|
-
0xae0cf51a, 0x3cb574b2, 0x25837a58, 0xdc0921bd, 0xd19113f9,
|
|
82638
|
-
0x7ca92ff6, 0x94324773, 0x22f54701, 0x3ae5e581, 0x37c2dadc,
|
|
82639
|
-
0xc8b57634, 0x9af3dda7, 0xa9446146, 0x0fd0030e, 0xecc8c73e,
|
|
82640
|
-
0xa4751e41, 0xe238cd99, 0x3bea0e2f, 0x3280bba1, 0x183eb331,
|
|
82641
|
-
0x4e548b38, 0x4f6db908, 0x6f420d03, 0xf60a04bf, 0x2cb81290,
|
|
82642
|
-
0x24977c79, 0x5679b072, 0xbcaf89af, 0xde9a771f, 0xd9930810,
|
|
82643
|
-
0xb38bae12, 0xdccf3f2e, 0x5512721f, 0x2e6b7124, 0x501adde6,
|
|
82644
|
-
0x9f84cd87, 0x7a584718, 0x7408da17, 0xbc9f9abc, 0xe94b7d8c,
|
|
82645
|
-
0xec7aec3a, 0xdb851dfa, 0x63094366, 0xc464c3d2, 0xef1c1847,
|
|
82646
|
-
0x3215d908, 0xdd433b37, 0x24c2ba16, 0x12a14d43, 0x2a65c451,
|
|
82647
|
-
0x50940002, 0x133ae4dd, 0x71dff89e, 0x10314e55, 0x81ac77d6,
|
|
82648
|
-
0x5f11199b, 0x043556f1, 0xd7a3c76b, 0x3c11183b, 0x5924a509,
|
|
82649
|
-
0xf28fe6ed, 0x97f1fbfa, 0x9ebabf2c, 0x1e153c6e, 0x86e34570,
|
|
82650
|
-
0xeae96fb1, 0x860e5e0a, 0x5a3e2ab3, 0x771fe71c, 0x4e3d06fa,
|
|
82651
|
-
0x2965dcb9, 0x99e71d0f, 0x803e89d6, 0x5266c825, 0x2e4cc978,
|
|
82652
|
-
0x9c10b36a, 0xc6150eba, 0x94e2ea78, 0xa5fc3c53, 0x1e0a2df4,
|
|
82653
|
-
0xf2f74ea7, 0x361d2b3d, 0x1939260f, 0x19c27960, 0x5223a708,
|
|
82654
|
-
0xf71312b6, 0xebadfe6e, 0xeac31f66, 0xe3bc4595, 0xa67bc883,
|
|
82655
|
-
0xb17f37d1, 0x018cff28, 0xc332ddef, 0xbe6c5aa5, 0x65582185,
|
|
82656
|
-
0x68ab9802, 0xeecea50f, 0xdb2f953b, 0x2aef7dad, 0x5b6e2f84,
|
|
82657
|
-
0x1521b628, 0x29076170, 0xecdd4775, 0x619f1510, 0x13cca830,
|
|
82658
|
-
0xeb61bd96, 0x0334fe1e, 0xaa0363cf, 0xb5735c90, 0x4c70a239,
|
|
82659
|
-
0xd59e9e0b, 0xcbaade14, 0xeecc86bc, 0x60622ca7, 0x9cab5cab,
|
|
82660
|
-
0xb2f3846e, 0x648b1eaf, 0x19bdf0ca, 0xa02369b9, 0x655abb50,
|
|
82661
|
-
0x40685a32, 0x3c2ab4b3, 0x319ee9d5, 0xc021b8f7, 0x9b540b19,
|
|
82662
|
-
0x875fa099, 0x95f7997e, 0x623d7da8, 0xf837889a, 0x97e32d77,
|
|
82663
|
-
0x11ed935f, 0x16681281, 0x0e358829, 0xc7e61fd6, 0x96dedfa1,
|
|
82664
|
-
0x7858ba99, 0x57f584a5, 0x1b227263, 0x9b83c3ff, 0x1ac24696,
|
|
82665
|
-
0xcdb30aeb, 0x532e3054, 0x8fd948e4, 0x6dbc3128, 0x58ebf2ef,
|
|
82666
|
-
0x34c6ffea, 0xfe28ed61, 0xee7c3c73, 0x5d4a14d9, 0xe864b7e3,
|
|
82667
|
-
0x42105d14, 0x203e13e0, 0x45eee2b6, 0xa3aaabea, 0xdb6c4f15,
|
|
82668
|
-
0xfacb4fd0, 0xc742f442, 0xef6abbb5, 0x654f3b1d, 0x41cd2105,
|
|
82669
|
-
0xd81e799e, 0x86854dc7, 0xe44b476a, 0x3d816250, 0xcf62a1f2,
|
|
82670
|
-
0x5b8d2646, 0xfc8883a0, 0xc1c7b6a3, 0x7f1524c3, 0x69cb7492,
|
|
82671
|
-
0x47848a0b, 0x5692b285, 0x095bbf00, 0xad19489d, 0x1462b174,
|
|
82672
|
-
0x23820e00, 0x58428d2a, 0x0c55f5ea, 0x1dadf43e, 0x233f7061,
|
|
82673
|
-
0x3372f092, 0x8d937e41, 0xd65fecf1, 0x6c223bdb, 0x7cde3759,
|
|
82674
|
-
0xcbee7460, 0x4085f2a7, 0xce77326e, 0xa6078084, 0x19f8509e,
|
|
82675
|
-
0xe8efd855, 0x61d99735, 0xa969a7aa, 0xc50c06c2, 0x5a04abfc,
|
|
82676
|
-
0x800bcadc, 0x9e447a2e, 0xc3453484, 0xfdd56705, 0x0e1e9ec9,
|
|
82677
|
-
0xdb73dbd3, 0x105588cd, 0x675fda79, 0xe3674340, 0xc5c43465,
|
|
82678
|
-
0x713e38d8, 0x3d28f89e, 0xf16dff20, 0x153e21e7, 0x8fb03d4a,
|
|
82679
|
-
0xe6e39f2b, 0xdb83adf7, 0xe93d5a68, 0x948140f7, 0xf64c261c,
|
|
82680
|
-
0x94692934, 0x411520f7, 0x7602d4f7, 0xbcf46b2e, 0xd4a20068,
|
|
82681
|
-
0xd4082471, 0x3320f46a, 0x43b7d4b7, 0x500061af, 0x1e39f62e,
|
|
82682
|
-
0x97244546, 0x14214f74, 0xbf8b8840, 0x4d95fc1d, 0x96b591af,
|
|
82683
|
-
0x70f4ddd3, 0x66a02f45, 0xbfbc09ec, 0x03bd9785, 0x7fac6dd0,
|
|
82684
|
-
0x31cb8504, 0x96eb27b3, 0x55fd3941, 0xda2547e6, 0xabca0a9a,
|
|
82685
|
-
0x28507825, 0x530429f4, 0x0a2c86da, 0xe9b66dfb, 0x68dc1462,
|
|
82686
|
-
0xd7486900, 0x680ec0a4, 0x27a18dee, 0x4f3ffea2, 0xe887ad8c,
|
|
82687
|
-
0xb58ce006, 0x7af4d6b6, 0xaace1e7c, 0xd3375fec, 0xce78a399,
|
|
82688
|
-
0x406b2a42, 0x20fe9e35, 0xd9f385b9, 0xee39d7ab, 0x3b124e8b,
|
|
82689
|
-
0x1dc9faf7, 0x4b6d1856, 0x26a36631, 0xeae397b2, 0x3a6efa74,
|
|
82690
|
-
0xdd5b4332, 0x6841e7f7, 0xca7820fb, 0xfb0af54e, 0xd8feb397,
|
|
82691
|
-
0x454056ac, 0xba489527, 0x55533a3a, 0x20838d87, 0xfe6ba9b7,
|
|
82692
|
-
0xd096954b, 0x55a867bc, 0xa1159a58, 0xcca92963, 0x99e1db33,
|
|
82693
|
-
0xa62a4a56, 0x3f3125f9, 0x5ef47e1c, 0x9029317c, 0xfdf8e802,
|
|
82694
|
-
0x04272f70, 0x80bb155c, 0x05282ce3, 0x95c11548, 0xe4c66d22,
|
|
82695
|
-
0x48c1133f, 0xc70f86dc, 0x07f9c9ee, 0x41041f0f, 0x404779a4,
|
|
82696
|
-
0x5d886e17, 0x325f51eb, 0xd59bc0d1, 0xf2bcc18f, 0x41113564,
|
|
82697
|
-
0x257b7834, 0x602a9c60, 0xdff8e8a3, 0x1f636c1b, 0x0e12b4c2,
|
|
82698
|
-
0x02e1329e, 0xaf664fd1, 0xcad18115, 0x6b2395e0, 0x333e92e1,
|
|
82699
|
-
0x3b240b62, 0xeebeb922, 0x85b2a20e, 0xe6ba0d99, 0xde720c8c,
|
|
82700
|
-
0x2da2f728, 0xd0127845, 0x95b794fd, 0x647d0862, 0xe7ccf5f0,
|
|
82701
|
-
0x5449a36f, 0x877d48fa, 0xc39dfd27, 0xf33e8d1e, 0x0a476341,
|
|
82702
|
-
0x992eff74, 0x3a6f6eab, 0xf4f8fd37, 0xa812dc60, 0xa1ebddf8,
|
|
82703
|
-
0x991be14c, 0xdb6e6b0d, 0xc67b5510, 0x6d672c37, 0x2765d43b,
|
|
82704
|
-
0xdcd0e804, 0xf1290dc7, 0xcc00ffa3, 0xb5390f92, 0x690fed0b,
|
|
82705
|
-
0x667b9ffb, 0xcedb7d9c, 0xa091cf0b, 0xd9155ea3, 0xbb132f88,
|
|
82706
|
-
0x515bad24, 0x7b9479bf, 0x763bd6eb, 0x37392eb3, 0xcc115979,
|
|
82707
|
-
0x8026e297, 0xf42e312d, 0x6842ada7, 0xc66a2b3b, 0x12754ccc,
|
|
82708
|
-
0x782ef11c, 0x6a124237, 0xb79251e7, 0x06a1bbe6, 0x4bfb6350,
|
|
82709
|
-
0x1a6b1018, 0x11caedfa, 0x3d25bdd8, 0xe2e1c3c9, 0x44421659,
|
|
82710
|
-
0x0a121386, 0xd90cec6e, 0xd5abea2a, 0x64af674e, 0xda86a85f,
|
|
82711
|
-
0xbebfe988, 0x64e4c3fe, 0x9dbc8057, 0xf0f7c086, 0x60787bf8,
|
|
82712
|
-
0x6003604d, 0xd1fd8346, 0xf6381fb0, 0x7745ae04, 0xd736fccc,
|
|
82713
|
-
0x83426b33, 0xf01eab71, 0xb0804187, 0x3c005e5f, 0x77a057be,
|
|
82714
|
-
0xbde8ae24, 0x55464299, 0xbf582e61, 0x4e58f48f, 0xf2ddfda2,
|
|
82715
|
-
0xf474ef38, 0x8789bdc2, 0x5366f9c3, 0xc8b38e74, 0xb475f255,
|
|
82716
|
-
0x46fcd9b9, 0x7aeb2661, 0x8b1ddf84, 0x846a0e79, 0x915f95e2,
|
|
82717
|
-
0x466e598e, 0x20b45770, 0x8cd55591, 0xc902de4c, 0xb90bace1,
|
|
82718
|
-
0xbb8205d0, 0x11a86248, 0x7574a99e, 0xb77f19b6, 0xe0a9dc09,
|
|
82719
|
-
0x662d09a1, 0xc4324633, 0xe85a1f02, 0x09f0be8c, 0x4a99a025,
|
|
82720
|
-
0x1d6efe10, 0x1ab93d1d, 0x0ba5a4df, 0xa186f20f, 0x2868f169,
|
|
82721
|
-
0xdcb7da83, 0x573906fe, 0xa1e2ce9b, 0x4fcd7f52, 0x50115e01,
|
|
82722
|
-
0xa70683fa, 0xa002b5c4, 0x0de6d027, 0x9af88c27, 0x773f8641,
|
|
82723
|
-
0xc3604c06, 0x61a806b5, 0xf0177a28, 0xc0f586e0, 0x006058aa,
|
|
82724
|
-
0x30dc7d62, 0x11e69ed7, 0x2338ea63, 0x53c2dd94, 0xc2c21634,
|
|
82725
|
-
0xbbcbee56, 0x90bcb6de, 0xebfc7da1, 0xce591d76, 0x6f05e409,
|
|
82726
|
-
0x4b7c0188, 0x39720a3d, 0x7c927c24, 0x86e3725f, 0x724d9db9,
|
|
82727
|
-
0x1ac15bb4, 0xd39eb8fc, 0xed545578, 0x08fca5b5, 0xd83d7cd3,
|
|
82728
|
-
0x4dad0fc4, 0x1e50ef5e, 0xb161e6f8, 0xa28514d9, 0x6c51133c,
|
|
82729
|
-
0x6fd5c7e7, 0x56e14ec4, 0x362abfce, 0xddc6c837, 0xd79a3234,
|
|
82730
|
-
0x92638212, 0x670efa8e, 0x406000e0, 0x3a39ce37, 0xd3faf5cf,
|
|
82731
|
-
0xabc27737, 0x5ac52d1b, 0x5cb0679e, 0x4fa33742, 0xd3822740,
|
|
82732
|
-
0x99bc9bbe, 0xd5118e9d, 0xbf0f7315, 0xd62d1c7e, 0xc700c47b,
|
|
82733
|
-
0xb78c1b6b, 0x21a19045, 0xb26eb1be, 0x6a366eb4, 0x5748ab2f,
|
|
82734
|
-
0xbc946e79, 0xc6a376d2, 0x6549c2c8, 0x530ff8ee, 0x468dde7d,
|
|
82735
|
-
0xd5730a1d, 0x4cd04dc6, 0x2939bbdb, 0xa9ba4650, 0xac9526e8,
|
|
82736
|
-
0xbe5ee304, 0xa1fad5f0, 0x6a2d519a, 0x63ef8ce2, 0x9a86ee22,
|
|
82737
|
-
0xc089c2b8, 0x43242ef6, 0xa51e03aa, 0x9cf2d0a4, 0x83c061ba,
|
|
82738
|
-
0x9be96a4d, 0x8fe51550, 0xba645bd6, 0x2826a2f9, 0xa73a3ae1,
|
|
82739
|
-
0x4ba99586, 0xef5562e9, 0xc72fefd3, 0xf752f7da, 0x3f046f69,
|
|
82740
|
-
0x77fa0a59, 0x80e4a915, 0x87b08601, 0x9b09e6ad, 0x3b3ee593,
|
|
82741
|
-
0xe990fd5a, 0x9e34d797, 0x2cf0b7d9, 0x022b8b51, 0x96d5ac3a,
|
|
82742
|
-
0x017da67d, 0xd1cf3ed6, 0x7c7d2d28, 0x1f9f25cf, 0xadf2b89b,
|
|
82743
|
-
0x5ad6b472, 0x5a88f54c, 0xe029ac71, 0xe019a5e6, 0x47b0acfd,
|
|
82744
|
-
0xed93fa9b, 0xe8d3c48d, 0x283b57cc, 0xf8d56629, 0x79132e28,
|
|
82745
|
-
0x785f0191, 0xed756055, 0xf7960e44, 0xe3d35e8c, 0x15056dd4,
|
|
82746
|
-
0x88f46dba, 0x03a16125, 0x0564f0bd, 0xc3eb9e15, 0x3c9057a2,
|
|
82747
|
-
0x97271aec, 0xa93a072a, 0x1b3f6d9b, 0x1e6321f5, 0xf59c66fb,
|
|
82748
|
-
0x26dcf319, 0x7533d928, 0xb155fdf5, 0x03563482, 0x8aba3cbb,
|
|
82749
|
-
0x28517711, 0xc20ad9f8, 0xabcc5167, 0xccad925f, 0x4de81751,
|
|
82750
|
-
0x3830dc8e, 0x379d5862, 0x9320f991, 0xea7a90c2, 0xfb3e7bce,
|
|
82751
|
-
0x5121ce64, 0x774fbe32, 0xa8b6e37e, 0xc3293d46, 0x48de5369,
|
|
82752
|
-
0x6413e680, 0xa2ae0810, 0xdd6db224, 0x69852dfd, 0x09072166,
|
|
82753
|
-
0xb39a460a, 0x6445c0dd, 0x586cdecf, 0x1c20c8ae, 0x5bbef7dd,
|
|
82754
|
-
0x1b588d40, 0xccd2017f, 0x6bb4e3bb, 0xdda26a7e, 0x3a59ff45,
|
|
82755
|
-
0x3e350a44, 0xbcb4cdd5, 0x72eacea8, 0xfa6484bb, 0x8d6612ae,
|
|
82756
|
-
0xbf3c6f47, 0xd29be463, 0x542f5d9e, 0xaec2771b, 0xf64e6370,
|
|
82757
|
-
0x740e0d8d, 0xe75b1357, 0xf8721671, 0xaf537d5d, 0x4040cb08,
|
|
82758
|
-
0x4eb4e2cc, 0x34d2466a, 0x0115af84, 0xe1b00428, 0x95983a1d,
|
|
82759
|
-
0x06b89fb4, 0xce6ea048, 0x6f3f3b82, 0x3520ab82, 0x011a1d4b,
|
|
82760
|
-
0x277227f8, 0x611560b1, 0xe7933fdc, 0xbb3a792b, 0x344525bd,
|
|
82761
|
-
0xa08839e1, 0x51ce794b, 0x2f32c9b7, 0xa01fbac9, 0xe01cc87e,
|
|
82762
|
-
0xbcc7d1f6, 0xcf0111c3, 0xa1e8aac7, 0x1a908749, 0xd44fbd9a,
|
|
82763
|
-
0xd0dadecb, 0xd50ada38, 0x0339c32a, 0xc6913667, 0x8df9317c,
|
|
82764
|
-
0xe0b12b4f, 0xf79e59b7, 0x43f5bb3a, 0xf2d519ff, 0x27d9459c,
|
|
82765
|
-
0xbf97222c, 0x15e6fc2a, 0x0f91fc71, 0x9b941525, 0xfae59361,
|
|
82766
|
-
0xceb69ceb, 0xc2a86459, 0x12baa8d1, 0xb6c1075e, 0xe3056a0c,
|
|
82767
|
-
0x10d25065, 0xcb03a442, 0xe0ec6e0e, 0x1698db3b, 0x4c98a0be,
|
|
82768
|
-
0x3278e964, 0x9f1f9532, 0xe0d392df, 0xd3a0342b, 0x8971f21e,
|
|
82769
|
-
0x1b0a7441, 0x4ba3348c, 0xc5be7120, 0xc37632d8, 0xdf359f8d,
|
|
82770
|
-
0x9b992f2e, 0xe60b6f47, 0x0fe3f11d, 0xe54cda54, 0x1edad891,
|
|
82771
|
-
0xce6279cf, 0xcd3e7e6f, 0x1618b166, 0xfd2c1d05, 0x848fd2c5,
|
|
82772
|
-
0xf6fb2299, 0xf523f357, 0xa6327623, 0x93a83531, 0x56cccd02,
|
|
82773
|
-
0xacf08162, 0x5a75ebb5, 0x6e163697, 0x88d273cc, 0xde966292,
|
|
82774
|
-
0x81b949d0, 0x4c50901b, 0x71c65614, 0xe6c6c7bd, 0x327a140a,
|
|
82775
|
-
0x45e1d006, 0xc3f27b9a, 0xc9aa53fd, 0x62a80f00, 0xbb25bfe2,
|
|
82776
|
-
0x35bdd2f6, 0x71126905, 0xb2040222, 0xb6cbcf7c, 0xcd769c2b,
|
|
82777
|
-
0x53113ec0, 0x1640e3d3, 0x38abbd60, 0x2547adf0, 0xba38209c,
|
|
82778
|
-
0xf746ce76, 0x77afa1c5, 0x20756060, 0x85cbfe4e, 0x8ae88dd8,
|
|
82779
|
-
0x7aaaf9b0, 0x4cf9aa7e, 0x1948c25c, 0x02fb8a8c, 0x01c36ae4,
|
|
82780
|
-
0xd6ebe1f9, 0x90d4f869, 0xa65cdea0, 0x3f09252d, 0xc208e69f,
|
|
82781
|
-
0xb74e6132, 0xce77e25b, 0x578fdfe3, 0x3ac372e6
|
|
82782
|
-
];
|
|
82783
|
-
|
|
82784
|
-
/**
|
|
82785
|
-
* @type {Array.<number>}
|
|
82786
|
-
* @const
|
|
82787
|
-
* @inner
|
|
82788
|
-
*/
|
|
82789
|
-
var C_ORIG = [
|
|
82790
|
-
0x4f727068, 0x65616e42, 0x65686f6c, 0x64657253, 0x63727944,
|
|
82791
|
-
0x6f756274
|
|
82792
|
-
];
|
|
82793
|
-
|
|
82794
|
-
/**
|
|
82795
|
-
* @param {Array.<number>} lr
|
|
82796
|
-
* @param {number} off
|
|
82797
|
-
* @param {Array.<number>} P
|
|
82798
|
-
* @param {Array.<number>} S
|
|
82799
|
-
* @returns {Array.<number>}
|
|
82800
|
-
* @inner
|
|
82801
|
-
*/
|
|
82802
|
-
function _encipher(lr, off, P, S) { // This is our bottleneck: 1714/1905 ticks / 90% - see profile.txt
|
|
82803
|
-
var n,
|
|
82804
|
-
l = lr[off],
|
|
82805
|
-
r = lr[off + 1];
|
|
82806
|
-
|
|
82807
|
-
l ^= P[0];
|
|
82808
|
-
|
|
82809
|
-
/*
|
|
82810
|
-
for (var i=0, k=BLOWFISH_NUM_ROUNDS-2; i<=k;)
|
|
82811
|
-
// Feistel substitution on left word
|
|
82812
|
-
n = S[l >>> 24],
|
|
82813
|
-
n += S[0x100 | ((l >> 16) & 0xff)],
|
|
82814
|
-
n ^= S[0x200 | ((l >> 8) & 0xff)],
|
|
82815
|
-
n += S[0x300 | (l & 0xff)],
|
|
82816
|
-
r ^= n ^ P[++i],
|
|
82817
|
-
// Feistel substitution on right word
|
|
82818
|
-
n = S[r >>> 24],
|
|
82819
|
-
n += S[0x100 | ((r >> 16) & 0xff)],
|
|
82820
|
-
n ^= S[0x200 | ((r >> 8) & 0xff)],
|
|
82821
|
-
n += S[0x300 | (r & 0xff)],
|
|
82822
|
-
l ^= n ^ P[++i];
|
|
82823
|
-
*/
|
|
82824
|
-
|
|
82825
|
-
//The following is an unrolled version of the above loop.
|
|
82826
|
-
//Iteration 0
|
|
82827
|
-
n = S[l >>> 24];
|
|
82828
|
-
n += S[0x100 | ((l >> 16) & 0xff)];
|
|
82829
|
-
n ^= S[0x200 | ((l >> 8) & 0xff)];
|
|
82830
|
-
n += S[0x300 | (l & 0xff)];
|
|
82831
|
-
r ^= n ^ P[1];
|
|
82832
|
-
n = S[r >>> 24];
|
|
82833
|
-
n += S[0x100 | ((r >> 16) & 0xff)];
|
|
82834
|
-
n ^= S[0x200 | ((r >> 8) & 0xff)];
|
|
82835
|
-
n += S[0x300 | (r & 0xff)];
|
|
82836
|
-
l ^= n ^ P[2];
|
|
82837
|
-
//Iteration 1
|
|
82838
|
-
n = S[l >>> 24];
|
|
82839
|
-
n += S[0x100 | ((l >> 16) & 0xff)];
|
|
82840
|
-
n ^= S[0x200 | ((l >> 8) & 0xff)];
|
|
82841
|
-
n += S[0x300 | (l & 0xff)];
|
|
82842
|
-
r ^= n ^ P[3];
|
|
82843
|
-
n = S[r >>> 24];
|
|
82844
|
-
n += S[0x100 | ((r >> 16) & 0xff)];
|
|
82845
|
-
n ^= S[0x200 | ((r >> 8) & 0xff)];
|
|
82846
|
-
n += S[0x300 | (r & 0xff)];
|
|
82847
|
-
l ^= n ^ P[4];
|
|
82848
|
-
//Iteration 2
|
|
82849
|
-
n = S[l >>> 24];
|
|
82850
|
-
n += S[0x100 | ((l >> 16) & 0xff)];
|
|
82851
|
-
n ^= S[0x200 | ((l >> 8) & 0xff)];
|
|
82852
|
-
n += S[0x300 | (l & 0xff)];
|
|
82853
|
-
r ^= n ^ P[5];
|
|
82854
|
-
n = S[r >>> 24];
|
|
82855
|
-
n += S[0x100 | ((r >> 16) & 0xff)];
|
|
82856
|
-
n ^= S[0x200 | ((r >> 8) & 0xff)];
|
|
82857
|
-
n += S[0x300 | (r & 0xff)];
|
|
82858
|
-
l ^= n ^ P[6];
|
|
82859
|
-
//Iteration 3
|
|
82860
|
-
n = S[l >>> 24];
|
|
82861
|
-
n += S[0x100 | ((l >> 16) & 0xff)];
|
|
82862
|
-
n ^= S[0x200 | ((l >> 8) & 0xff)];
|
|
82863
|
-
n += S[0x300 | (l & 0xff)];
|
|
82864
|
-
r ^= n ^ P[7];
|
|
82865
|
-
n = S[r >>> 24];
|
|
82866
|
-
n += S[0x100 | ((r >> 16) & 0xff)];
|
|
82867
|
-
n ^= S[0x200 | ((r >> 8) & 0xff)];
|
|
82868
|
-
n += S[0x300 | (r & 0xff)];
|
|
82869
|
-
l ^= n ^ P[8];
|
|
82870
|
-
//Iteration 4
|
|
82871
|
-
n = S[l >>> 24];
|
|
82872
|
-
n += S[0x100 | ((l >> 16) & 0xff)];
|
|
82873
|
-
n ^= S[0x200 | ((l >> 8) & 0xff)];
|
|
82874
|
-
n += S[0x300 | (l & 0xff)];
|
|
82875
|
-
r ^= n ^ P[9];
|
|
82876
|
-
n = S[r >>> 24];
|
|
82877
|
-
n += S[0x100 | ((r >> 16) & 0xff)];
|
|
82878
|
-
n ^= S[0x200 | ((r >> 8) & 0xff)];
|
|
82879
|
-
n += S[0x300 | (r & 0xff)];
|
|
82880
|
-
l ^= n ^ P[10];
|
|
82881
|
-
//Iteration 5
|
|
82882
|
-
n = S[l >>> 24];
|
|
82883
|
-
n += S[0x100 | ((l >> 16) & 0xff)];
|
|
82884
|
-
n ^= S[0x200 | ((l >> 8) & 0xff)];
|
|
82885
|
-
n += S[0x300 | (l & 0xff)];
|
|
82886
|
-
r ^= n ^ P[11];
|
|
82887
|
-
n = S[r >>> 24];
|
|
82888
|
-
n += S[0x100 | ((r >> 16) & 0xff)];
|
|
82889
|
-
n ^= S[0x200 | ((r >> 8) & 0xff)];
|
|
82890
|
-
n += S[0x300 | (r & 0xff)];
|
|
82891
|
-
l ^= n ^ P[12];
|
|
82892
|
-
//Iteration 6
|
|
82893
|
-
n = S[l >>> 24];
|
|
82894
|
-
n += S[0x100 | ((l >> 16) & 0xff)];
|
|
82895
|
-
n ^= S[0x200 | ((l >> 8) & 0xff)];
|
|
82896
|
-
n += S[0x300 | (l & 0xff)];
|
|
82897
|
-
r ^= n ^ P[13];
|
|
82898
|
-
n = S[r >>> 24];
|
|
82899
|
-
n += S[0x100 | ((r >> 16) & 0xff)];
|
|
82900
|
-
n ^= S[0x200 | ((r >> 8) & 0xff)];
|
|
82901
|
-
n += S[0x300 | (r & 0xff)];
|
|
82902
|
-
l ^= n ^ P[14];
|
|
82903
|
-
//Iteration 7
|
|
82904
|
-
n = S[l >>> 24];
|
|
82905
|
-
n += S[0x100 | ((l >> 16) & 0xff)];
|
|
82906
|
-
n ^= S[0x200 | ((l >> 8) & 0xff)];
|
|
82907
|
-
n += S[0x300 | (l & 0xff)];
|
|
82908
|
-
r ^= n ^ P[15];
|
|
82909
|
-
n = S[r >>> 24];
|
|
82910
|
-
n += S[0x100 | ((r >> 16) & 0xff)];
|
|
82911
|
-
n ^= S[0x200 | ((r >> 8) & 0xff)];
|
|
82912
|
-
n += S[0x300 | (r & 0xff)];
|
|
82913
|
-
l ^= n ^ P[16];
|
|
82914
|
-
|
|
82915
|
-
lr[off] = r ^ P[BLOWFISH_NUM_ROUNDS + 1];
|
|
82916
|
-
lr[off + 1] = l;
|
|
82917
|
-
return lr;
|
|
82918
|
-
}
|
|
82919
|
-
|
|
82920
|
-
/**
|
|
82921
|
-
* @param {Array.<number>} data
|
|
82922
|
-
* @param {number} offp
|
|
82923
|
-
* @returns {{key: number, offp: number}}
|
|
82924
|
-
* @inner
|
|
82925
|
-
*/
|
|
82926
|
-
function _streamtoword(data, offp) {
|
|
82927
|
-
for (var i = 0, word = 0; i < 4; ++i)
|
|
82928
|
-
word = (word << 8) | (data[offp] & 0xff),
|
|
82929
|
-
offp = (offp + 1) % data.length;
|
|
82930
|
-
return { key: word, offp: offp };
|
|
82931
|
-
}
|
|
82932
|
-
|
|
82933
|
-
/**
|
|
82934
|
-
* @param {Array.<number>} key
|
|
82935
|
-
* @param {Array.<number>} P
|
|
82936
|
-
* @param {Array.<number>} S
|
|
82937
|
-
* @inner
|
|
82938
|
-
*/
|
|
82939
|
-
function _key(key, P, S) {
|
|
82940
|
-
var offset = 0,
|
|
82941
|
-
lr = [0, 0],
|
|
82942
|
-
plen = P.length,
|
|
82943
|
-
slen = S.length,
|
|
82944
|
-
sw;
|
|
82945
|
-
for (var i = 0; i < plen; i++)
|
|
82946
|
-
sw = _streamtoword(key, offset),
|
|
82947
|
-
offset = sw.offp,
|
|
82948
|
-
P[i] = P[i] ^ sw.key;
|
|
82949
|
-
for (i = 0; i < plen; i += 2)
|
|
82950
|
-
lr = _encipher(lr, 0, P, S),
|
|
82951
|
-
P[i] = lr[0],
|
|
82952
|
-
P[i + 1] = lr[1];
|
|
82953
|
-
for (i = 0; i < slen; i += 2)
|
|
82954
|
-
lr = _encipher(lr, 0, P, S),
|
|
82955
|
-
S[i] = lr[0],
|
|
82956
|
-
S[i + 1] = lr[1];
|
|
82957
|
-
}
|
|
82958
|
-
|
|
82959
|
-
/**
|
|
82960
|
-
* Expensive key schedule Blowfish.
|
|
82961
|
-
* @param {Array.<number>} data
|
|
82962
|
-
* @param {Array.<number>} key
|
|
82963
|
-
* @param {Array.<number>} P
|
|
82964
|
-
* @param {Array.<number>} S
|
|
82965
|
-
* @inner
|
|
82966
|
-
*/
|
|
82967
|
-
function _ekskey(data, key, P, S) {
|
|
82968
|
-
var offp = 0,
|
|
82969
|
-
lr = [0, 0],
|
|
82970
|
-
plen = P.length,
|
|
82971
|
-
slen = S.length,
|
|
82972
|
-
sw;
|
|
82973
|
-
for (var i = 0; i < plen; i++)
|
|
82974
|
-
sw = _streamtoword(key, offp),
|
|
82975
|
-
offp = sw.offp,
|
|
82976
|
-
P[i] = P[i] ^ sw.key;
|
|
82977
|
-
offp = 0;
|
|
82978
|
-
for (i = 0; i < plen; i += 2)
|
|
82979
|
-
sw = _streamtoword(data, offp),
|
|
82980
|
-
offp = sw.offp,
|
|
82981
|
-
lr[0] ^= sw.key,
|
|
82982
|
-
sw = _streamtoword(data, offp),
|
|
82983
|
-
offp = sw.offp,
|
|
82984
|
-
lr[1] ^= sw.key,
|
|
82985
|
-
lr = _encipher(lr, 0, P, S),
|
|
82986
|
-
P[i] = lr[0],
|
|
82987
|
-
P[i + 1] = lr[1];
|
|
82988
|
-
for (i = 0; i < slen; i += 2)
|
|
82989
|
-
sw = _streamtoword(data, offp),
|
|
82990
|
-
offp = sw.offp,
|
|
82991
|
-
lr[0] ^= sw.key,
|
|
82992
|
-
sw = _streamtoword(data, offp),
|
|
82993
|
-
offp = sw.offp,
|
|
82994
|
-
lr[1] ^= sw.key,
|
|
82995
|
-
lr = _encipher(lr, 0, P, S),
|
|
82996
|
-
S[i] = lr[0],
|
|
82997
|
-
S[i + 1] = lr[1];
|
|
82998
|
-
}
|
|
82999
|
-
|
|
83000
|
-
/**
|
|
83001
|
-
* Internaly crypts a string.
|
|
83002
|
-
* @param {Array.<number>} b Bytes to crypt
|
|
83003
|
-
* @param {Array.<number>} salt Salt bytes to use
|
|
83004
|
-
* @param {number} rounds Number of rounds
|
|
83005
|
-
* @param {function(Error, Array.<number>=)=} callback Callback receiving the error, if any, and the resulting bytes. If
|
|
83006
|
-
* omitted, the operation will be performed synchronously.
|
|
83007
|
-
* @param {function(number)=} progressCallback Callback called with the current progress
|
|
83008
|
-
* @returns {!Array.<number>|undefined} Resulting bytes if callback has been omitted, otherwise `undefined`
|
|
83009
|
-
* @inner
|
|
83010
|
-
*/
|
|
83011
|
-
function _crypt(b, salt, rounds, callback, progressCallback) {
|
|
83012
|
-
var cdata = C_ORIG.slice(),
|
|
83013
|
-
clen = cdata.length,
|
|
83014
|
-
err;
|
|
83015
|
-
|
|
83016
|
-
// Validate
|
|
83017
|
-
if (rounds < 4 || rounds > 31) {
|
|
83018
|
-
err = Error("Illegal number of rounds (4-31): "+rounds);
|
|
83019
|
-
if (callback) {
|
|
83020
|
-
nextTick(callback.bind(this, err));
|
|
83021
|
-
return;
|
|
83022
|
-
} else
|
|
83023
|
-
throw err;
|
|
83024
|
-
}
|
|
83025
|
-
if (salt.length !== BCRYPT_SALT_LEN) {
|
|
83026
|
-
err =Error("Illegal salt length: "+salt.length+" != "+BCRYPT_SALT_LEN);
|
|
83027
|
-
if (callback) {
|
|
83028
|
-
nextTick(callback.bind(this, err));
|
|
83029
|
-
return;
|
|
83030
|
-
} else
|
|
83031
|
-
throw err;
|
|
83032
|
-
}
|
|
83033
|
-
rounds = (1 << rounds) >>> 0;
|
|
83034
|
-
|
|
83035
|
-
var P, S, i = 0, j;
|
|
83036
|
-
|
|
83037
|
-
//Use typed arrays when available - huge speedup!
|
|
83038
|
-
if (Int32Array) {
|
|
83039
|
-
P = new Int32Array(P_ORIG);
|
|
83040
|
-
S = new Int32Array(S_ORIG);
|
|
83041
|
-
} else {
|
|
83042
|
-
P = P_ORIG.slice();
|
|
83043
|
-
S = S_ORIG.slice();
|
|
83044
|
-
}
|
|
83045
|
-
|
|
83046
|
-
_ekskey(salt, b, P, S);
|
|
83047
|
-
|
|
83048
|
-
/**
|
|
83049
|
-
* Calcualtes the next round.
|
|
83050
|
-
* @returns {Array.<number>|undefined} Resulting array if callback has been omitted, otherwise `undefined`
|
|
83051
|
-
* @inner
|
|
83052
|
-
*/
|
|
83053
|
-
function next() {
|
|
83054
|
-
if (progressCallback)
|
|
83055
|
-
progressCallback(i / rounds);
|
|
83056
|
-
if (i < rounds) {
|
|
83057
|
-
var start = Date.now();
|
|
83058
|
-
for (; i < rounds;) {
|
|
83059
|
-
i = i + 1;
|
|
83060
|
-
_key(b, P, S);
|
|
83061
|
-
_key(salt, P, S);
|
|
83062
|
-
if (Date.now() - start > MAX_EXECUTION_TIME)
|
|
83063
|
-
break;
|
|
83064
|
-
}
|
|
83065
|
-
} else {
|
|
83066
|
-
for (i = 0; i < 64; i++)
|
|
83067
|
-
for (j = 0; j < (clen >> 1); j++)
|
|
83068
|
-
_encipher(cdata, j << 1, P, S);
|
|
83069
|
-
var ret = [];
|
|
83070
|
-
for (i = 0; i < clen; i++)
|
|
83071
|
-
ret.push(((cdata[i] >> 24) & 0xff) >>> 0),
|
|
83072
|
-
ret.push(((cdata[i] >> 16) & 0xff) >>> 0),
|
|
83073
|
-
ret.push(((cdata[i] >> 8) & 0xff) >>> 0),
|
|
83074
|
-
ret.push((cdata[i] & 0xff) >>> 0);
|
|
83075
|
-
if (callback) {
|
|
83076
|
-
callback(null, ret);
|
|
83077
|
-
return;
|
|
83078
|
-
} else
|
|
83079
|
-
return ret;
|
|
83080
|
-
}
|
|
83081
|
-
if (callback)
|
|
83082
|
-
nextTick(next);
|
|
83083
|
-
}
|
|
83084
|
-
|
|
83085
|
-
// Async
|
|
83086
|
-
if (typeof callback !== 'undefined') {
|
|
83087
|
-
next();
|
|
83088
|
-
|
|
83089
|
-
// Sync
|
|
83090
|
-
} else {
|
|
83091
|
-
var res;
|
|
83092
|
-
while (true)
|
|
83093
|
-
if (typeof(res = next()) !== 'undefined')
|
|
83094
|
-
return res || [];
|
|
83095
|
-
}
|
|
83096
|
-
}
|
|
83097
|
-
|
|
83098
|
-
/**
|
|
83099
|
-
* Internally hashes a string.
|
|
83100
|
-
* @param {string} s String to hash
|
|
83101
|
-
* @param {?string} salt Salt to use, actually never null
|
|
83102
|
-
* @param {function(Error, string=)=} callback Callback receiving the error, if any, and the resulting hash. If omitted,
|
|
83103
|
-
* hashing is perormed synchronously.
|
|
83104
|
-
* @param {function(number)=} progressCallback Callback called with the current progress
|
|
83105
|
-
* @returns {string|undefined} Resulting hash if callback has been omitted, otherwise `undefined`
|
|
83106
|
-
* @inner
|
|
83107
|
-
*/
|
|
83108
|
-
function _hash(s, salt, callback, progressCallback) {
|
|
83109
|
-
var err;
|
|
83110
|
-
if (typeof s !== 'string' || typeof salt !== 'string') {
|
|
83111
|
-
err = Error("Invalid string / salt: Not a string");
|
|
83112
|
-
if (callback) {
|
|
83113
|
-
nextTick(callback.bind(this, err));
|
|
83114
|
-
return;
|
|
83115
|
-
}
|
|
83116
|
-
else
|
|
83117
|
-
throw err;
|
|
83118
|
-
}
|
|
83119
|
-
|
|
83120
|
-
// Validate the salt
|
|
83121
|
-
var minor, offset;
|
|
83122
|
-
if (salt.charAt(0) !== '$' || salt.charAt(1) !== '2') {
|
|
83123
|
-
err = Error("Invalid salt version: "+salt.substring(0,2));
|
|
83124
|
-
if (callback) {
|
|
83125
|
-
nextTick(callback.bind(this, err));
|
|
83126
|
-
return;
|
|
83127
|
-
}
|
|
83128
|
-
else
|
|
83129
|
-
throw err;
|
|
83130
|
-
}
|
|
83131
|
-
if (salt.charAt(2) === '$')
|
|
83132
|
-
minor = String.fromCharCode(0),
|
|
83133
|
-
offset = 3;
|
|
83134
|
-
else {
|
|
83135
|
-
minor = salt.charAt(2);
|
|
83136
|
-
if ((minor !== 'a' && minor !== 'b' && minor !== 'y') || salt.charAt(3) !== '$') {
|
|
83137
|
-
err = Error("Invalid salt revision: "+salt.substring(2,4));
|
|
83138
|
-
if (callback) {
|
|
83139
|
-
nextTick(callback.bind(this, err));
|
|
83140
|
-
return;
|
|
83141
|
-
} else
|
|
83142
|
-
throw err;
|
|
83143
|
-
}
|
|
83144
|
-
offset = 4;
|
|
83145
|
-
}
|
|
83146
|
-
|
|
83147
|
-
// Extract number of rounds
|
|
83148
|
-
if (salt.charAt(offset + 2) > '$') {
|
|
83149
|
-
err = Error("Missing salt rounds");
|
|
83150
|
-
if (callback) {
|
|
83151
|
-
nextTick(callback.bind(this, err));
|
|
83152
|
-
return;
|
|
83153
|
-
} else
|
|
83154
|
-
throw err;
|
|
83155
|
-
}
|
|
83156
|
-
var r1 = parseInt(salt.substring(offset, offset + 1), 10) * 10,
|
|
83157
|
-
r2 = parseInt(salt.substring(offset + 1, offset + 2), 10),
|
|
83158
|
-
rounds = r1 + r2,
|
|
83159
|
-
real_salt = salt.substring(offset + 3, offset + 25);
|
|
83160
|
-
s += minor >= 'a' ? "\x00" : "";
|
|
83161
|
-
|
|
83162
|
-
var passwordb = stringToBytes(s),
|
|
83163
|
-
saltb = base64_decode(real_salt, BCRYPT_SALT_LEN);
|
|
83164
|
-
|
|
83165
|
-
/**
|
|
83166
|
-
* Finishes hashing.
|
|
83167
|
-
* @param {Array.<number>} bytes Byte array
|
|
83168
|
-
* @returns {string}
|
|
83169
|
-
* @inner
|
|
83170
|
-
*/
|
|
83171
|
-
function finish(bytes) {
|
|
83172
|
-
var res = [];
|
|
83173
|
-
res.push("$2");
|
|
83174
|
-
if (minor >= 'a')
|
|
83175
|
-
res.push(minor);
|
|
83176
|
-
res.push("$");
|
|
83177
|
-
if (rounds < 10)
|
|
83178
|
-
res.push("0");
|
|
83179
|
-
res.push(rounds.toString());
|
|
83180
|
-
res.push("$");
|
|
83181
|
-
res.push(base64_encode(saltb, saltb.length));
|
|
83182
|
-
res.push(base64_encode(bytes, C_ORIG.length * 4 - 1));
|
|
83183
|
-
return res.join('');
|
|
83184
|
-
}
|
|
83185
|
-
|
|
83186
|
-
// Sync
|
|
83187
|
-
if (typeof callback == 'undefined')
|
|
83188
|
-
return finish(_crypt(passwordb, saltb, rounds));
|
|
83189
|
-
|
|
83190
|
-
// Async
|
|
83191
|
-
else {
|
|
83192
|
-
_crypt(passwordb, saltb, rounds, function(err, bytes) {
|
|
83193
|
-
if (err)
|
|
83194
|
-
callback(err, null);
|
|
83195
|
-
else
|
|
83196
|
-
callback(null, finish(bytes));
|
|
83197
|
-
}, progressCallback);
|
|
83198
|
-
}
|
|
83199
|
-
}
|
|
83200
|
-
|
|
83201
|
-
/**
|
|
83202
|
-
* Encodes a byte array to base64 with up to len bytes of input, using the custom bcrypt alphabet.
|
|
83203
|
-
* @function
|
|
83204
|
-
* @param {!Array.<number>} b Byte array
|
|
83205
|
-
* @param {number} len Maximum input length
|
|
83206
|
-
* @returns {string}
|
|
83207
|
-
* @expose
|
|
83208
|
-
*/
|
|
83209
|
-
bcrypt.encodeBase64 = base64_encode;
|
|
83210
|
-
|
|
83211
|
-
/**
|
|
83212
|
-
* Decodes a base64 encoded string to up to len bytes of output, using the custom bcrypt alphabet.
|
|
83213
|
-
* @function
|
|
83214
|
-
* @param {string} s String to decode
|
|
83215
|
-
* @param {number} len Maximum output length
|
|
83216
|
-
* @returns {!Array.<number>}
|
|
83217
|
-
* @expose
|
|
83218
|
-
*/
|
|
83219
|
-
bcrypt.decodeBase64 = base64_decode;
|
|
83220
|
-
|
|
83221
|
-
return bcrypt;
|
|
83222
|
-
}));
|
|
83223
|
-
} (bcrypt));
|
|
83224
|
-
|
|
83225
|
-
/*
|
|
83226
|
-
Copyright (c) 2012 Nevins Bartolomeo <nevins.bartolomeo@gmail.com>
|
|
83227
|
-
Copyright (c) 2012 Shane Girish <shaneGirish@gmail.com>
|
|
83228
|
-
Copyright (c) 2013 Daniel Wirtz <dcode@dcode.io>
|
|
83229
|
-
|
|
83230
|
-
Redistribution and use in source and binary forms, with or without
|
|
83231
|
-
modification, are permitted provided that the following conditions
|
|
83232
|
-
are met:
|
|
83233
|
-
1. Redistributions of source code must retain the above copyright
|
|
83234
|
-
notice, this list of conditions and the following disclaimer.
|
|
83235
|
-
2. Redistributions in binary form must reproduce the above copyright
|
|
83236
|
-
notice, this list of conditions and the following disclaimer in the
|
|
83237
|
-
documentation and/or other materials provided with the distribution.
|
|
83238
|
-
3. The name of the author may not be used to endorse or promote products
|
|
83239
|
-
derived from this software without specific prior written permission.
|
|
83240
|
-
|
|
83241
|
-
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
|
83242
|
-
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|
83243
|
-
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
83244
|
-
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
83245
|
-
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|
83246
|
-
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
83247
|
-
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
83248
|
-
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
83249
|
-
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|
83250
|
-
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
83251
|
-
*/
|
|
83252
|
-
|
|
83253
|
-
(function (module) {
|
|
83254
|
-
module.exports = bcryptExports;
|
|
83255
|
-
} (bcryptjs));
|
|
82814
|
+
const I=16,$=10,D=16,F=100,w="./ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".split(""),S=Array.from({length:64},(n,r)=>r),d=n=>Array(n).fill(-1),f=[...d(46),0,1,...S.slice(54,64),...d(7),...S.slice(2,28),...d(6),...S.slice(28,54),...d(5)],_=[608135816,2242054355,320440878,57701188,2752067618,698298832,137296536,3964562569,1160258022,953160567,3193202383,887688300,3232508343,3380367581,1065670069,3041331479,2450970073,2306472731],P=[3509652390,2564797868,805139163,3491422135,3101798381,1780907670,3128725573,4046225305,614570311,3012652279,134345442,2240740374,1667834072,1901547113,2757295779,4103290238,227898511,1921955416,1904987480,2182433518,2069144605,3260701109,2620446009,720527379,3318853667,677414384,3393288472,3101374703,2390351024,1614419982,1822297739,2954791486,3608508353,3174124327,2024746970,1432378464,3864339955,2857741204,1464375394,1676153920,1439316330,715854006,3033291828,289532110,2706671279,2087905683,3018724369,1668267050,732546397,1947742710,3462151702,2609353502,2950085171,1814351708,2050118529,680887927,999245976,1800124847,3300911131,1713906067,1641548236,4213287313,1216130144,1575780402,4018429277,3917837745,3693486850,3949271944,596196993,3549867205,258830323,2213823033,772490370,2760122372,1774776394,2652871518,566650946,4142492826,1728879713,2882767088,1783734482,3629395816,2517608232,2874225571,1861159788,326777828,3124490320,2130389656,2716951837,967770486,1724537150,2185432712,2364442137,1164943284,2105845187,998989502,3765401048,2244026483,1075463327,1455516326,1322494562,910128902,469688178,1117454909,936433444,3490320968,3675253459,1240580251,122909385,2157517691,634681816,4142456567,3825094682,3061402683,2540495037,79693498,3249098678,1084186820,1583128258,426386531,1761308591,1047286709,322548459,995290223,1845252383,2603652396,3431023940,2942221577,3202600964,3727903485,1712269319,422464435,3234572375,1170764815,3523960633,3117677531,1434042557,442511882,3600875718,1076654713,1738483198,4213154764,2393238008,3677496056,1014306527,4251020053,793779912,2902807211,842905082,4246964064,1395751752,1040244610,2656851899,3396308128,445077038,3742853595,3577915638,679411651,2892444358,2354009459,1767581616,3150600392,3791627101,3102740896,284835224,4246832056,1258075500,768725851,2589189241,3069724005,3532540348,1274779536,3789419226,2764799539,1660621633,3471099624,4011903706,913787905,3497959166,737222580,2514213453,2928710040,3937242737,1804850592,3499020752,2949064160,2386320175,2390070455,2415321851,4061277028,2290661394,2416832540,1336762016,1754252060,3520065937,3014181293,791618072,3188594551,3933548030,2332172193,3852520463,3043980520,413987798,3465142937,3030929376,4245938359,2093235073,3534596313,375366246,2157278981,2479649556,555357303,3870105701,2008414854,3344188149,4221384143,3956125452,2067696032,3594591187,2921233993,2428461,544322398,577241275,1471733935,610547355,4027169054,1432588573,1507829418,2025931657,3646575487,545086370,48609733,2200306550,1653985193,298326376,1316178497,3007786442,2064951626,458293330,2589141269,3591329599,3164325604,727753846,2179363840,146436021,1461446943,4069977195,705550613,3059967265,3887724982,4281599278,3313849956,1404054877,2845806497,146425753,1854211946,1266315497,3048417604,3681880366,3289982499,290971e4,1235738493,2632868024,2414719590,3970600049,1771706367,1449415276,3266420449,422970021,1963543593,2690192192,3826793022,1062508698,1531092325,1804592342,2583117782,2714934279,4024971509,1294809318,4028980673,1289560198,2221992742,1669523910,35572830,157838143,1052438473,1016535060,1802137761,1753167236,1386275462,3080475397,2857371447,1040679964,2145300060,2390574316,1461121720,2956646967,4031777805,4028374788,33600511,2920084762,1018524850,629373528,3691585981,3515945977,2091462646,2486323059,586499841,988145025,935516892,3367335476,2599673255,2839830854,265290510,3972581182,2759138881,3795373465,1005194799,847297441,406762289,1314163512,1332590856,1866599683,4127851711,750260880,613907577,1450815602,3165620655,3734664991,3650291728,3012275730,3704569646,1427272223,778793252,1343938022,2676280711,2052605720,1946737175,3164576444,3914038668,3967478842,3682934266,1661551462,3294938066,4011595847,840292616,3712170807,616741398,312560963,711312465,1351876610,322626781,1910503582,271666773,2175563734,1594956187,70604529,3617834859,1007753275,1495573769,4069517037,2549218298,2663038764,504708206,2263041392,3941167025,2249088522,1514023603,1998579484,1312622330,694541497,2582060303,2151582166,1382467621,776784248,2618340202,3323268794,2497899128,2784771155,503983604,4076293799,907881277,423175695,432175456,1378068232,4145222326,3954048622,3938656102,3820766613,2793130115,2977904593,26017576,3274890735,3194772133,1700274565,1756076034,4006520079,3677328699,720338349,1533947780,354530856,688349552,3973924725,1637815568,332179504,3949051286,53804574,2852348879,3044236432,1282449977,3583942155,3416972820,4006381244,1617046695,2628476075,3002303598,1686838959,431878346,2686675385,1700445008,1080580658,1009431731,832498133,3223435511,2605976345,2271191193,2516031870,1648197032,4164389018,2548247927,300782431,375919233,238389289,3353747414,2531188641,2019080857,1475708069,455242339,2609103871,448939670,3451063019,1395535956,2413381860,1841049896,1491858159,885456874,4264095073,4001119347,1565136089,3898914787,1108368660,540939232,1173283510,2745871338,3681308437,4207628240,3343053890,4016749493,1699691293,1103962373,3625875870,2256883143,3830138730,1031889488,3479347698,1535977030,4236805024,3251091107,2132092099,1774941330,1199868427,1452454533,157007616,2904115357,342012276,595725824,1480756522,206960106,497939518,591360097,863170706,2375253569,3596610801,1814182875,2094937945,3421402208,1082520231,3463918190,2785509508,435703966,3908032597,1641649973,2842273706,3305899714,1510255612,2148256476,2655287854,3276092548,4258621189,236887753,3681803219,274041037,1734335097,3815195456,3317970021,1899903192,1026095262,4050517792,356393447,2410691914,3873677099,3682840055,3913112168,2491498743,4132185628,2489919796,1091903735,1979897079,3170134830,3567386728,3557303409,857797738,1136121015,1342202287,507115054,2535736646,337727348,3213592640,1301675037,2528481711,1895095763,1721773893,3216771564,62756741,2142006736,835421444,2531993523,1442658625,3659876326,2882144922,676362277,1392781812,170690266,3921047035,1759253602,3611846912,1745797284,664899054,1329594018,3901205900,3045908486,2062866102,2865634940,3543621612,3464012697,1080764994,553557557,3656615353,3996768171,991055499,499776247,1265440854,648242737,3940784050,980351604,3713745714,1749149687,3396870395,4211799374,3640570775,1161844396,3125318951,1431517754,545492359,4268468663,3499529547,1437099964,2702547544,3433638243,2581715763,2787789398,1060185593,1593081372,2418618748,4260947970,69676912,2159744348,86519011,2512459080,3838209314,1220612927,3339683548,133810670,1090789135,1078426020,1569222167,845107691,3583754449,4072456591,1091646820,628848692,1613405280,3757631651,526609435,236106946,48312990,2942717905,3402727701,1797494240,859738849,992217954,4005476642,2243076622,3870952857,3732016268,765654824,3490871365,2511836413,1685915746,3888969200,1414112111,2273134842,3281911079,4080962846,172450625,2569994100,980381355,4109958455,2819808352,2716589560,2568741196,3681446669,3329971472,1835478071,660984891,3704678404,4045999559,3422617507,3040415634,1762651403,1719377915,3470491036,2693910283,3642056355,3138596744,1364962596,2073328063,1983633131,926494387,3423689081,2150032023,4096667949,1749200295,3328846651,309677260,2016342300,1779581495,3079819751,111262694,1274766160,443224088,298511866,1025883608,3806446537,1145181785,168956806,3641502830,3584813610,1689216846,3666258015,3200248200,1692713982,2646376535,4042768518,1618508792,1610833997,3523052358,4130873264,2001055236,3610705100,2202168115,4028541809,2961195399,1006657119,2006996926,3186142756,1430667929,3210227297,1314452623,4074634658,4101304120,2273951170,1399257539,3367210612,3027628629,1190975929,2062231137,2333990788,2221543033,2438960610,1181637006,548689776,2362791313,3372408396,3104550113,3145860560,296247880,1970579870,3078560182,3769228297,1714227617,3291629107,3898220290,166772364,1251581989,493813264,448347421,195405023,2709975567,677966185,3703036547,1463355134,2715995803,1338867538,1343315457,2802222074,2684532164,233230375,2599980071,2000651841,3277868038,1638401717,4028070440,3237316320,6314154,819756386,300326615,590932579,1405279636,3267499572,3150704214,2428286686,3959192993,3461946742,1862657033,1266418056,963775037,2089974820,2263052895,1917689273,448879540,3550394620,3981727096,150775221,3627908307,1303187396,508620638,2975983352,2726630617,1817252668,1876281319,1457606340,908771278,3720792119,3617206836,2455994898,1729034894,1080033504,976866871,3556439503,2881648439,1522871579,1555064734,1336096578,3548522304,2579274686,3574697629,3205460757,3593280638,3338716283,3079412587,564236357,2993598910,1781952180,1464380207,3163844217,3332601554,1699332808,1393555694,1183702653,3581086237,1288719814,691649499,2847557200,2895455976,3193889540,2717570544,1781354906,1676643554,2592534050,3230253752,1126444790,2770207658,2633158820,2210423226,2615765581,2414155088,3127139286,673620729,2805611233,1269405062,4015350505,3341807571,4149409754,1057255273,2012875353,2162469141,2276492801,2601117357,993977747,3918593370,2654263191,753973209,36408145,2530585658,25011837,3520020182,2088578344,530523599,2918365339,1524020338,1518925132,3760827505,3759777254,1202760957,3985898139,3906192525,674977740,4174734889,2031300136,2019492241,3983892565,4153806404,3822280332,352677332,2297720250,60907813,90501309,3286998549,1016092578,2535922412,2839152426,457141659,509813237,4120667899,652014361,1966332200,2975202805,55981186,2327461051,676427537,3255491064,2882294119,3433927263,1307055953,942726286,933058658,2468411793,3933900994,4215176142,1361170020,2001714738,2830558078,3274259782,1222529897,1679025792,2729314320,3714953764,1770335741,151462246,3013232138,1682292957,1483529935,471910574,1539241949,458788160,3436315007,1807016891,3718408830,978976581,1043663428,3165965781,1927990952,4200891579,2372276910,3208408903,3533431907,1412390302,2931980059,4132332400,1947078029,3881505623,4168226417,2941484381,1077988104,1320477388,886195818,18198404,3786409e3,2509781533,112762804,3463356488,1866414978,891333506,18488651,661792760,1628790961,3885187036,3141171499,876946877,2693282273,1372485963,791857591,2686433993,3759982718,3167212022,3472953795,2716379847,445679433,3561995674,3504004811,3574258232,54117162,3331405415,2381918588,3769707343,4154350007,1140177722,4074052095,668550556,3214352940,367459370,261225585,2610173221,4209349473,3468074219,3265815641,314222801,3066103646,3808782860,282218597,3406013506,3773591054,379116347,1285071038,846784868,2669647154,3771962079,3550491691,2305946142,453669953,1268987020,3317592352,3279303384,3744833421,2610507566,3859509063,266596637,3847019092,517658769,3462560207,3443424879,370717030,4247526661,2224018117,4143653529,4112773975,2788324899,2477274417,1456262402,2901442914,1517677493,1846949527,2295493580,3734397586,2176403920,1280348187,1908823572,3871786941,846861322,1172426758,3287448474,3383383037,1655181056,3139813346,901632758,1897031941,2986607138,3066810236,3447102507,1393639104,373351379,950779232,625454576,3124240540,4148612726,2007998917,544563296,2244738638,2330496472,2058025392,1291430526,424198748,50039436,29584100,3605783033,2429876329,2791104160,1057563949,3255363231,3075367218,3463963227,1469046755,985887462],k=[1332899944,1700884034,1701343084,1684370003,1668446532,1869963892],b=(n,r)=>{if(r<=0||r>n.length)throw Error(`Illegal len: ${r}`);let o=0,t,e;const l=[];for(;o<r;){if(t=n[o++]&255,l.push(w[t>>2&63]),t=(t&3)<<4,o>=r){l.push(w[t&63]);break}if(e=n[o++]&255,t|=e>>4&15,l.push(w[t&63]),t=(e&15)<<2,o>=r){l.push(w[t&63]);break}e=n[o++]&255,t|=e>>6&3,l.push(w[t&63]),l.push(w[e&63]);}return l.join("")},R=(n,r)=>{if(r<=0)throw Error(`Illegal len: ${r}`);const o=n.length;let t=0,e=0,l,s,i,u,h,p;const a=[];for(;t<o-1&&e<r&&(p=n.charCodeAt(t++),l=p<f.length?f[p]:-1,p=n.charCodeAt(t++),s=p<f.length?f[p]:-1,!(l==-1||s==-1||(h=l<<2>>>0,h|=(s&48)>>4,a.push(String.fromCharCode(h)),++e>=r||t>=o)||(p=n.charCodeAt(t++),i=p<f.length?f[p]:-1,i==-1)||(h=(s&15)<<4>>>0,h|=(i&60)>>2,a.push(String.fromCharCode(h)),++e>=r||t>=o)));)p=n.charCodeAt(t++),u=p<f.length?f[p]:-1,h=(i&3)<<6>>>0,h|=u,a.push(String.fromCharCode(h)),++e;return a.map(c=>c.charCodeAt(0))},v=(n,r)=>{let o=null;for(typeof n=="number"&&(o=n,n=()=>null);o!==null||(o=n())!==null;)o<128?r(o&127):o<2048?(r(o>>6&31|192),r(o&63|128)):o<65536?(r(o>>12&15|224),r(o>>6&63|128),r(o&63|128)):(r(o>>18&7|240),r(o>>12&63|128),r(o>>6&63|128),r(o&63|128)),o=null;},L=(n,r)=>{let o,t=null;for(;(o=t!==null?t:n())!==null;){if(o>=55296&&o<=57343&&(t=n())!==null&&t>=56320&&t<=57343){r((o-55296)*1024+t-56320+65536),t=null;continue}r(o);}t!==null&&r(t);},G=(n,r)=>{L(n,function(o){v(o,r);});},A=typeof process<"u"&&process&&typeof process.nextTick=="function"?typeof setImmediate=="function"?setImmediate:process.nextTick:setTimeout,M=n=>{const r=[];let o=0;return G(()=>o>=n.length?null:n.charCodeAt(o++),t=>{r.push(t);}),r},E=(n,r,o,t)=>{let e,l=n[r],s=n[r+1];return l^=o[0],e=t[l>>>24],e+=t[256|l>>16&255],e^=t[512|l>>8&255],e+=t[768|l&255],s^=e^o[1],e=t[s>>>24],e+=t[256|s>>16&255],e^=t[512|s>>8&255],e+=t[768|s&255],l^=e^o[2],e=t[l>>>24],e+=t[256|l>>16&255],e^=t[512|l>>8&255],e+=t[768|l&255],s^=e^o[3],e=t[s>>>24],e+=t[256|s>>16&255],e^=t[512|s>>8&255],e+=t[768|s&255],l^=e^o[4],e=t[l>>>24],e+=t[256|l>>16&255],e^=t[512|l>>8&255],e+=t[768|l&255],s^=e^o[5],e=t[s>>>24],e+=t[256|s>>16&255],e^=t[512|s>>8&255],e+=t[768|s&255],l^=e^o[6],e=t[l>>>24],e+=t[256|l>>16&255],e^=t[512|l>>8&255],e+=t[768|l&255],s^=e^o[7],e=t[s>>>24],e+=t[256|s>>16&255],e^=t[512|s>>8&255],e+=t[768|s&255],l^=e^o[8],e=t[l>>>24],e+=t[256|l>>16&255],e^=t[512|l>>8&255],e+=t[768|l&255],s^=e^o[9],e=t[s>>>24],e+=t[256|s>>16&255],e^=t[512|s>>8&255],e+=t[768|s&255],l^=e^o[10],e=t[l>>>24],e+=t[256|l>>16&255],e^=t[512|l>>8&255],e+=t[768|l&255],s^=e^o[11],e=t[s>>>24],e+=t[256|s>>16&255],e^=t[512|s>>8&255],e+=t[768|s&255],l^=e^o[12],e=t[l>>>24],e+=t[256|l>>16&255],e^=t[512|l>>8&255],e+=t[768|l&255],s^=e^o[13],e=t[s>>>24],e+=t[256|s>>16&255],e^=t[512|s>>8&255],e+=t[768|s&255],l^=e^o[14],e=t[l>>>24],e+=t[256|l>>16&255],e^=t[512|l>>8&255],e+=t[768|l&255],s^=e^o[15],e=t[s>>>24],e+=t[256|s>>16&255],e^=t[512|s>>8&255],e+=t[768|s&255],l^=e^o[16],n[r]=s^o[D+1],n[r+1]=l,n},m=(n,r)=>{let o=0;for(let t=0;t<4;++t)o=o<<8|n[r]&255,r=(r+1)%n.length;return {key:o,offp:r}},j=(n,r,o)=>{const t=r.length,e=o.length;let l=0,s=[0,0],i;for(let u=0;u<t;u++)i=m(n,l),l=i.offp,r[u]=r[u]^i.key;for(let u=0;u<t;u+=2)s=E(s,0,r,o),r[u]=s[0],r[u+1]=s[1];for(let u=0;u<e;u+=2)s=E(s,0,r,o),o[u]=s[0],o[u+1]=s[1];},X=(n,r,o,t)=>{const e=o.length,l=t.length;let s=0,i=[0,0],u;for(let h=0;h<e;h++)u=m(r,s),s=u.offp,o[h]=o[h]^u.key;s=0;for(let h=0;h<e;h+=2)u=m(n,s),s=u.offp,i[0]^=u.key,u=m(n,s),s=u.offp,i[1]^=u.key,i=E(i,0,o,t),o[h]=i[0],o[h+1]=i[1];for(let h=0;h<l;h+=2)u=m(n,s),s=u.offp,i[0]^=u.key,u=m(n,s),s=u.offp,i[1]^=u.key,i=E(i,0,o,t),t[h]=i[0],t[h+1]=i[1];},U=(n,r,o,t,e)=>{const l=k.slice(),s=l.length;if(o<4||o>31){const c=new Error(`Illegal number of rounds (4-31): ${o}`);if(t===!1)return Promise.reject(c);throw c}if(r.length!==I){const c=new Error(`Illegal salt length: ${r.length} != ${I}`);if(t===!1)return Promise.reject(c);throw c}o=1<<o>>>0;let i,u,h=0,p;Int32Array?(i=new Int32Array(_),u=new Int32Array(P)):(i=_.slice(),u=P.slice()),X(r,n,i,u);const a=()=>{if(e&&e(h/o),h<o){const c=Date.now();for(;h<o&&(h=h+1,j(n,i,u),j(r,i,u),!(Date.now()-c>F)););}else {for(h=0;h<64;h++)for(p=0;p<s>>1;p++)E(l,p<<1,i,u);const c=[];for(h=0;h<s;h++)c.push((l[h]>>24&255)>>>0),c.push((l[h]>>16&255)>>>0),c.push((l[h]>>8&255)>>>0),c.push((l[h]&255)>>>0);return t===!1?Promise.resolve(c):c}if(t===!1)return new Promise(c=>A(()=>{a().then(c);}))};if(t===!1)return a();{let c;for(;;)if(typeof(c=a())<"u")return c||[]}},H=n=>randomBytes$1(n),C=(n=$)=>{if(typeof n!="number")throw Error("Illegal arguments: "+typeof n);n<4?n=4:n>31&&(n=31);const r=[];return r.push("$2a$"),n<10&&r.push("0"),r.push(n.toString()),r.push("$"),r.push(b(H(I),I)),r.join("")},x=(n=$)=>{if(typeof n!="number")throw Error("illegal arguments: "+typeof n);return new Promise((r,o)=>A(()=>{try{r(C(n));}catch(t){o(t);}}))};function T(n,r,o,t){if(typeof n!="string"||typeof r!="string"){const g=new Error("Invalid string / salt: Not a string");if(o===!1)return Promise.reject(g);throw g}let e,l;if(r.charAt(0)!=="$"||r.charAt(1)!=="2"){const g=new Error("Invalid salt version: "+r.substring(0,2));if(o===!1)return Promise.reject(g);throw g}if(r.charAt(2)==="$")e=String.fromCharCode(0),l=3;else {if(e=r.charAt(2),e!=="a"&&e!=="b"&&e!=="y"||r.charAt(3)!=="$"){const g=Error("Invalid salt revision: "+r.substring(2,4));if(o===!1)return Promise.reject(g);throw g}l=4;}if(r.charAt(l+2)>"$"){const g=new Error("Missing salt rounds");if(o===!1)return Promise.reject(g);throw g}const s=parseInt(r.substring(l,l+1),10)*10,i=parseInt(r.substring(l+1,l+2),10),u=s+i,h=r.substring(l+3,l+25);n+=e>="a"?"\0":"";const p=M(n),a=R(h,I),c=g=>{const y=[];return y.push("$2"),e>="a"&&y.push(e),y.push("$"),u<10&&y.push("0"),y.push(u.toString()),y.push("$"),y.push(b(a,a.length)),y.push(b(g,k.length*4-1)),y.join("")};return o===!1?U(p,a,u,!1,t).then(g=>c(g)):c(U(p,a,u,!0,t))}const B=function(n,r,o){return typeof n=="string"&&typeof r=="number"?x(r).then(t=>T(n,t,!1,o)):typeof n=="string"&&typeof r=="string"?T(n,r,!1,o):Promise.reject(new Error(`Illegal arguments: ${typeof n}, ${typeof r}`))},Y=(n,r,o)=>new Promise((t,e)=>{if(typeof n!="string"||typeof r!="string"){A(()=>e(new Error(`Illegal arguments: ${typeof n}, ${typeof r}`)));return}if(r.length!==60){A(()=>e(!1));return}B(n,r.substring(0,29),o).then(l=>t(l===r)).catch(l=>e(l));});
|
|
83256
82815
|
|
|
83257
|
-
const prisma = new
|
|
82816
|
+
const prisma = new PrismaClient({
|
|
83258
82817
|
datasources: {
|
|
83259
82818
|
db: {
|
|
83260
82819
|
url: `${config.database}`
|
|
@@ -83269,7 +82828,7 @@ const parseFields = async (server) => {
|
|
|
83269
82828
|
}
|
|
83270
82829
|
}
|
|
83271
82830
|
if (server.password) {
|
|
83272
|
-
server.password = await
|
|
82831
|
+
server.password = await B(server.password, 8);
|
|
83273
82832
|
}
|
|
83274
82833
|
};
|
|
83275
82834
|
prisma.$use(async (params, next) => {
|
|
@@ -83308,7 +82867,7 @@ const queryOrder = async () => {
|
|
|
83308
82867
|
}
|
|
83309
82868
|
});
|
|
83310
82869
|
isInitial = false;
|
|
83311
|
-
return updateCacheOrder(
|
|
82870
|
+
return updateCacheOrder(order?.value || "");
|
|
83312
82871
|
};
|
|
83313
82872
|
async function updateOrder(order, Prisma = prisma) {
|
|
83314
82873
|
const shouldEmit = Prisma === prisma;
|
|
@@ -83333,7 +82892,7 @@ async function readServerPassword(username) {
|
|
|
83333
82892
|
username
|
|
83334
82893
|
}
|
|
83335
82894
|
});
|
|
83336
|
-
return
|
|
82895
|
+
return item?.password || null;
|
|
83337
82896
|
}
|
|
83338
82897
|
async function readServersList() {
|
|
83339
82898
|
const queries = [prisma.server.findMany()];
|
|
@@ -83507,462 +83066,6 @@ router$1.get("/events", queryEvents);
|
|
|
83507
83066
|
router$1.delete("/events/:id?", removeEvent);
|
|
83508
83067
|
router$1.get("/config", queryConfig);
|
|
83509
83068
|
|
|
83510
|
-
var cjs = {};
|
|
83511
|
-
|
|
83512
|
-
Object.defineProperty(cjs, '__esModule', { value: true });
|
|
83513
|
-
|
|
83514
|
-
function _inheritsLoose(subClass, superClass) {
|
|
83515
|
-
subClass.prototype = Object.create(superClass.prototype);
|
|
83516
|
-
subClass.prototype.constructor = subClass;
|
|
83517
|
-
|
|
83518
|
-
_setPrototypeOf(subClass, superClass);
|
|
83519
|
-
}
|
|
83520
|
-
|
|
83521
|
-
function _getPrototypeOf(o) {
|
|
83522
|
-
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
|
|
83523
|
-
return o.__proto__ || Object.getPrototypeOf(o);
|
|
83524
|
-
};
|
|
83525
|
-
return _getPrototypeOf(o);
|
|
83526
|
-
}
|
|
83527
|
-
|
|
83528
|
-
function _setPrototypeOf(o, p) {
|
|
83529
|
-
_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
|
|
83530
|
-
o.__proto__ = p;
|
|
83531
|
-
return o;
|
|
83532
|
-
};
|
|
83533
|
-
|
|
83534
|
-
return _setPrototypeOf(o, p);
|
|
83535
|
-
}
|
|
83536
|
-
|
|
83537
|
-
function _isNativeReflectConstruct() {
|
|
83538
|
-
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
|
83539
|
-
if (Reflect.construct.sham) return false;
|
|
83540
|
-
if (typeof Proxy === "function") return true;
|
|
83541
|
-
|
|
83542
|
-
try {
|
|
83543
|
-
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
|
|
83544
|
-
return true;
|
|
83545
|
-
} catch (e) {
|
|
83546
|
-
return false;
|
|
83547
|
-
}
|
|
83548
|
-
}
|
|
83549
|
-
|
|
83550
|
-
function _construct(Parent, args, Class) {
|
|
83551
|
-
if (_isNativeReflectConstruct()) {
|
|
83552
|
-
_construct = Reflect.construct;
|
|
83553
|
-
} else {
|
|
83554
|
-
_construct = function _construct(Parent, args, Class) {
|
|
83555
|
-
var a = [null];
|
|
83556
|
-
a.push.apply(a, args);
|
|
83557
|
-
var Constructor = Function.bind.apply(Parent, a);
|
|
83558
|
-
var instance = new Constructor();
|
|
83559
|
-
if (Class) _setPrototypeOf(instance, Class.prototype);
|
|
83560
|
-
return instance;
|
|
83561
|
-
};
|
|
83562
|
-
}
|
|
83563
|
-
|
|
83564
|
-
return _construct.apply(null, arguments);
|
|
83565
|
-
}
|
|
83566
|
-
|
|
83567
|
-
function _isNativeFunction(fn) {
|
|
83568
|
-
return Function.toString.call(fn).indexOf("[native code]") !== -1;
|
|
83569
|
-
}
|
|
83570
|
-
|
|
83571
|
-
function _wrapNativeSuper(Class) {
|
|
83572
|
-
var _cache = typeof Map === "function" ? new Map() : undefined;
|
|
83573
|
-
|
|
83574
|
-
_wrapNativeSuper = function _wrapNativeSuper(Class) {
|
|
83575
|
-
if (Class === null || !_isNativeFunction(Class)) return Class;
|
|
83576
|
-
|
|
83577
|
-
if (typeof Class !== "function") {
|
|
83578
|
-
throw new TypeError("Super expression must either be null or a function");
|
|
83579
|
-
}
|
|
83580
|
-
|
|
83581
|
-
if (typeof _cache !== "undefined") {
|
|
83582
|
-
if (_cache.has(Class)) return _cache.get(Class);
|
|
83583
|
-
|
|
83584
|
-
_cache.set(Class, Wrapper);
|
|
83585
|
-
}
|
|
83586
|
-
|
|
83587
|
-
function Wrapper() {
|
|
83588
|
-
return _construct(Class, arguments, _getPrototypeOf(this).constructor);
|
|
83589
|
-
}
|
|
83590
|
-
|
|
83591
|
-
Wrapper.prototype = Object.create(Class.prototype, {
|
|
83592
|
-
constructor: {
|
|
83593
|
-
value: Wrapper,
|
|
83594
|
-
enumerable: false,
|
|
83595
|
-
writable: true,
|
|
83596
|
-
configurable: true
|
|
83597
|
-
}
|
|
83598
|
-
});
|
|
83599
|
-
return _setPrototypeOf(Wrapper, Class);
|
|
83600
|
-
};
|
|
83601
|
-
|
|
83602
|
-
return _wrapNativeSuper(Class);
|
|
83603
|
-
}
|
|
83604
|
-
|
|
83605
|
-
function _assertThisInitialized(self) {
|
|
83606
|
-
if (self === void 0) {
|
|
83607
|
-
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
83608
|
-
}
|
|
83609
|
-
|
|
83610
|
-
return self;
|
|
83611
|
-
}
|
|
83612
|
-
|
|
83613
|
-
var _ref, _Symbol$asyncIterator;
|
|
83614
|
-
|
|
83615
|
-
/* eslint-disable unicorn/custom-error-definition, promise/always-return */
|
|
83616
|
-
|
|
83617
|
-
/* global setImmediate:false, clearImmediate:false */
|
|
83618
|
-
var symbolAsyncIterator = (_ref = (_Symbol$asyncIterator = Symbol == null ? void 0 : Symbol.asyncIterator) != null ? _Symbol$asyncIterator : Symbol == null ? void 0 : Symbol.iterator) != null ? _ref : '@@asyncIterator';
|
|
83619
|
-
|
|
83620
|
-
var ERR_INVALID_ARG_TYPE = /*#__PURE__*/function (_Error) {
|
|
83621
|
-
_inheritsLoose(ERR_INVALID_ARG_TYPE, _Error);
|
|
83622
|
-
|
|
83623
|
-
function ERR_INVALID_ARG_TYPE(name, expected, actual) {
|
|
83624
|
-
var _this;
|
|
83625
|
-
|
|
83626
|
-
_this = _Error.call(this, name + " must be " + expected + ", " + typeof actual + " given") || this;
|
|
83627
|
-
_this.name = _this.constructor.name;
|
|
83628
|
-
_this.message = name + " must be " + expected + ", " + typeof actual + " given";
|
|
83629
|
-
|
|
83630
|
-
if (typeof Error.captureStackTrace === 'function') {
|
|
83631
|
-
Error.captureStackTrace(_assertThisInitialized(_this), _this.constructor);
|
|
83632
|
-
} else {
|
|
83633
|
-
_this.stack = new Error(name + " must be " + expected + ", " + typeof actual + " given").stack;
|
|
83634
|
-
}
|
|
83635
|
-
|
|
83636
|
-
_this.code = 'ERR_INVALID_ARG_TYPE';
|
|
83637
|
-
return _this;
|
|
83638
|
-
}
|
|
83639
|
-
|
|
83640
|
-
return ERR_INVALID_ARG_TYPE;
|
|
83641
|
-
}( /*#__PURE__*/_wrapNativeSuper(Error));
|
|
83642
|
-
|
|
83643
|
-
var AbortError$1 = /*#__PURE__*/function (_Error2) {
|
|
83644
|
-
_inheritsLoose(AbortError, _Error2);
|
|
83645
|
-
|
|
83646
|
-
function AbortError() {
|
|
83647
|
-
var _this2;
|
|
83648
|
-
|
|
83649
|
-
_this2 = _Error2.call(this, 'The operation was aborted') || this;
|
|
83650
|
-
_this2.name = _this2.constructor.name;
|
|
83651
|
-
_this2.message = 'The operation was aborted';
|
|
83652
|
-
|
|
83653
|
-
if (typeof Error.captureStackTrace === 'function') {
|
|
83654
|
-
Error.captureStackTrace(_assertThisInitialized(_this2), _this2.constructor);
|
|
83655
|
-
} else {
|
|
83656
|
-
_this2.stack = new Error('The operation was aborted').stack;
|
|
83657
|
-
}
|
|
83658
|
-
|
|
83659
|
-
_this2.code = 'ABORT_ERR';
|
|
83660
|
-
return _this2;
|
|
83661
|
-
}
|
|
83662
|
-
|
|
83663
|
-
return AbortError;
|
|
83664
|
-
}( /*#__PURE__*/_wrapNativeSuper(Error));
|
|
83665
|
-
|
|
83666
|
-
function validateObject(object, name) {
|
|
83667
|
-
if (object === null || typeof object !== 'object') {
|
|
83668
|
-
throw new ERR_INVALID_ARG_TYPE(name, 'Object', object);
|
|
83669
|
-
}
|
|
83670
|
-
}
|
|
83671
|
-
|
|
83672
|
-
function validateBoolean(value, name) {
|
|
83673
|
-
if (typeof value !== 'boolean') {
|
|
83674
|
-
throw new ERR_INVALID_ARG_TYPE(name, 'boolean', value);
|
|
83675
|
-
}
|
|
83676
|
-
}
|
|
83677
|
-
|
|
83678
|
-
function validateAbortSignal(signal, name) {
|
|
83679
|
-
if (typeof signal !== 'undefined' && (signal === null || typeof signal !== 'object' || !('aborted' in signal))) {
|
|
83680
|
-
throw new ERR_INVALID_ARG_TYPE(name, 'AbortSignal', signal);
|
|
83681
|
-
}
|
|
83682
|
-
}
|
|
83683
|
-
|
|
83684
|
-
function asyncIterator(_ref2) {
|
|
83685
|
-
var nextFunction = _ref2.next,
|
|
83686
|
-
returnFunction = _ref2["return"];
|
|
83687
|
-
var result = {};
|
|
83688
|
-
|
|
83689
|
-
if (typeof nextFunction === 'function') {
|
|
83690
|
-
result.next = nextFunction;
|
|
83691
|
-
}
|
|
83692
|
-
|
|
83693
|
-
if (typeof returnFunction === 'function') {
|
|
83694
|
-
result["return"] = returnFunction;
|
|
83695
|
-
}
|
|
83696
|
-
|
|
83697
|
-
result[symbolAsyncIterator] = function () {
|
|
83698
|
-
return this;
|
|
83699
|
-
};
|
|
83700
|
-
|
|
83701
|
-
return result;
|
|
83702
|
-
}
|
|
83703
|
-
|
|
83704
|
-
function setTimeoutPromise(after, value, options) {
|
|
83705
|
-
if (after === void 0) {
|
|
83706
|
-
after = 1;
|
|
83707
|
-
}
|
|
83708
|
-
|
|
83709
|
-
if (options === void 0) {
|
|
83710
|
-
options = {};
|
|
83711
|
-
}
|
|
83712
|
-
|
|
83713
|
-
var arguments_ = [].concat(value != null ? value : []);
|
|
83714
|
-
|
|
83715
|
-
try {
|
|
83716
|
-
validateObject(options, 'options');
|
|
83717
|
-
} catch (error) {
|
|
83718
|
-
return Promise.reject(error);
|
|
83719
|
-
}
|
|
83720
|
-
|
|
83721
|
-
var _options = options,
|
|
83722
|
-
signal = _options.signal,
|
|
83723
|
-
_options$ref = _options.ref,
|
|
83724
|
-
reference = _options$ref === void 0 ? true : _options$ref;
|
|
83725
|
-
|
|
83726
|
-
try {
|
|
83727
|
-
validateAbortSignal(signal, 'options.signal');
|
|
83728
|
-
} catch (error) {
|
|
83729
|
-
return Promise.reject(error);
|
|
83730
|
-
}
|
|
83731
|
-
|
|
83732
|
-
try {
|
|
83733
|
-
validateBoolean(reference, 'options.ref');
|
|
83734
|
-
} catch (error) {
|
|
83735
|
-
return Promise.reject(error);
|
|
83736
|
-
}
|
|
83737
|
-
|
|
83738
|
-
if (signal != null && signal.aborted) {
|
|
83739
|
-
return Promise.reject(new AbortError$1());
|
|
83740
|
-
}
|
|
83741
|
-
|
|
83742
|
-
var onCancel;
|
|
83743
|
-
var returnValue = new Promise(function (resolve, reject) {
|
|
83744
|
-
var timeout = setTimeout.apply(void 0, [function () {
|
|
83745
|
-
return resolve(value);
|
|
83746
|
-
}, after].concat(arguments_));
|
|
83747
|
-
|
|
83748
|
-
if (!reference) {
|
|
83749
|
-
timeout == null ? void 0 : timeout.unref == null ? void 0 : timeout.unref();
|
|
83750
|
-
}
|
|
83751
|
-
|
|
83752
|
-
if (signal) {
|
|
83753
|
-
onCancel = function onCancel() {
|
|
83754
|
-
clearTimeout(timeout);
|
|
83755
|
-
reject(new AbortError$1());
|
|
83756
|
-
};
|
|
83757
|
-
|
|
83758
|
-
signal.addEventListener('abort', onCancel);
|
|
83759
|
-
}
|
|
83760
|
-
});
|
|
83761
|
-
|
|
83762
|
-
if (typeof onCancel !== 'undefined') {
|
|
83763
|
-
returnValue["finally"](function () {
|
|
83764
|
-
return signal.removeEventListener('abort', onCancel);
|
|
83765
|
-
});
|
|
83766
|
-
}
|
|
83767
|
-
|
|
83768
|
-
return returnValue;
|
|
83769
|
-
}
|
|
83770
|
-
|
|
83771
|
-
function setImmediatePromise(value, options) {
|
|
83772
|
-
if (options === void 0) {
|
|
83773
|
-
options = {};
|
|
83774
|
-
}
|
|
83775
|
-
|
|
83776
|
-
try {
|
|
83777
|
-
validateObject(options, 'options');
|
|
83778
|
-
} catch (error) {
|
|
83779
|
-
return Promise.reject(error);
|
|
83780
|
-
}
|
|
83781
|
-
|
|
83782
|
-
var _options2 = options,
|
|
83783
|
-
signal = _options2.signal,
|
|
83784
|
-
_options2$ref = _options2.ref,
|
|
83785
|
-
reference = _options2$ref === void 0 ? true : _options2$ref;
|
|
83786
|
-
|
|
83787
|
-
try {
|
|
83788
|
-
validateAbortSignal(signal, 'options.signal');
|
|
83789
|
-
} catch (error) {
|
|
83790
|
-
return Promise.reject(error);
|
|
83791
|
-
}
|
|
83792
|
-
|
|
83793
|
-
try {
|
|
83794
|
-
validateBoolean(reference, 'options.ref');
|
|
83795
|
-
} catch (error) {
|
|
83796
|
-
return Promise.reject(error);
|
|
83797
|
-
}
|
|
83798
|
-
|
|
83799
|
-
if (signal != null && signal.aborted) {
|
|
83800
|
-
return Promise.reject(new AbortError$1());
|
|
83801
|
-
}
|
|
83802
|
-
|
|
83803
|
-
var onCancel;
|
|
83804
|
-
var returnValue = new Promise(function (resolve, reject) {
|
|
83805
|
-
var immediate = setImmediate(function () {
|
|
83806
|
-
return resolve(value);
|
|
83807
|
-
});
|
|
83808
|
-
|
|
83809
|
-
if (!reference) {
|
|
83810
|
-
immediate == null ? void 0 : immediate.unref == null ? void 0 : immediate.unref();
|
|
83811
|
-
}
|
|
83812
|
-
|
|
83813
|
-
if (signal) {
|
|
83814
|
-
onCancel = function onCancel() {
|
|
83815
|
-
clearImmediate(immediate);
|
|
83816
|
-
reject(new AbortError$1());
|
|
83817
|
-
};
|
|
83818
|
-
|
|
83819
|
-
signal.addEventListener('abort', onCancel);
|
|
83820
|
-
}
|
|
83821
|
-
});
|
|
83822
|
-
|
|
83823
|
-
if (typeof onCancel !== 'undefined') {
|
|
83824
|
-
returnValue["finally"](function () {
|
|
83825
|
-
return signal.removeEventListener('abort', onCancel);
|
|
83826
|
-
});
|
|
83827
|
-
}
|
|
83828
|
-
|
|
83829
|
-
return returnValue;
|
|
83830
|
-
}
|
|
83831
|
-
|
|
83832
|
-
function setIntervalPromise(after, value, options) {
|
|
83833
|
-
if (after === void 0) {
|
|
83834
|
-
after = 1;
|
|
83835
|
-
}
|
|
83836
|
-
|
|
83837
|
-
if (options === void 0) {
|
|
83838
|
-
options = {};
|
|
83839
|
-
}
|
|
83840
|
-
|
|
83841
|
-
/* eslint-disable no-undefined, no-unreachable-loop, no-loop-func */
|
|
83842
|
-
try {
|
|
83843
|
-
validateObject(options, 'options');
|
|
83844
|
-
} catch (error) {
|
|
83845
|
-
return asyncIterator({
|
|
83846
|
-
next: function next() {
|
|
83847
|
-
return Promise.reject(error);
|
|
83848
|
-
}
|
|
83849
|
-
});
|
|
83850
|
-
}
|
|
83851
|
-
|
|
83852
|
-
var _options3 = options,
|
|
83853
|
-
signal = _options3.signal,
|
|
83854
|
-
_options3$ref = _options3.ref,
|
|
83855
|
-
reference = _options3$ref === void 0 ? true : _options3$ref;
|
|
83856
|
-
|
|
83857
|
-
try {
|
|
83858
|
-
validateAbortSignal(signal, 'options.signal');
|
|
83859
|
-
} catch (error) {
|
|
83860
|
-
return asyncIterator({
|
|
83861
|
-
next: function next() {
|
|
83862
|
-
return Promise.reject(error);
|
|
83863
|
-
}
|
|
83864
|
-
});
|
|
83865
|
-
}
|
|
83866
|
-
|
|
83867
|
-
try {
|
|
83868
|
-
validateBoolean(reference, 'options.ref');
|
|
83869
|
-
} catch (error) {
|
|
83870
|
-
return asyncIterator({
|
|
83871
|
-
next: function next() {
|
|
83872
|
-
return Promise.reject(error);
|
|
83873
|
-
}
|
|
83874
|
-
});
|
|
83875
|
-
}
|
|
83876
|
-
|
|
83877
|
-
if (signal != null && signal.aborted) {
|
|
83878
|
-
return asyncIterator({
|
|
83879
|
-
next: function next() {
|
|
83880
|
-
return Promise.reject(new AbortError$1());
|
|
83881
|
-
}
|
|
83882
|
-
});
|
|
83883
|
-
}
|
|
83884
|
-
|
|
83885
|
-
var onCancel, interval;
|
|
83886
|
-
|
|
83887
|
-
try {
|
|
83888
|
-
var notYielded = 0;
|
|
83889
|
-
var callback;
|
|
83890
|
-
interval = setInterval(function () {
|
|
83891
|
-
notYielded++;
|
|
83892
|
-
|
|
83893
|
-
if (callback) {
|
|
83894
|
-
callback();
|
|
83895
|
-
callback = undefined;
|
|
83896
|
-
}
|
|
83897
|
-
}, after);
|
|
83898
|
-
|
|
83899
|
-
if (!reference) {
|
|
83900
|
-
var _interval;
|
|
83901
|
-
|
|
83902
|
-
(_interval = interval) == null ? void 0 : _interval.unref == null ? void 0 : _interval.unref();
|
|
83903
|
-
}
|
|
83904
|
-
|
|
83905
|
-
if (signal) {
|
|
83906
|
-
onCancel = function onCancel() {
|
|
83907
|
-
clearInterval(interval);
|
|
83908
|
-
|
|
83909
|
-
if (callback) {
|
|
83910
|
-
callback();
|
|
83911
|
-
callback = undefined;
|
|
83912
|
-
}
|
|
83913
|
-
};
|
|
83914
|
-
|
|
83915
|
-
signal.addEventListener('abort', onCancel);
|
|
83916
|
-
}
|
|
83917
|
-
|
|
83918
|
-
return asyncIterator({
|
|
83919
|
-
next: function next() {
|
|
83920
|
-
return new Promise(function (resolve, reject) {
|
|
83921
|
-
if (!(signal != null && signal.aborted)) {
|
|
83922
|
-
if (notYielded === 0) {
|
|
83923
|
-
callback = resolve;
|
|
83924
|
-
} else {
|
|
83925
|
-
resolve();
|
|
83926
|
-
}
|
|
83927
|
-
} else if (notYielded === 0) {
|
|
83928
|
-
reject(new AbortError$1());
|
|
83929
|
-
} else {
|
|
83930
|
-
resolve();
|
|
83931
|
-
}
|
|
83932
|
-
}).then(function () {
|
|
83933
|
-
if (notYielded > 0) {
|
|
83934
|
-
notYielded = notYielded - 1;
|
|
83935
|
-
return {
|
|
83936
|
-
done: false,
|
|
83937
|
-
value: value
|
|
83938
|
-
};
|
|
83939
|
-
}
|
|
83940
|
-
|
|
83941
|
-
return {
|
|
83942
|
-
done: true
|
|
83943
|
-
};
|
|
83944
|
-
});
|
|
83945
|
-
},
|
|
83946
|
-
"return": function _return() {
|
|
83947
|
-
clearInterval(interval);
|
|
83948
|
-
signal == null ? void 0 : signal.removeEventListener('abort', onCancel);
|
|
83949
|
-
return Promise.resolve({});
|
|
83950
|
-
}
|
|
83951
|
-
});
|
|
83952
|
-
} catch (error) {
|
|
83953
|
-
return asyncIterator({
|
|
83954
|
-
next: function next() {
|
|
83955
|
-
clearInterval(interval);
|
|
83956
|
-
signal == null ? void 0 : signal.removeEventListener('abort', onCancel);
|
|
83957
|
-
}
|
|
83958
|
-
});
|
|
83959
|
-
}
|
|
83960
|
-
}
|
|
83961
|
-
|
|
83962
|
-
cjs.setImmediate = setImmediatePromise;
|
|
83963
|
-
cjs.setInterval = setIntervalPromise;
|
|
83964
|
-
cjs.setTimeout = setTimeoutPromise;
|
|
83965
|
-
|
|
83966
83069
|
var bufferUtilExports = {};
|
|
83967
83070
|
var bufferUtil$1 = {
|
|
83968
83071
|
get exports(){ return bufferUtilExports; },
|
|
@@ -86450,7 +85553,7 @@ const subprotocolRegex = /^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/;
|
|
|
86450
85553
|
*
|
|
86451
85554
|
* @extends EventEmitter
|
|
86452
85555
|
*/
|
|
86453
|
-
let WebSocket$
|
|
85556
|
+
let WebSocket$1 = class WebSocket extends EventEmitter$1 {
|
|
86454
85557
|
/**
|
|
86455
85558
|
* Create a new `WebSocket`.
|
|
86456
85559
|
*
|
|
@@ -86902,7 +86005,7 @@ let WebSocket$2 = class WebSocket extends EventEmitter$1 {
|
|
|
86902
86005
|
* @constant {Number} CONNECTING
|
|
86903
86006
|
* @memberof WebSocket
|
|
86904
86007
|
*/
|
|
86905
|
-
Object.defineProperty(WebSocket$
|
|
86008
|
+
Object.defineProperty(WebSocket$1, 'CONNECTING', {
|
|
86906
86009
|
enumerable: true,
|
|
86907
86010
|
value: readyStates.indexOf('CONNECTING')
|
|
86908
86011
|
});
|
|
@@ -86911,7 +86014,7 @@ Object.defineProperty(WebSocket$2, 'CONNECTING', {
|
|
|
86911
86014
|
* @constant {Number} CONNECTING
|
|
86912
86015
|
* @memberof WebSocket.prototype
|
|
86913
86016
|
*/
|
|
86914
|
-
Object.defineProperty(WebSocket$
|
|
86017
|
+
Object.defineProperty(WebSocket$1.prototype, 'CONNECTING', {
|
|
86915
86018
|
enumerable: true,
|
|
86916
86019
|
value: readyStates.indexOf('CONNECTING')
|
|
86917
86020
|
});
|
|
@@ -86920,7 +86023,7 @@ Object.defineProperty(WebSocket$2.prototype, 'CONNECTING', {
|
|
|
86920
86023
|
* @constant {Number} OPEN
|
|
86921
86024
|
* @memberof WebSocket
|
|
86922
86025
|
*/
|
|
86923
|
-
Object.defineProperty(WebSocket$
|
|
86026
|
+
Object.defineProperty(WebSocket$1, 'OPEN', {
|
|
86924
86027
|
enumerable: true,
|
|
86925
86028
|
value: readyStates.indexOf('OPEN')
|
|
86926
86029
|
});
|
|
@@ -86929,7 +86032,7 @@ Object.defineProperty(WebSocket$2, 'OPEN', {
|
|
|
86929
86032
|
* @constant {Number} OPEN
|
|
86930
86033
|
* @memberof WebSocket.prototype
|
|
86931
86034
|
*/
|
|
86932
|
-
Object.defineProperty(WebSocket$
|
|
86035
|
+
Object.defineProperty(WebSocket$1.prototype, 'OPEN', {
|
|
86933
86036
|
enumerable: true,
|
|
86934
86037
|
value: readyStates.indexOf('OPEN')
|
|
86935
86038
|
});
|
|
@@ -86938,7 +86041,7 @@ Object.defineProperty(WebSocket$2.prototype, 'OPEN', {
|
|
|
86938
86041
|
* @constant {Number} CLOSING
|
|
86939
86042
|
* @memberof WebSocket
|
|
86940
86043
|
*/
|
|
86941
|
-
Object.defineProperty(WebSocket$
|
|
86044
|
+
Object.defineProperty(WebSocket$1, 'CLOSING', {
|
|
86942
86045
|
enumerable: true,
|
|
86943
86046
|
value: readyStates.indexOf('CLOSING')
|
|
86944
86047
|
});
|
|
@@ -86947,7 +86050,7 @@ Object.defineProperty(WebSocket$2, 'CLOSING', {
|
|
|
86947
86050
|
* @constant {Number} CLOSING
|
|
86948
86051
|
* @memberof WebSocket.prototype
|
|
86949
86052
|
*/
|
|
86950
|
-
Object.defineProperty(WebSocket$
|
|
86053
|
+
Object.defineProperty(WebSocket$1.prototype, 'CLOSING', {
|
|
86951
86054
|
enumerable: true,
|
|
86952
86055
|
value: readyStates.indexOf('CLOSING')
|
|
86953
86056
|
});
|
|
@@ -86956,7 +86059,7 @@ Object.defineProperty(WebSocket$2.prototype, 'CLOSING', {
|
|
|
86956
86059
|
* @constant {Number} CLOSED
|
|
86957
86060
|
* @memberof WebSocket
|
|
86958
86061
|
*/
|
|
86959
|
-
Object.defineProperty(WebSocket$
|
|
86062
|
+
Object.defineProperty(WebSocket$1, 'CLOSED', {
|
|
86960
86063
|
enumerable: true,
|
|
86961
86064
|
value: readyStates.indexOf('CLOSED')
|
|
86962
86065
|
});
|
|
@@ -86965,7 +86068,7 @@ Object.defineProperty(WebSocket$2, 'CLOSED', {
|
|
|
86965
86068
|
* @constant {Number} CLOSED
|
|
86966
86069
|
* @memberof WebSocket.prototype
|
|
86967
86070
|
*/
|
|
86968
|
-
Object.defineProperty(WebSocket$
|
|
86071
|
+
Object.defineProperty(WebSocket$1.prototype, 'CLOSED', {
|
|
86969
86072
|
enumerable: true,
|
|
86970
86073
|
value: readyStates.indexOf('CLOSED')
|
|
86971
86074
|
});
|
|
@@ -86979,7 +86082,7 @@ Object.defineProperty(WebSocket$2.prototype, 'CLOSED', {
|
|
|
86979
86082
|
'readyState',
|
|
86980
86083
|
'url'
|
|
86981
86084
|
].forEach((property) => {
|
|
86982
|
-
Object.defineProperty(WebSocket$
|
|
86085
|
+
Object.defineProperty(WebSocket$1.prototype, property, { enumerable: true });
|
|
86983
86086
|
});
|
|
86984
86087
|
|
|
86985
86088
|
//
|
|
@@ -86987,7 +86090,7 @@ Object.defineProperty(WebSocket$2.prototype, 'CLOSED', {
|
|
|
86987
86090
|
// See https://html.spec.whatwg.org/multipage/comms.html#the-websocket-interface
|
|
86988
86091
|
//
|
|
86989
86092
|
['open', 'error', 'close', 'message'].forEach((method) => {
|
|
86990
|
-
Object.defineProperty(WebSocket$
|
|
86093
|
+
Object.defineProperty(WebSocket$1.prototype, `on${method}`, {
|
|
86991
86094
|
enumerable: true,
|
|
86992
86095
|
get() {
|
|
86993
86096
|
for (const listener of this.listeners(method)) {
|
|
@@ -87013,10 +86116,10 @@ Object.defineProperty(WebSocket$2.prototype, 'CLOSED', {
|
|
|
87013
86116
|
});
|
|
87014
86117
|
});
|
|
87015
86118
|
|
|
87016
|
-
WebSocket$
|
|
87017
|
-
WebSocket$
|
|
86119
|
+
WebSocket$1.prototype.addEventListener = addEventListener;
|
|
86120
|
+
WebSocket$1.prototype.removeEventListener = removeEventListener;
|
|
87018
86121
|
|
|
87019
|
-
var websocket = WebSocket$
|
|
86122
|
+
var websocket = WebSocket$1;
|
|
87020
86123
|
|
|
87021
86124
|
/**
|
|
87022
86125
|
* Initialize a WebSocket client.
|
|
@@ -87309,7 +86412,7 @@ function initAsClient(websocket, address, protocols, options) {
|
|
|
87309
86412
|
// The user may have closed the connection from a listener of the
|
|
87310
86413
|
// `'upgrade'` event.
|
|
87311
86414
|
//
|
|
87312
|
-
if (websocket.readyState !== WebSocket$
|
|
86415
|
+
if (websocket.readyState !== WebSocket$1.CONNECTING) return;
|
|
87313
86416
|
|
|
87314
86417
|
req = websocket._req = null;
|
|
87315
86418
|
|
|
@@ -87409,7 +86512,7 @@ function initAsClient(websocket, address, protocols, options) {
|
|
|
87409
86512
|
* @private
|
|
87410
86513
|
*/
|
|
87411
86514
|
function emitErrorAndClose(websocket, err) {
|
|
87412
|
-
websocket._readyState = WebSocket$
|
|
86515
|
+
websocket._readyState = WebSocket$1.CLOSING;
|
|
87413
86516
|
websocket.emit('error', err);
|
|
87414
86517
|
websocket.emitClose();
|
|
87415
86518
|
}
|
|
@@ -87453,7 +86556,7 @@ function tlsConnect(options) {
|
|
|
87453
86556
|
* @private
|
|
87454
86557
|
*/
|
|
87455
86558
|
function abortHandshake$1(websocket, stream, message) {
|
|
87456
|
-
websocket._readyState = WebSocket$
|
|
86559
|
+
websocket._readyState = WebSocket$1.CLOSING;
|
|
87457
86560
|
|
|
87458
86561
|
const err = new Error(message);
|
|
87459
86562
|
Error.captureStackTrace(err, abortHandshake$1);
|
|
@@ -87634,7 +86737,7 @@ function socketOnClose() {
|
|
|
87634
86737
|
this.removeListener('data', socketOnData);
|
|
87635
86738
|
this.removeListener('end', socketOnEnd);
|
|
87636
86739
|
|
|
87637
|
-
websocket._readyState = WebSocket$
|
|
86740
|
+
websocket._readyState = WebSocket$1.CLOSING;
|
|
87638
86741
|
|
|
87639
86742
|
let chunk;
|
|
87640
86743
|
|
|
@@ -87693,7 +86796,7 @@ function socketOnData(chunk) {
|
|
|
87693
86796
|
function socketOnEnd() {
|
|
87694
86797
|
const websocket = this[kWebSocket$1];
|
|
87695
86798
|
|
|
87696
|
-
websocket._readyState = WebSocket$
|
|
86799
|
+
websocket._readyState = WebSocket$1.CLOSING;
|
|
87697
86800
|
websocket._receiver.end();
|
|
87698
86801
|
this.end();
|
|
87699
86802
|
}
|
|
@@ -87710,169 +86813,11 @@ function socketOnError$1() {
|
|
|
87710
86813
|
this.on('error', NOOP);
|
|
87711
86814
|
|
|
87712
86815
|
if (websocket) {
|
|
87713
|
-
websocket._readyState = WebSocket$
|
|
87714
|
-
this.destroy();
|
|
87715
|
-
}
|
|
87716
|
-
}
|
|
87717
|
-
|
|
87718
|
-
const { Duplex } = Stream$7;
|
|
87719
|
-
|
|
87720
|
-
/**
|
|
87721
|
-
* Emits the `'close'` event on a stream.
|
|
87722
|
-
*
|
|
87723
|
-
* @param {Duplex} stream The stream.
|
|
87724
|
-
* @private
|
|
87725
|
-
*/
|
|
87726
|
-
function emitClose$1(stream) {
|
|
87727
|
-
stream.emit('close');
|
|
87728
|
-
}
|
|
87729
|
-
|
|
87730
|
-
/**
|
|
87731
|
-
* The listener of the `'end'` event.
|
|
87732
|
-
*
|
|
87733
|
-
* @private
|
|
87734
|
-
*/
|
|
87735
|
-
function duplexOnEnd() {
|
|
87736
|
-
if (!this.destroyed && this._writableState.finished) {
|
|
86816
|
+
websocket._readyState = WebSocket$1.CLOSING;
|
|
87737
86817
|
this.destroy();
|
|
87738
86818
|
}
|
|
87739
86819
|
}
|
|
87740
86820
|
|
|
87741
|
-
/**
|
|
87742
|
-
* The listener of the `'error'` event.
|
|
87743
|
-
*
|
|
87744
|
-
* @param {Error} err The error
|
|
87745
|
-
* @private
|
|
87746
|
-
*/
|
|
87747
|
-
function duplexOnError(err) {
|
|
87748
|
-
this.removeListener('error', duplexOnError);
|
|
87749
|
-
this.destroy();
|
|
87750
|
-
if (this.listenerCount('error') === 0) {
|
|
87751
|
-
// Do not suppress the throwing behavior.
|
|
87752
|
-
this.emit('error', err);
|
|
87753
|
-
}
|
|
87754
|
-
}
|
|
87755
|
-
|
|
87756
|
-
/**
|
|
87757
|
-
* Wraps a `WebSocket` in a duplex stream.
|
|
87758
|
-
*
|
|
87759
|
-
* @param {WebSocket} ws The `WebSocket` to wrap
|
|
87760
|
-
* @param {Object} [options] The options for the `Duplex` constructor
|
|
87761
|
-
* @return {Duplex} The duplex stream
|
|
87762
|
-
* @public
|
|
87763
|
-
*/
|
|
87764
|
-
function createWebSocketStream(ws, options) {
|
|
87765
|
-
let terminateOnDestroy = true;
|
|
87766
|
-
|
|
87767
|
-
const duplex = new Duplex({
|
|
87768
|
-
...options,
|
|
87769
|
-
autoDestroy: false,
|
|
87770
|
-
emitClose: false,
|
|
87771
|
-
objectMode: false,
|
|
87772
|
-
writableObjectMode: false
|
|
87773
|
-
});
|
|
87774
|
-
|
|
87775
|
-
ws.on('message', function message(msg, isBinary) {
|
|
87776
|
-
const data =
|
|
87777
|
-
!isBinary && duplex._readableState.objectMode ? msg.toString() : msg;
|
|
87778
|
-
|
|
87779
|
-
if (!duplex.push(data)) ws.pause();
|
|
87780
|
-
});
|
|
87781
|
-
|
|
87782
|
-
ws.once('error', function error(err) {
|
|
87783
|
-
if (duplex.destroyed) return;
|
|
87784
|
-
|
|
87785
|
-
// Prevent `ws.terminate()` from being called by `duplex._destroy()`.
|
|
87786
|
-
//
|
|
87787
|
-
// - If the `'error'` event is emitted before the `'open'` event, then
|
|
87788
|
-
// `ws.terminate()` is a noop as no socket is assigned.
|
|
87789
|
-
// - Otherwise, the error is re-emitted by the listener of the `'error'`
|
|
87790
|
-
// event of the `Receiver` object. The listener already closes the
|
|
87791
|
-
// connection by calling `ws.close()`. This allows a close frame to be
|
|
87792
|
-
// sent to the other peer. If `ws.terminate()` is called right after this,
|
|
87793
|
-
// then the close frame might not be sent.
|
|
87794
|
-
terminateOnDestroy = false;
|
|
87795
|
-
duplex.destroy(err);
|
|
87796
|
-
});
|
|
87797
|
-
|
|
87798
|
-
ws.once('close', function close() {
|
|
87799
|
-
if (duplex.destroyed) return;
|
|
87800
|
-
|
|
87801
|
-
duplex.push(null);
|
|
87802
|
-
});
|
|
87803
|
-
|
|
87804
|
-
duplex._destroy = function (err, callback) {
|
|
87805
|
-
if (ws.readyState === ws.CLOSED) {
|
|
87806
|
-
callback(err);
|
|
87807
|
-
process.nextTick(emitClose$1, duplex);
|
|
87808
|
-
return;
|
|
87809
|
-
}
|
|
87810
|
-
|
|
87811
|
-
let called = false;
|
|
87812
|
-
|
|
87813
|
-
ws.once('error', function error(err) {
|
|
87814
|
-
called = true;
|
|
87815
|
-
callback(err);
|
|
87816
|
-
});
|
|
87817
|
-
|
|
87818
|
-
ws.once('close', function close() {
|
|
87819
|
-
if (!called) callback(err);
|
|
87820
|
-
process.nextTick(emitClose$1, duplex);
|
|
87821
|
-
});
|
|
87822
|
-
|
|
87823
|
-
if (terminateOnDestroy) ws.terminate();
|
|
87824
|
-
};
|
|
87825
|
-
|
|
87826
|
-
duplex._final = function (callback) {
|
|
87827
|
-
if (ws.readyState === ws.CONNECTING) {
|
|
87828
|
-
ws.once('open', function open() {
|
|
87829
|
-
duplex._final(callback);
|
|
87830
|
-
});
|
|
87831
|
-
return;
|
|
87832
|
-
}
|
|
87833
|
-
|
|
87834
|
-
// If the value of the `_socket` property is `null` it means that `ws` is a
|
|
87835
|
-
// client websocket and the handshake failed. In fact, when this happens, a
|
|
87836
|
-
// socket is never assigned to the websocket. Wait for the `'error'` event
|
|
87837
|
-
// that will be emitted by the websocket.
|
|
87838
|
-
if (ws._socket === null) return;
|
|
87839
|
-
|
|
87840
|
-
if (ws._socket._writableState.finished) {
|
|
87841
|
-
callback();
|
|
87842
|
-
if (duplex._readableState.endEmitted) duplex.destroy();
|
|
87843
|
-
} else {
|
|
87844
|
-
ws._socket.once('finish', function finish() {
|
|
87845
|
-
// `duplex` is not destroyed here because the `'end'` event will be
|
|
87846
|
-
// emitted on `duplex` after this `'finish'` event. The EOF signaling
|
|
87847
|
-
// `null` chunk is, in fact, pushed when the websocket emits `'close'`.
|
|
87848
|
-
callback();
|
|
87849
|
-
});
|
|
87850
|
-
ws.close();
|
|
87851
|
-
}
|
|
87852
|
-
};
|
|
87853
|
-
|
|
87854
|
-
duplex._read = function () {
|
|
87855
|
-
if (ws.isPaused) ws.resume();
|
|
87856
|
-
};
|
|
87857
|
-
|
|
87858
|
-
duplex._write = function (chunk, encoding, callback) {
|
|
87859
|
-
if (ws.readyState === ws.CONNECTING) {
|
|
87860
|
-
ws.once('open', function open() {
|
|
87861
|
-
duplex._write(chunk, encoding, callback);
|
|
87862
|
-
});
|
|
87863
|
-
return;
|
|
87864
|
-
}
|
|
87865
|
-
|
|
87866
|
-
ws.send(chunk, callback);
|
|
87867
|
-
};
|
|
87868
|
-
|
|
87869
|
-
duplex.on('end', duplexOnEnd);
|
|
87870
|
-
duplex.on('error', duplexOnError);
|
|
87871
|
-
return duplex;
|
|
87872
|
-
}
|
|
87873
|
-
|
|
87874
|
-
var stream$1 = createWebSocketStream;
|
|
87875
|
-
|
|
87876
86821
|
const { tokenChars } = validationExports;
|
|
87877
86822
|
|
|
87878
86823
|
/**
|
|
@@ -87943,7 +86888,7 @@ const { createHash } = require$$0$a;
|
|
|
87943
86888
|
const extension = extension$1;
|
|
87944
86889
|
const PerMessageDeflate = permessageDeflate;
|
|
87945
86890
|
const subprotocol = subprotocol$1;
|
|
87946
|
-
const WebSocket
|
|
86891
|
+
const WebSocket = websocket;
|
|
87947
86892
|
const { GUID, kWebSocket } = constants;
|
|
87948
86893
|
|
|
87949
86894
|
const keyRegex = /^[+/0-9A-Za-z]{22}==$/;
|
|
@@ -88000,7 +86945,7 @@ class WebSocketServer extends EventEmitter {
|
|
|
88000
86945
|
host: null,
|
|
88001
86946
|
path: null,
|
|
88002
86947
|
port: null,
|
|
88003
|
-
WebSocket
|
|
86948
|
+
WebSocket,
|
|
88004
86949
|
...options
|
|
88005
86950
|
};
|
|
88006
86951
|
|
|
@@ -88465,18 +87410,6 @@ function abortHandshakeOrEmitwsClientError(server, req, socket, code, message) {
|
|
|
88465
87410
|
}
|
|
88466
87411
|
}
|
|
88467
87412
|
|
|
88468
|
-
const WebSocket = websocket;
|
|
88469
|
-
|
|
88470
|
-
WebSocket.createWebSocketStream = stream$1;
|
|
88471
|
-
WebSocket.Server = websocketServer;
|
|
88472
|
-
WebSocket.Receiver = receiver;
|
|
88473
|
-
WebSocket.Sender = sender;
|
|
88474
|
-
|
|
88475
|
-
WebSocket.WebSocket = WebSocket;
|
|
88476
|
-
WebSocket.WebSocketServer = WebSocket.Server;
|
|
88477
|
-
|
|
88478
|
-
var ws = WebSocket;
|
|
88479
|
-
|
|
88480
87413
|
// Integer Utility
|
|
88481
87414
|
var UINT32_MAX = 4294967295;
|
|
88482
87415
|
function setInt64(view, offset, value) {
|
|
@@ -89817,6 +88750,7 @@ var ipaddr = {
|
|
|
89817
88750
|
[new IPv4([192, 0, 0, 0]), 24],
|
|
89818
88751
|
[new IPv4([192, 0, 2, 0]), 24],
|
|
89819
88752
|
[new IPv4([192, 88, 99, 0]), 24],
|
|
88753
|
+
[new IPv4([198, 18, 0, 0]), 15],
|
|
89820
88754
|
[new IPv4([198, 51, 100, 0]), 24],
|
|
89821
88755
|
[new IPv4([203, 0, 113, 0]), 24],
|
|
89822
88756
|
[new IPv4([240, 0, 0, 0]), 4]
|
|
@@ -90159,7 +89093,12 @@ var ipaddr = {
|
|
|
90159
89093
|
// RFC6052, RFC6146
|
|
90160
89094
|
teredo: [new IPv6([0x2001, 0, 0, 0, 0, 0, 0, 0]), 32],
|
|
90161
89095
|
// RFC4291
|
|
90162
|
-
reserved: [[new IPv6([0x2001, 0xdb8, 0, 0, 0, 0, 0, 0]), 32]]
|
|
89096
|
+
reserved: [[new IPv6([0x2001, 0xdb8, 0, 0, 0, 0, 0, 0]), 32]],
|
|
89097
|
+
benchmarking: [new IPv6([0x2001, 0x2, 0, 0, 0, 0, 0, 0]), 48],
|
|
89098
|
+
amt: [new IPv6([0x2001, 0x3, 0, 0, 0, 0, 0, 0]), 32],
|
|
89099
|
+
as112v6: [new IPv6([0x2001, 0x4, 0x112, 0, 0, 0, 0, 0]), 48],
|
|
89100
|
+
deprecated: [new IPv6([0x2001, 0x10, 0, 0, 0, 0, 0, 0]), 28],
|
|
89101
|
+
orchid2: [new IPv6([0x2001, 0x20, 0, 0, 0, 0, 0, 0]), 28]
|
|
90163
89102
|
};
|
|
90164
89103
|
|
|
90165
89104
|
// Checks if this address is an IPv4-mapped IPv6 address.
|
|
@@ -90344,11 +89283,9 @@ var ipaddr = {
|
|
|
90344
89283
|
|
|
90345
89284
|
// Returns the address in compact, human-readable format like
|
|
90346
89285
|
// 2001:db8:8:66::1
|
|
90347
|
-
//
|
|
90348
|
-
// Deprecated: use toRFC5952String() instead.
|
|
89286
|
+
// Calls toRFC5952String under the hood.
|
|
90349
89287
|
IPv6.prototype.toString = function () {
|
|
90350
|
-
|
|
90351
|
-
return this.toNormalizedString().replace(/((^|:)(0(:|$))+)/, '::');
|
|
89288
|
+
return this.toRFC5952String();
|
|
90352
89289
|
};
|
|
90353
89290
|
|
|
90354
89291
|
return IPv6;
|
|
@@ -90623,7 +89560,7 @@ async function authServer(username, password) {
|
|
|
90623
89560
|
const res = await handleRequest(readServerPassword(username));
|
|
90624
89561
|
if (res.code || !res.data)
|
|
90625
89562
|
return false;
|
|
90626
|
-
return
|
|
89563
|
+
return Y(password, res.data);
|
|
90627
89564
|
}
|
|
90628
89565
|
function addServer(obj) {
|
|
90629
89566
|
return handleRequest(createServer(obj));
|
|
@@ -90686,10 +89623,11 @@ function setupHeartbeat(io, pingInterval) {
|
|
|
90686
89623
|
}, pingInterval * 1e3);
|
|
90687
89624
|
}
|
|
90688
89625
|
|
|
90689
|
-
const
|
|
90690
|
-
const
|
|
90691
|
-
const
|
|
90692
|
-
const
|
|
89626
|
+
const { getLogger } = log4js_1;
|
|
89627
|
+
const loggerConnected = getLogger("Connected");
|
|
89628
|
+
const loggerConnecting = getLogger("Connecting");
|
|
89629
|
+
const loggerDisconnected = getLogger("Disconnected");
|
|
89630
|
+
const loggerBanned = getLogger("Banned");
|
|
90693
89631
|
function callHook(instance, hook, ...args) {
|
|
90694
89632
|
try {
|
|
90695
89633
|
if (typeof instance[hook] === "function") {
|
|
@@ -90700,15 +89638,23 @@ function callHook(instance, hook, ...args) {
|
|
|
90700
89638
|
}
|
|
90701
89639
|
}
|
|
90702
89640
|
class NodeStatus {
|
|
89641
|
+
options;
|
|
89642
|
+
server;
|
|
89643
|
+
ioPub = new websocketServer({ noServer: true });
|
|
89644
|
+
ioConn = new websocketServer({ noServer: true });
|
|
89645
|
+
/* username -> socket */
|
|
89646
|
+
userMap = /* @__PURE__ */ new Map();
|
|
89647
|
+
/* ip -> banned */
|
|
89648
|
+
isBanned = /* @__PURE__ */ new Map();
|
|
89649
|
+
servers = {};
|
|
89650
|
+
serversPub = [];
|
|
89651
|
+
onServerConnect;
|
|
89652
|
+
onServerBanned;
|
|
89653
|
+
onServerConnected;
|
|
89654
|
+
onServerDisconnected;
|
|
89655
|
+
_serverConnectedPush;
|
|
89656
|
+
_serverDisconnectedPush;
|
|
90703
89657
|
constructor(server, options) {
|
|
90704
|
-
this.ioPub = new ws.Server({ noServer: true });
|
|
90705
|
-
this.ioConn = new ws.Server({ noServer: true });
|
|
90706
|
-
/* username -> socket */
|
|
90707
|
-
this.userMap = /* @__PURE__ */ new Map();
|
|
90708
|
-
/* ip -> banned */
|
|
90709
|
-
this.isBanned = /* @__PURE__ */ new Map();
|
|
90710
|
-
this.servers = {};
|
|
90711
|
-
this.serversPub = [];
|
|
90712
89658
|
this.server = server;
|
|
90713
89659
|
this.options = options;
|
|
90714
89660
|
emitter.on("update", this.updateStatus.bind(this));
|
|
@@ -90729,14 +89675,13 @@ class NodeStatus {
|
|
|
90729
89675
|
this.server.on("upgrade", (request, socket, head) => {
|
|
90730
89676
|
const pathname = request.url;
|
|
90731
89677
|
if (pathname === "/connect") {
|
|
90732
|
-
this.ioConn.handleUpgrade(request, socket, head, (
|
|
90733
|
-
|
|
90734
|
-
|
|
90735
|
-
this.ioConn.emit("connection", ws2);
|
|
89678
|
+
this.ioConn.handleUpgrade(request, socket, head, (ws) => {
|
|
89679
|
+
ws.ipAddress = request.headers["x-forwarded-for"]?.split(",")?.[0]?.trim() || request.socket.remoteAddress;
|
|
89680
|
+
this.ioConn.emit("connection", ws);
|
|
90736
89681
|
});
|
|
90737
89682
|
} else if (pathname === "/public") {
|
|
90738
|
-
this.ioPub.handleUpgrade(request, socket, head, (
|
|
90739
|
-
this.ioPub.emit("connection",
|
|
89683
|
+
this.ioPub.handleUpgrade(request, socket, head, (ws) => {
|
|
89684
|
+
this.ioPub.emit("connection", ws);
|
|
90740
89685
|
});
|
|
90741
89686
|
} else {
|
|
90742
89687
|
socket.destroy();
|
|
@@ -90751,7 +89696,6 @@ class NodeStatus {
|
|
|
90751
89696
|
socket.send("Authentication required");
|
|
90752
89697
|
loggerConnecting.debug(`Address: ${address}`);
|
|
90753
89698
|
socket.once("message", async (buf) => {
|
|
90754
|
-
var _a;
|
|
90755
89699
|
if (this.isBanned.get(address)) {
|
|
90756
89700
|
socket.send("You are banned. Please try connecting after 60 / 120 seconds");
|
|
90757
89701
|
return socket.close();
|
|
@@ -90765,7 +89709,7 @@ class NodeStatus {
|
|
|
90765
89709
|
socket.send("Wrong username and/or password.");
|
|
90766
89710
|
return this.setBan(socket, address, 120, "Wrong username and/or password.");
|
|
90767
89711
|
}
|
|
90768
|
-
if (Object.keys(
|
|
89712
|
+
if (Object.keys(this.servers[username]?.status || {}).length) {
|
|
90769
89713
|
const preSocket = this.userMap.get(username);
|
|
90770
89714
|
if (preSocket) {
|
|
90771
89715
|
if (preSocket.ipAddress === address) {
|
|
@@ -90774,7 +89718,7 @@ class NodeStatus {
|
|
|
90774
89718
|
preSocket.isAlive = false;
|
|
90775
89719
|
preSocket.ping();
|
|
90776
89720
|
const ac = new AbortController();
|
|
90777
|
-
const promise =
|
|
89721
|
+
const promise = timers.setTimeout((pingInterval + 5) * 1e3, null, { signal: ac.signal });
|
|
90778
89722
|
preSocket.on("close", () => ac.abort());
|
|
90779
89723
|
try {
|
|
90780
89724
|
await promise;
|
|
@@ -90795,7 +89739,7 @@ class NodeStatus {
|
|
|
90795
89739
|
}
|
|
90796
89740
|
socket.send("Authentication successful. Access granted.");
|
|
90797
89741
|
let ipType = "IPv6";
|
|
90798
|
-
if (
|
|
89742
|
+
if (isIPv4(address) || ipaddrExports.IPv6.parse(address).isIPv4MappedAddress()) {
|
|
90799
89743
|
ipType = "IPv4";
|
|
90800
89744
|
}
|
|
90801
89745
|
socket.send(`You are connecting via: ${ipType}`);
|
|
@@ -90826,14 +89770,13 @@ class NodeStatus {
|
|
|
90826
89770
|
return this.updateStatus();
|
|
90827
89771
|
}
|
|
90828
89772
|
async updateStatus(username, shouldDisconnect = false) {
|
|
90829
|
-
var _a, _b, _c;
|
|
90830
89773
|
if (username) {
|
|
90831
89774
|
const server = (await getServer(username)).data;
|
|
90832
89775
|
if (!server)
|
|
90833
89776
|
delete this.servers[username];
|
|
90834
89777
|
else
|
|
90835
|
-
this.servers[username] = Object.assign(server, { status:
|
|
90836
|
-
shouldDisconnect &&
|
|
89778
|
+
this.servers[username] = Object.assign(server, { status: this.servers?.[username]?.status || {} });
|
|
89779
|
+
shouldDisconnect && this.userMap.get(username)?.terminate() && this.userMap.delete(username);
|
|
90837
89780
|
} else {
|
|
90838
89781
|
const box = (await getListServers()).data;
|
|
90839
89782
|
if (!box)
|
|
@@ -175168,7 +174111,7 @@ function __rest(s, e) {
|
|
|
175168
174111
|
* Handles Readable streams requests as concatenation through data handling as
|
|
175169
174112
|
* well adding tags it each begin, end and between of the streams
|
|
175170
174113
|
*/
|
|
175171
|
-
class SandwichStream extends
|
|
174114
|
+
class SandwichStream extends Readable$1 {
|
|
175172
174115
|
/**
|
|
175173
174116
|
* Initiates the SandwichStream, you can consider it also passing
|
|
175174
174117
|
* ReadableOptions to it
|
|
@@ -177752,7 +176695,7 @@ function createPush(options) {
|
|
|
177752
176695
|
const parseEntities = (msg) => {
|
|
177753
176696
|
let str;
|
|
177754
176697
|
if (typeof msg !== "string")
|
|
177755
|
-
str =
|
|
176698
|
+
str = msg?.toString() || "";
|
|
177756
176699
|
else
|
|
177757
176700
|
str = msg;
|
|
177758
176701
|
let newStr = "";
|
|
@@ -177806,7 +176749,7 @@ function createPush(options) {
|
|
|
177806
176749
|
${str}`;
|
|
177807
176750
|
};
|
|
177808
176751
|
const tgConfig = options.telegram;
|
|
177809
|
-
if (tgConfig
|
|
176752
|
+
if (tgConfig?.bot_token) {
|
|
177810
176753
|
const bot = new lib$2.Telegraf(tgConfig.bot_token, {
|
|
177811
176754
|
...tgConfig.proxy && {
|
|
177812
176755
|
telegram: {
|
|
@@ -177850,7 +176793,7 @@ Please check your settings\\.`, { parse_mode: "MarkdownV2" });
|
|
|
177850
176793
|
const secretPath = `/telegraf/${bot.secretPathComponent()}`;
|
|
177851
176794
|
bot.telegram.setWebhook(`${tgConfig.web_hook}${secretPath}`).then(() => logger.info("\u{1F916} Telegram Bot is running using webhook"));
|
|
177852
176795
|
this.server.on("request", (req, res) => {
|
|
177853
|
-
if (req.url && req.url.length === secretPath.length &&
|
|
176796
|
+
if (req.url && req.url.length === secretPath.length && timingSafeEqual(Buffer.from(secretPath), Buffer.from(req.url))) {
|
|
177854
176797
|
bot.webhookCallback(secretPath)(req, res);
|
|
177855
176798
|
res.statusCode = 200;
|
|
177856
176799
|
}
|
|
@@ -177881,17 +176824,14 @@ Please check your settings\\.`, { parse_mode: "MarkdownV2" });
|
|
|
177881
176824
|
const timer = setTimeout(
|
|
177882
176825
|
() => {
|
|
177883
176826
|
Promise.all(pushList.map(
|
|
177884
|
-
(fn) => {
|
|
177885
|
-
var _a;
|
|
177886
|
-
return fn(`\u{1F34A}*NodeStatus*
|
|
176827
|
+
(fn) => fn(`\u{1F34A}*NodeStatus*
|
|
177887
176828
|
\u{1F630} One server has disconnected\\!
|
|
177888
176829
|
|
|
177889
176830
|
*\u7528\u6237\u540D*: ${parseEntities(username)}
|
|
177890
|
-
*\u8282\u70B9\u540D*: ${parseEntities(
|
|
177891
|
-
*\u65F6\u95F4*: ${parseEntities(now)}`)
|
|
177892
|
-
}
|
|
176831
|
+
*\u8282\u70B9\u540D*: ${parseEntities(this.servers[username]?.name)}
|
|
176832
|
+
*\u65F6\u95F4*: ${parseEntities(now)}`)
|
|
177893
176833
|
)).then();
|
|
177894
|
-
cb
|
|
176834
|
+
cb?.(now);
|
|
177895
176835
|
timerMap.delete(username);
|
|
177896
176836
|
},
|
|
177897
176837
|
options.pushTimeOut * 1e3
|
|
@@ -177901,7 +176841,7 @@ Please check your settings\\.`, { parse_mode: "MarkdownV2" });
|
|
|
177901
176841
|
}
|
|
177902
176842
|
|
|
177903
176843
|
async function createStatus(app) {
|
|
177904
|
-
const server = new
|
|
176844
|
+
const server = new Server(app.callback());
|
|
177905
176845
|
let ipc = null;
|
|
177906
176846
|
const instance = new NodeStatus(server, {
|
|
177907
176847
|
interval: config.interval,
|
|
@@ -177939,6 +176879,7 @@ async function createStatus(app) {
|
|
|
177939
176879
|
return [server, ipc];
|
|
177940
176880
|
}
|
|
177941
176881
|
|
|
176882
|
+
const __dirname$1 = dirname(fileURLToPath(import.meta.url));
|
|
177942
176883
|
if (!config.port) {
|
|
177943
176884
|
logger.fatal("No port specified");
|
|
177944
176885
|
process.exit(1);
|
|
@@ -177947,17 +176888,15 @@ if (config.useWeb && !config.webPassword) {
|
|
|
177947
176888
|
logger.fatal("No web password specified");
|
|
177948
176889
|
process.exit(1);
|
|
177949
176890
|
}
|
|
177950
|
-
|
|
177951
|
-
|
|
177952
|
-
|
|
177953
|
-
|
|
177954
|
-
|
|
177955
|
-
|
|
177956
|
-
|
|
177957
|
-
|
|
177958
|
-
|
|
177959
|
-
|
|
177960
|
-
|
|
177961
|
-
|
|
177962
|
-
ipc && ipc.listen(config.ipcAddress, () => logger.info(`\u{1F389} NodeStatus Ipc is listening on ${config.ipcAddress}`));
|
|
177963
|
-
})();
|
|
176891
|
+
const app = new Koa();
|
|
176892
|
+
app.use(historyApiFallback_1({
|
|
176893
|
+
whiteList: ["/admin/assets", "/telegraf"],
|
|
176894
|
+
rewrites: [
|
|
176895
|
+
{ from: /^\/admin/, to: "/admin/index.html" }
|
|
176896
|
+
]
|
|
176897
|
+
}));
|
|
176898
|
+
app.use(koaMount("/admin", koaStatic(resolve$3(__dirname$1, "./dist/hotaru-admin"), { maxage: 2592e3 })));
|
|
176899
|
+
app.use(koaStatic(resolve$3(__dirname$1, `./dist/${config.webTheme}`), { maxage: 2592e3 }));
|
|
176900
|
+
const [server, ipc] = await createStatus(app);
|
|
176901
|
+
server.listen(config.port, () => logger.info(`\u{1F389} NodeStatus is listening on http://127.0.0.1:${config.port}`));
|
|
176902
|
+
ipc && ipc.listen(config.ipcAddress, () => logger.info(`\u{1F389} NodeStatus Ipc is listening on ${config.ipcAddress}`));
|