bililive-cli 3.22.1 → 3.22.2
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/lib/{fileFromPath-D1rsnNRo.cjs → fileFromPath-BycXkXgu.cjs} +2 -2
- package/lib/{index-CmRhhp3m.cjs → index-Bqpkb00O.cjs} +1434 -1061
- package/lib/{index-B-Cevjk4.cjs → index-yHivC5bo.cjs} +231 -132
- package/lib/index.cjs +3 -3
- package/lib/{linux-BFUWjr8o.cjs → linux-Cy2IwLL8.cjs} +1 -1
- package/package.json +4 -4
|
@@ -17,7 +17,7 @@ var path$z = require('node:path');
|
|
|
17
17
|
var process$2 = require('node:process');
|
|
18
18
|
var require$$3$1 = require('node:util');
|
|
19
19
|
var EventEmitter$k = require('node:events');
|
|
20
|
-
var fs$
|
|
20
|
+
var fs$F = require('node:fs');
|
|
21
21
|
var require$$0$b = require('node:stream');
|
|
22
22
|
var Database = require('better-sqlite3');
|
|
23
23
|
var require$$1$4 = require('http');
|
|
@@ -40,7 +40,7 @@ var require$$0$e = require('punycode');
|
|
|
40
40
|
var canvas = require('@napi-rs/canvas');
|
|
41
41
|
var require$$0$f = require('vm');
|
|
42
42
|
var promises = require('node:stream/promises');
|
|
43
|
-
var fs$
|
|
43
|
+
var fs$G = require('fs/promises');
|
|
44
44
|
var require$$0$g = require('node:assert');
|
|
45
45
|
var require$$1$7 = require('node:net');
|
|
46
46
|
var require$$5 = require('node:querystring');
|
|
@@ -112,7 +112,7 @@ function getAugmentedNamespace(n) {
|
|
|
112
112
|
return a;
|
|
113
113
|
}
|
|
114
114
|
|
|
115
|
-
var fs$
|
|
115
|
+
var fs$E = {};
|
|
116
116
|
|
|
117
117
|
var universalify$1 = {};
|
|
118
118
|
|
|
@@ -636,7 +636,7 @@ function clone$2 (obj) {
|
|
|
636
636
|
return copy
|
|
637
637
|
}
|
|
638
638
|
|
|
639
|
-
var fs$
|
|
639
|
+
var fs$D = require$$0$6;
|
|
640
640
|
var polyfills = polyfills$1;
|
|
641
641
|
var legacy = legacyStreams;
|
|
642
642
|
var clone$1 = clone_1;
|
|
@@ -678,18 +678,18 @@ else if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || ''))
|
|
|
678
678
|
};
|
|
679
679
|
|
|
680
680
|
// Once time initialization
|
|
681
|
-
if (!fs$
|
|
681
|
+
if (!fs$D[gracefulQueue]) {
|
|
682
682
|
// This queue can be shared by multiple loaded instances
|
|
683
683
|
var queue$2 = commonjsGlobal[gracefulQueue] || [];
|
|
684
|
-
publishQueue(fs$
|
|
684
|
+
publishQueue(fs$D, queue$2);
|
|
685
685
|
|
|
686
686
|
// Patch fs.close/closeSync to shared queue version, because we need
|
|
687
687
|
// to retry() whenever a close happens *anywhere* in the program.
|
|
688
688
|
// This is essential when multiple graceful-fs instances are
|
|
689
689
|
// in play at the same time.
|
|
690
|
-
fs$
|
|
690
|
+
fs$D.close = (function (fs$close) {
|
|
691
691
|
function close (fd, cb) {
|
|
692
|
-
return fs$close.call(fs$
|
|
692
|
+
return fs$close.call(fs$D, fd, function (err) {
|
|
693
693
|
// This function uses the graceful-fs shared queue
|
|
694
694
|
if (!err) {
|
|
695
695
|
resetQueue();
|
|
@@ -704,12 +704,12 @@ if (!fs$B[gracefulQueue]) {
|
|
|
704
704
|
value: fs$close
|
|
705
705
|
});
|
|
706
706
|
return close
|
|
707
|
-
})(fs$
|
|
707
|
+
})(fs$D.close);
|
|
708
708
|
|
|
709
|
-
fs$
|
|
709
|
+
fs$D.closeSync = (function (fs$closeSync) {
|
|
710
710
|
function closeSync (fd) {
|
|
711
711
|
// This function uses the graceful-fs shared queue
|
|
712
|
-
fs$closeSync.apply(fs$
|
|
712
|
+
fs$closeSync.apply(fs$D, arguments);
|
|
713
713
|
resetQueue();
|
|
714
714
|
}
|
|
715
715
|
|
|
@@ -717,24 +717,24 @@ if (!fs$B[gracefulQueue]) {
|
|
|
717
717
|
value: fs$closeSync
|
|
718
718
|
});
|
|
719
719
|
return closeSync
|
|
720
|
-
})(fs$
|
|
720
|
+
})(fs$D.closeSync);
|
|
721
721
|
|
|
722
722
|
if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || '')) {
|
|
723
723
|
process.on('exit', function() {
|
|
724
|
-
debug$7(fs$
|
|
725
|
-
require$$0$5.equal(fs$
|
|
724
|
+
debug$7(fs$D[gracefulQueue]);
|
|
725
|
+
require$$0$5.equal(fs$D[gracefulQueue].length, 0);
|
|
726
726
|
});
|
|
727
727
|
}
|
|
728
728
|
}
|
|
729
729
|
|
|
730
730
|
if (!commonjsGlobal[gracefulQueue]) {
|
|
731
|
-
publishQueue(commonjsGlobal, fs$
|
|
731
|
+
publishQueue(commonjsGlobal, fs$D[gracefulQueue]);
|
|
732
732
|
}
|
|
733
733
|
|
|
734
|
-
var gracefulFs = patch(clone$1(fs$
|
|
735
|
-
if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs$
|
|
736
|
-
gracefulFs = patch(fs$
|
|
737
|
-
fs$
|
|
734
|
+
var gracefulFs = patch(clone$1(fs$D));
|
|
735
|
+
if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs$D.__patched) {
|
|
736
|
+
gracefulFs = patch(fs$D);
|
|
737
|
+
fs$D.__patched = true;
|
|
738
738
|
}
|
|
739
739
|
|
|
740
740
|
function patch (fs) {
|
|
@@ -1008,7 +1008,7 @@ function patch (fs) {
|
|
|
1008
1008
|
|
|
1009
1009
|
function enqueue (elem) {
|
|
1010
1010
|
debug$7('ENQUEUE', elem[0].name, elem[1]);
|
|
1011
|
-
fs$
|
|
1011
|
+
fs$D[gracefulQueue].push(elem);
|
|
1012
1012
|
retry$4();
|
|
1013
1013
|
}
|
|
1014
1014
|
|
|
@@ -1020,12 +1020,12 @@ var retryTimer;
|
|
|
1020
1020
|
// delay between attempts so that we'll retry these jobs sooner
|
|
1021
1021
|
function resetQueue () {
|
|
1022
1022
|
var now = Date.now();
|
|
1023
|
-
for (var i = 0; i < fs$
|
|
1023
|
+
for (var i = 0; i < fs$D[gracefulQueue].length; ++i) {
|
|
1024
1024
|
// entries that are only a length of 2 are from an older version, don't
|
|
1025
1025
|
// bother modifying those since they'll be retried anyway.
|
|
1026
|
-
if (fs$
|
|
1027
|
-
fs$
|
|
1028
|
-
fs$
|
|
1026
|
+
if (fs$D[gracefulQueue][i].length > 2) {
|
|
1027
|
+
fs$D[gracefulQueue][i][3] = now; // startTime
|
|
1028
|
+
fs$D[gracefulQueue][i][4] = now; // lastTime
|
|
1029
1029
|
}
|
|
1030
1030
|
}
|
|
1031
1031
|
// call retry to make sure we're actively processing the queue
|
|
@@ -1037,10 +1037,10 @@ function retry$4 () {
|
|
|
1037
1037
|
clearTimeout(retryTimer);
|
|
1038
1038
|
retryTimer = undefined;
|
|
1039
1039
|
|
|
1040
|
-
if (fs$
|
|
1040
|
+
if (fs$D[gracefulQueue].length === 0)
|
|
1041
1041
|
return
|
|
1042
1042
|
|
|
1043
|
-
var elem = fs$
|
|
1043
|
+
var elem = fs$D[gracefulQueue].shift();
|
|
1044
1044
|
var fn = elem[0];
|
|
1045
1045
|
var args = elem[1];
|
|
1046
1046
|
// these items may be unset if they were added by an older graceful-fs
|
|
@@ -1075,7 +1075,7 @@ function retry$4 () {
|
|
|
1075
1075
|
} else {
|
|
1076
1076
|
// if we can't do this job yet, push it to the end of the queue
|
|
1077
1077
|
// and let the next iteration check again
|
|
1078
|
-
fs$
|
|
1078
|
+
fs$D[gracefulQueue].push(elem);
|
|
1079
1079
|
}
|
|
1080
1080
|
}
|
|
1081
1081
|
|
|
@@ -1225,7 +1225,7 @@ function retry$4 () {
|
|
|
1225
1225
|
'Warning', 'fs-extra-WARN0003'
|
|
1226
1226
|
);
|
|
1227
1227
|
}
|
|
1228
|
-
} (fs$
|
|
1228
|
+
} (fs$E));
|
|
1229
1229
|
|
|
1230
1230
|
var makeDir$1 = {};
|
|
1231
1231
|
|
|
@@ -1247,7 +1247,7 @@ utils$y.checkPath = function checkPath (pth) {
|
|
|
1247
1247
|
}
|
|
1248
1248
|
};
|
|
1249
1249
|
|
|
1250
|
-
const fs$
|
|
1250
|
+
const fs$C = fs$E;
|
|
1251
1251
|
const { checkPath } = utils$y;
|
|
1252
1252
|
|
|
1253
1253
|
const getMode = options => {
|
|
@@ -1259,7 +1259,7 @@ const getMode = options => {
|
|
|
1259
1259
|
makeDir$1.makeDir = async (dir, options) => {
|
|
1260
1260
|
checkPath(dir);
|
|
1261
1261
|
|
|
1262
|
-
return fs$
|
|
1262
|
+
return fs$C.mkdir(dir, {
|
|
1263
1263
|
mode: getMode(options),
|
|
1264
1264
|
recursive: true
|
|
1265
1265
|
})
|
|
@@ -1268,7 +1268,7 @@ makeDir$1.makeDir = async (dir, options) => {
|
|
|
1268
1268
|
makeDir$1.makeDirSync = (dir, options) => {
|
|
1269
1269
|
checkPath(dir);
|
|
1270
1270
|
|
|
1271
|
-
return fs$
|
|
1271
|
+
return fs$C.mkdirSync(dir, {
|
|
1272
1272
|
mode: getMode(options),
|
|
1273
1273
|
recursive: true
|
|
1274
1274
|
})
|
|
@@ -1289,31 +1289,31 @@ var mkdirs$2 = {
|
|
|
1289
1289
|
};
|
|
1290
1290
|
|
|
1291
1291
|
const u$f = universalify$1.fromPromise;
|
|
1292
|
-
const fs$
|
|
1292
|
+
const fs$B = fs$E;
|
|
1293
1293
|
|
|
1294
1294
|
function pathExists$7 (path) {
|
|
1295
|
-
return fs$
|
|
1295
|
+
return fs$B.access(path).then(() => true).catch(() => false)
|
|
1296
1296
|
}
|
|
1297
1297
|
|
|
1298
1298
|
var pathExists_1 = {
|
|
1299
1299
|
pathExists: u$f(pathExists$7),
|
|
1300
|
-
pathExistsSync: fs$
|
|
1300
|
+
pathExistsSync: fs$B.existsSync
|
|
1301
1301
|
};
|
|
1302
1302
|
|
|
1303
|
-
const fs$
|
|
1303
|
+
const fs$A = fs$E;
|
|
1304
1304
|
const u$e = universalify$1.fromPromise;
|
|
1305
1305
|
|
|
1306
1306
|
async function utimesMillis$1 (path, atime, mtime) {
|
|
1307
1307
|
// if (!HAS_MILLIS_RES) return fs.utimes(path, atime, mtime, callback)
|
|
1308
|
-
const fd = await fs$
|
|
1308
|
+
const fd = await fs$A.open(path, 'r+');
|
|
1309
1309
|
|
|
1310
1310
|
let closeErr = null;
|
|
1311
1311
|
|
|
1312
1312
|
try {
|
|
1313
|
-
await fs$
|
|
1313
|
+
await fs$A.futimes(fd, atime, mtime);
|
|
1314
1314
|
} finally {
|
|
1315
1315
|
try {
|
|
1316
|
-
await fs$
|
|
1316
|
+
await fs$A.close(fd);
|
|
1317
1317
|
} catch (e) {
|
|
1318
1318
|
closeErr = e;
|
|
1319
1319
|
}
|
|
@@ -1325,9 +1325,9 @@ async function utimesMillis$1 (path, atime, mtime) {
|
|
|
1325
1325
|
}
|
|
1326
1326
|
|
|
1327
1327
|
function utimesMillisSync$1 (path, atime, mtime) {
|
|
1328
|
-
const fd = fs$
|
|
1329
|
-
fs$
|
|
1330
|
-
return fs$
|
|
1328
|
+
const fd = fs$A.openSync(path, 'r+');
|
|
1329
|
+
fs$A.futimesSync(fd, atime, mtime);
|
|
1330
|
+
return fs$A.closeSync(fd)
|
|
1331
1331
|
}
|
|
1332
1332
|
|
|
1333
1333
|
var utimes = {
|
|
@@ -1335,14 +1335,14 @@ var utimes = {
|
|
|
1335
1335
|
utimesMillisSync: utimesMillisSync$1
|
|
1336
1336
|
};
|
|
1337
1337
|
|
|
1338
|
-
const fs$
|
|
1338
|
+
const fs$z = fs$E;
|
|
1339
1339
|
const path$x = require$$0$7;
|
|
1340
1340
|
const u$d = universalify$1.fromPromise;
|
|
1341
1341
|
|
|
1342
1342
|
function getStats$1 (src, dest, opts) {
|
|
1343
1343
|
const statFunc = opts.dereference
|
|
1344
|
-
? (file) => fs$
|
|
1345
|
-
: (file) => fs$
|
|
1344
|
+
? (file) => fs$z.stat(file, { bigint: true })
|
|
1345
|
+
: (file) => fs$z.lstat(file, { bigint: true });
|
|
1346
1346
|
return Promise.all([
|
|
1347
1347
|
statFunc(src),
|
|
1348
1348
|
statFunc(dest).catch(err => {
|
|
@@ -1355,8 +1355,8 @@ function getStats$1 (src, dest, opts) {
|
|
|
1355
1355
|
function getStatsSync (src, dest, opts) {
|
|
1356
1356
|
let destStat;
|
|
1357
1357
|
const statFunc = opts.dereference
|
|
1358
|
-
? (file) => fs$
|
|
1359
|
-
: (file) => fs$
|
|
1358
|
+
? (file) => fs$z.statSync(file, { bigint: true })
|
|
1359
|
+
: (file) => fs$z.lstatSync(file, { bigint: true });
|
|
1360
1360
|
const srcStat = statFunc(src);
|
|
1361
1361
|
try {
|
|
1362
1362
|
destStat = statFunc(dest);
|
|
@@ -1434,7 +1434,7 @@ async function checkParentPaths (src, srcStat, dest, funcName) {
|
|
|
1434
1434
|
|
|
1435
1435
|
let destStat;
|
|
1436
1436
|
try {
|
|
1437
|
-
destStat = await fs$
|
|
1437
|
+
destStat = await fs$z.stat(destParent, { bigint: true });
|
|
1438
1438
|
} catch (err) {
|
|
1439
1439
|
if (err.code === 'ENOENT') return
|
|
1440
1440
|
throw err
|
|
@@ -1453,7 +1453,7 @@ function checkParentPathsSync (src, srcStat, dest, funcName) {
|
|
|
1453
1453
|
if (destParent === srcParent || destParent === path$x.parse(destParent).root) return
|
|
1454
1454
|
let destStat;
|
|
1455
1455
|
try {
|
|
1456
|
-
destStat = fs$
|
|
1456
|
+
destStat = fs$z.statSync(destParent, { bigint: true });
|
|
1457
1457
|
} catch (err) {
|
|
1458
1458
|
if (err.code === 'ENOENT') return
|
|
1459
1459
|
throw err
|
|
@@ -1492,7 +1492,7 @@ var stat$5 = {
|
|
|
1492
1492
|
areIdentical: areIdentical$2
|
|
1493
1493
|
};
|
|
1494
1494
|
|
|
1495
|
-
const fs$
|
|
1495
|
+
const fs$y = fs$E;
|
|
1496
1496
|
const path$w = require$$0$7;
|
|
1497
1497
|
const { mkdirs: mkdirs$1 } = mkdirs$2;
|
|
1498
1498
|
const { pathExists: pathExists$6 } = pathExists_1;
|
|
@@ -1540,7 +1540,7 @@ async function runFilter (src, dest, opts) {
|
|
|
1540
1540
|
}
|
|
1541
1541
|
|
|
1542
1542
|
async function getStatsAndPerformCopy (destStat, src, dest, opts) {
|
|
1543
|
-
const statFn = opts.dereference ? fs$
|
|
1543
|
+
const statFn = opts.dereference ? fs$y.stat : fs$y.lstat;
|
|
1544
1544
|
const srcStat = await statFn(src);
|
|
1545
1545
|
|
|
1546
1546
|
if (srcStat.isDirectory()) return onDir$1(srcStat, destStat, src, dest, opts)
|
|
@@ -1561,7 +1561,7 @@ async function onFile$1 (srcStat, destStat, src, dest, opts) {
|
|
|
1561
1561
|
if (!destStat) return copyFile$1(srcStat, src, dest, opts)
|
|
1562
1562
|
|
|
1563
1563
|
if (opts.overwrite) {
|
|
1564
|
-
await fs$
|
|
1564
|
+
await fs$y.unlink(dest);
|
|
1565
1565
|
return copyFile$1(srcStat, src, dest, opts)
|
|
1566
1566
|
}
|
|
1567
1567
|
if (opts.errorOnExist) {
|
|
@@ -1570,7 +1570,7 @@ async function onFile$1 (srcStat, destStat, src, dest, opts) {
|
|
|
1570
1570
|
}
|
|
1571
1571
|
|
|
1572
1572
|
async function copyFile$1 (srcStat, src, dest, opts) {
|
|
1573
|
-
await fs$
|
|
1573
|
+
await fs$y.copyFile(src, dest);
|
|
1574
1574
|
if (opts.preserveTimestamps) {
|
|
1575
1575
|
// Make sure the file is writable before setting the timestamp
|
|
1576
1576
|
// otherwise open fails with EPERM when invoked with 'r+'
|
|
@@ -1584,11 +1584,11 @@ async function copyFile$1 (srcStat, src, dest, opts) {
|
|
|
1584
1584
|
// Note that The initial srcStat.atime cannot be trusted
|
|
1585
1585
|
// because it is modified by the read(2) system call
|
|
1586
1586
|
// (See https://nodejs.org/api/fs.html#fs_stat_time_values)
|
|
1587
|
-
const updatedSrcStat = await fs$
|
|
1587
|
+
const updatedSrcStat = await fs$y.stat(src);
|
|
1588
1588
|
await utimesMillis(dest, updatedSrcStat.atime, updatedSrcStat.mtime);
|
|
1589
1589
|
}
|
|
1590
1590
|
|
|
1591
|
-
return fs$
|
|
1591
|
+
return fs$y.chmod(dest, srcStat.mode)
|
|
1592
1592
|
}
|
|
1593
1593
|
|
|
1594
1594
|
function fileIsNotWritable$1 (srcMode) {
|
|
@@ -1596,16 +1596,16 @@ function fileIsNotWritable$1 (srcMode) {
|
|
|
1596
1596
|
}
|
|
1597
1597
|
|
|
1598
1598
|
function makeFileWritable$1 (dest, srcMode) {
|
|
1599
|
-
return fs$
|
|
1599
|
+
return fs$y.chmod(dest, srcMode | 0o200)
|
|
1600
1600
|
}
|
|
1601
1601
|
|
|
1602
1602
|
async function onDir$1 (srcStat, destStat, src, dest, opts) {
|
|
1603
1603
|
// the dest directory might not exist, create it
|
|
1604
1604
|
if (!destStat) {
|
|
1605
|
-
await fs$
|
|
1605
|
+
await fs$y.mkdir(dest);
|
|
1606
1606
|
}
|
|
1607
1607
|
|
|
1608
|
-
const items = await fs$
|
|
1608
|
+
const items = await fs$y.readdir(src);
|
|
1609
1609
|
|
|
1610
1610
|
// loop through the files in the current directory to copy everything
|
|
1611
1611
|
await Promise.all(items.map(async item => {
|
|
@@ -1624,27 +1624,27 @@ async function onDir$1 (srcStat, destStat, src, dest, opts) {
|
|
|
1624
1624
|
}));
|
|
1625
1625
|
|
|
1626
1626
|
if (!destStat) {
|
|
1627
|
-
await fs$
|
|
1627
|
+
await fs$y.chmod(dest, srcStat.mode);
|
|
1628
1628
|
}
|
|
1629
1629
|
}
|
|
1630
1630
|
|
|
1631
1631
|
async function onLink$1 (destStat, src, dest, opts) {
|
|
1632
|
-
let resolvedSrc = await fs$
|
|
1632
|
+
let resolvedSrc = await fs$y.readlink(src);
|
|
1633
1633
|
if (opts.dereference) {
|
|
1634
1634
|
resolvedSrc = path$w.resolve(process.cwd(), resolvedSrc);
|
|
1635
1635
|
}
|
|
1636
1636
|
if (!destStat) {
|
|
1637
|
-
return fs$
|
|
1637
|
+
return fs$y.symlink(resolvedSrc, dest)
|
|
1638
1638
|
}
|
|
1639
1639
|
|
|
1640
1640
|
let resolvedDest = null;
|
|
1641
1641
|
try {
|
|
1642
|
-
resolvedDest = await fs$
|
|
1642
|
+
resolvedDest = await fs$y.readlink(dest);
|
|
1643
1643
|
} catch (e) {
|
|
1644
1644
|
// dest exists and is a regular file or directory,
|
|
1645
1645
|
// Windows may throw UNKNOWN error. If dest already exists,
|
|
1646
1646
|
// fs throws error anyway, so no need to guard against it here.
|
|
1647
|
-
if (e.code === 'EINVAL' || e.code === 'UNKNOWN') return fs$
|
|
1647
|
+
if (e.code === 'EINVAL' || e.code === 'UNKNOWN') return fs$y.symlink(resolvedSrc, dest)
|
|
1648
1648
|
throw e
|
|
1649
1649
|
}
|
|
1650
1650
|
if (opts.dereference) {
|
|
@@ -1662,13 +1662,13 @@ async function onLink$1 (destStat, src, dest, opts) {
|
|
|
1662
1662
|
}
|
|
1663
1663
|
|
|
1664
1664
|
// copy the link
|
|
1665
|
-
await fs$
|
|
1666
|
-
return fs$
|
|
1665
|
+
await fs$y.unlink(dest);
|
|
1666
|
+
return fs$y.symlink(resolvedSrc, dest)
|
|
1667
1667
|
}
|
|
1668
1668
|
|
|
1669
1669
|
var copy_1 = copy$2;
|
|
1670
1670
|
|
|
1671
|
-
const fs$
|
|
1671
|
+
const fs$x = gracefulFs;
|
|
1672
1672
|
const path$v = require$$0$7;
|
|
1673
1673
|
const mkdirsSync$1 = mkdirs$2.mkdirsSync;
|
|
1674
1674
|
const utimesMillisSync = utimes.utimesMillisSync;
|
|
@@ -1696,12 +1696,12 @@ function copySync$1 (src, dest, opts) {
|
|
|
1696
1696
|
stat$3.checkParentPathsSync(src, srcStat, dest, 'copy');
|
|
1697
1697
|
if (opts.filter && !opts.filter(src, dest)) return
|
|
1698
1698
|
const destParent = path$v.dirname(dest);
|
|
1699
|
-
if (!fs$
|
|
1699
|
+
if (!fs$x.existsSync(destParent)) mkdirsSync$1(destParent);
|
|
1700
1700
|
return getStats(destStat, src, dest, opts)
|
|
1701
1701
|
}
|
|
1702
1702
|
|
|
1703
1703
|
function getStats (destStat, src, dest, opts) {
|
|
1704
|
-
const statSync = opts.dereference ? fs$
|
|
1704
|
+
const statSync = opts.dereference ? fs$x.statSync : fs$x.lstatSync;
|
|
1705
1705
|
const srcStat = statSync(src);
|
|
1706
1706
|
|
|
1707
1707
|
if (srcStat.isDirectory()) return onDir(srcStat, destStat, src, dest, opts)
|
|
@@ -1721,7 +1721,7 @@ function onFile (srcStat, destStat, src, dest, opts) {
|
|
|
1721
1721
|
|
|
1722
1722
|
function mayCopyFile (srcStat, src, dest, opts) {
|
|
1723
1723
|
if (opts.overwrite) {
|
|
1724
|
-
fs$
|
|
1724
|
+
fs$x.unlinkSync(dest);
|
|
1725
1725
|
return copyFile(srcStat, src, dest, opts)
|
|
1726
1726
|
} else if (opts.errorOnExist) {
|
|
1727
1727
|
throw new Error(`'${dest}' already exists`)
|
|
@@ -1729,7 +1729,7 @@ function mayCopyFile (srcStat, src, dest, opts) {
|
|
|
1729
1729
|
}
|
|
1730
1730
|
|
|
1731
1731
|
function copyFile (srcStat, src, dest, opts) {
|
|
1732
|
-
fs$
|
|
1732
|
+
fs$x.copyFileSync(src, dest);
|
|
1733
1733
|
if (opts.preserveTimestamps) handleTimestamps(srcStat.mode, src, dest);
|
|
1734
1734
|
return setDestMode(dest, srcStat.mode)
|
|
1735
1735
|
}
|
|
@@ -1751,14 +1751,14 @@ function makeFileWritable (dest, srcMode) {
|
|
|
1751
1751
|
}
|
|
1752
1752
|
|
|
1753
1753
|
function setDestMode (dest, srcMode) {
|
|
1754
|
-
return fs$
|
|
1754
|
+
return fs$x.chmodSync(dest, srcMode)
|
|
1755
1755
|
}
|
|
1756
1756
|
|
|
1757
1757
|
function setDestTimestamps (src, dest) {
|
|
1758
1758
|
// The initial srcStat.atime cannot be trusted
|
|
1759
1759
|
// because it is modified by the read(2) system call
|
|
1760
1760
|
// (See https://nodejs.org/api/fs.html#fs_stat_time_values)
|
|
1761
|
-
const updatedSrcStat = fs$
|
|
1761
|
+
const updatedSrcStat = fs$x.statSync(src);
|
|
1762
1762
|
return utimesMillisSync(dest, updatedSrcStat.atime, updatedSrcStat.mtime)
|
|
1763
1763
|
}
|
|
1764
1764
|
|
|
@@ -1768,13 +1768,13 @@ function onDir (srcStat, destStat, src, dest, opts) {
|
|
|
1768
1768
|
}
|
|
1769
1769
|
|
|
1770
1770
|
function mkDirAndCopy (srcMode, src, dest, opts) {
|
|
1771
|
-
fs$
|
|
1771
|
+
fs$x.mkdirSync(dest);
|
|
1772
1772
|
copyDir(src, dest, opts);
|
|
1773
1773
|
return setDestMode(dest, srcMode)
|
|
1774
1774
|
}
|
|
1775
1775
|
|
|
1776
1776
|
function copyDir (src, dest, opts) {
|
|
1777
|
-
fs$
|
|
1777
|
+
fs$x.readdirSync(src).forEach(item => copyDirItem(item, src, dest, opts));
|
|
1778
1778
|
}
|
|
1779
1779
|
|
|
1780
1780
|
function copyDirItem (item, src, dest, opts) {
|
|
@@ -1786,22 +1786,22 @@ function copyDirItem (item, src, dest, opts) {
|
|
|
1786
1786
|
}
|
|
1787
1787
|
|
|
1788
1788
|
function onLink (destStat, src, dest, opts) {
|
|
1789
|
-
let resolvedSrc = fs$
|
|
1789
|
+
let resolvedSrc = fs$x.readlinkSync(src);
|
|
1790
1790
|
if (opts.dereference) {
|
|
1791
1791
|
resolvedSrc = path$v.resolve(process.cwd(), resolvedSrc);
|
|
1792
1792
|
}
|
|
1793
1793
|
|
|
1794
1794
|
if (!destStat) {
|
|
1795
|
-
return fs$
|
|
1795
|
+
return fs$x.symlinkSync(resolvedSrc, dest)
|
|
1796
1796
|
} else {
|
|
1797
1797
|
let resolvedDest;
|
|
1798
1798
|
try {
|
|
1799
|
-
resolvedDest = fs$
|
|
1799
|
+
resolvedDest = fs$x.readlinkSync(dest);
|
|
1800
1800
|
} catch (err) {
|
|
1801
1801
|
// dest exists and is a regular file or directory,
|
|
1802
1802
|
// Windows may throw UNKNOWN error. If dest already exists,
|
|
1803
1803
|
// fs throws error anyway, so no need to guard against it here.
|
|
1804
|
-
if (err.code === 'EINVAL' || err.code === 'UNKNOWN') return fs$
|
|
1804
|
+
if (err.code === 'EINVAL' || err.code === 'UNKNOWN') return fs$x.symlinkSync(resolvedSrc, dest)
|
|
1805
1805
|
throw err
|
|
1806
1806
|
}
|
|
1807
1807
|
if (opts.dereference) {
|
|
@@ -1822,8 +1822,8 @@ function onLink (destStat, src, dest, opts) {
|
|
|
1822
1822
|
}
|
|
1823
1823
|
|
|
1824
1824
|
function copyLink (resolvedSrc, dest) {
|
|
1825
|
-
fs$
|
|
1826
|
-
return fs$
|
|
1825
|
+
fs$x.unlinkSync(dest);
|
|
1826
|
+
return fs$x.symlinkSync(resolvedSrc, dest)
|
|
1827
1827
|
}
|
|
1828
1828
|
|
|
1829
1829
|
var copySync_1 = copySync$1;
|
|
@@ -1834,15 +1834,15 @@ var copy$1 = {
|
|
|
1834
1834
|
copySync: copySync_1
|
|
1835
1835
|
};
|
|
1836
1836
|
|
|
1837
|
-
const fs$
|
|
1837
|
+
const fs$w = gracefulFs;
|
|
1838
1838
|
const u$b = universalify$1.fromCallback;
|
|
1839
1839
|
|
|
1840
1840
|
function remove$3 (path, callback) {
|
|
1841
|
-
fs$
|
|
1841
|
+
fs$w.rm(path, { recursive: true, force: true }, callback);
|
|
1842
1842
|
}
|
|
1843
1843
|
|
|
1844
1844
|
function removeSync$1 (path) {
|
|
1845
|
-
fs$
|
|
1845
|
+
fs$w.rmSync(path, { recursive: true, force: true });
|
|
1846
1846
|
}
|
|
1847
1847
|
|
|
1848
1848
|
var remove_1 = {
|
|
@@ -1851,7 +1851,7 @@ var remove_1 = {
|
|
|
1851
1851
|
};
|
|
1852
1852
|
|
|
1853
1853
|
const u$a = universalify$1.fromPromise;
|
|
1854
|
-
const fs$
|
|
1854
|
+
const fs$v = fs$E;
|
|
1855
1855
|
const path$u = require$$0$7;
|
|
1856
1856
|
const mkdir$4 = mkdirs$2;
|
|
1857
1857
|
const remove$2 = remove_1;
|
|
@@ -1859,7 +1859,7 @@ const remove$2 = remove_1;
|
|
|
1859
1859
|
const emptyDir = u$a(async function emptyDir (dir) {
|
|
1860
1860
|
let items;
|
|
1861
1861
|
try {
|
|
1862
|
-
items = await fs$
|
|
1862
|
+
items = await fs$v.readdir(dir);
|
|
1863
1863
|
} catch {
|
|
1864
1864
|
return mkdir$4.mkdirs(dir)
|
|
1865
1865
|
}
|
|
@@ -1870,7 +1870,7 @@ const emptyDir = u$a(async function emptyDir (dir) {
|
|
|
1870
1870
|
function emptyDirSync (dir) {
|
|
1871
1871
|
let items;
|
|
1872
1872
|
try {
|
|
1873
|
-
items = fs$
|
|
1873
|
+
items = fs$v.readdirSync(dir);
|
|
1874
1874
|
} catch {
|
|
1875
1875
|
return mkdir$4.mkdirsSync(dir)
|
|
1876
1876
|
}
|
|
@@ -1890,13 +1890,13 @@ var empty = {
|
|
|
1890
1890
|
|
|
1891
1891
|
const u$9 = universalify$1.fromPromise;
|
|
1892
1892
|
const path$t = require$$0$7;
|
|
1893
|
-
const fs$
|
|
1893
|
+
const fs$u = fs$E;
|
|
1894
1894
|
const mkdir$3 = mkdirs$2;
|
|
1895
1895
|
|
|
1896
1896
|
async function createFile$1 (file) {
|
|
1897
1897
|
let stats;
|
|
1898
1898
|
try {
|
|
1899
|
-
stats = await fs$
|
|
1899
|
+
stats = await fs$u.stat(file);
|
|
1900
1900
|
} catch { }
|
|
1901
1901
|
if (stats && stats.isFile()) return
|
|
1902
1902
|
|
|
@@ -1904,12 +1904,12 @@ async function createFile$1 (file) {
|
|
|
1904
1904
|
|
|
1905
1905
|
let dirStats = null;
|
|
1906
1906
|
try {
|
|
1907
|
-
dirStats = await fs$
|
|
1907
|
+
dirStats = await fs$u.stat(dir);
|
|
1908
1908
|
} catch (err) {
|
|
1909
1909
|
// if the directory doesn't exist, make it
|
|
1910
1910
|
if (err.code === 'ENOENT') {
|
|
1911
1911
|
await mkdir$3.mkdirs(dir);
|
|
1912
|
-
await fs$
|
|
1912
|
+
await fs$u.writeFile(file, '');
|
|
1913
1913
|
return
|
|
1914
1914
|
} else {
|
|
1915
1915
|
throw err
|
|
@@ -1917,27 +1917,27 @@ async function createFile$1 (file) {
|
|
|
1917
1917
|
}
|
|
1918
1918
|
|
|
1919
1919
|
if (dirStats.isDirectory()) {
|
|
1920
|
-
await fs$
|
|
1920
|
+
await fs$u.writeFile(file, '');
|
|
1921
1921
|
} else {
|
|
1922
1922
|
// parent is not a directory
|
|
1923
1923
|
// This is just to cause an internal ENOTDIR error to be thrown
|
|
1924
|
-
await fs$
|
|
1924
|
+
await fs$u.readdir(dir);
|
|
1925
1925
|
}
|
|
1926
1926
|
}
|
|
1927
1927
|
|
|
1928
1928
|
function createFileSync$1 (file) {
|
|
1929
1929
|
let stats;
|
|
1930
1930
|
try {
|
|
1931
|
-
stats = fs$
|
|
1931
|
+
stats = fs$u.statSync(file);
|
|
1932
1932
|
} catch { }
|
|
1933
1933
|
if (stats && stats.isFile()) return
|
|
1934
1934
|
|
|
1935
1935
|
const dir = path$t.dirname(file);
|
|
1936
1936
|
try {
|
|
1937
|
-
if (!fs$
|
|
1937
|
+
if (!fs$u.statSync(dir).isDirectory()) {
|
|
1938
1938
|
// parent is not a directory
|
|
1939
1939
|
// This is just to cause an internal ENOTDIR error to be thrown
|
|
1940
|
-
fs$
|
|
1940
|
+
fs$u.readdirSync(dir);
|
|
1941
1941
|
}
|
|
1942
1942
|
} catch (err) {
|
|
1943
1943
|
// If the stat call above failed because the directory doesn't exist, create it
|
|
@@ -1945,7 +1945,7 @@ function createFileSync$1 (file) {
|
|
|
1945
1945
|
else throw err
|
|
1946
1946
|
}
|
|
1947
1947
|
|
|
1948
|
-
fs$
|
|
1948
|
+
fs$u.writeFileSync(file, '');
|
|
1949
1949
|
}
|
|
1950
1950
|
|
|
1951
1951
|
var file$1 = {
|
|
@@ -1955,7 +1955,7 @@ var file$1 = {
|
|
|
1955
1955
|
|
|
1956
1956
|
const u$8 = universalify$1.fromPromise;
|
|
1957
1957
|
const path$s = require$$0$7;
|
|
1958
|
-
const fs$
|
|
1958
|
+
const fs$t = fs$E;
|
|
1959
1959
|
const mkdir$2 = mkdirs$2;
|
|
1960
1960
|
const { pathExists: pathExists$5 } = pathExists_1;
|
|
1961
1961
|
const { areIdentical: areIdentical$1 } = stat$5;
|
|
@@ -1963,14 +1963,14 @@ const { areIdentical: areIdentical$1 } = stat$5;
|
|
|
1963
1963
|
async function createLink$1 (srcpath, dstpath) {
|
|
1964
1964
|
let dstStat;
|
|
1965
1965
|
try {
|
|
1966
|
-
dstStat = await fs$
|
|
1966
|
+
dstStat = await fs$t.lstat(dstpath);
|
|
1967
1967
|
} catch {
|
|
1968
1968
|
// ignore error
|
|
1969
1969
|
}
|
|
1970
1970
|
|
|
1971
1971
|
let srcStat;
|
|
1972
1972
|
try {
|
|
1973
|
-
srcStat = await fs$
|
|
1973
|
+
srcStat = await fs$t.lstat(srcpath);
|
|
1974
1974
|
} catch (err) {
|
|
1975
1975
|
err.message = err.message.replace('lstat', 'ensureLink');
|
|
1976
1976
|
throw err
|
|
@@ -1986,17 +1986,17 @@ async function createLink$1 (srcpath, dstpath) {
|
|
|
1986
1986
|
await mkdir$2.mkdirs(dir);
|
|
1987
1987
|
}
|
|
1988
1988
|
|
|
1989
|
-
await fs$
|
|
1989
|
+
await fs$t.link(srcpath, dstpath);
|
|
1990
1990
|
}
|
|
1991
1991
|
|
|
1992
1992
|
function createLinkSync$1 (srcpath, dstpath) {
|
|
1993
1993
|
let dstStat;
|
|
1994
1994
|
try {
|
|
1995
|
-
dstStat = fs$
|
|
1995
|
+
dstStat = fs$t.lstatSync(dstpath);
|
|
1996
1996
|
} catch {}
|
|
1997
1997
|
|
|
1998
1998
|
try {
|
|
1999
|
-
const srcStat = fs$
|
|
1999
|
+
const srcStat = fs$t.lstatSync(srcpath);
|
|
2000
2000
|
if (dstStat && areIdentical$1(srcStat, dstStat)) return
|
|
2001
2001
|
} catch (err) {
|
|
2002
2002
|
err.message = err.message.replace('lstat', 'ensureLink');
|
|
@@ -2004,11 +2004,11 @@ function createLinkSync$1 (srcpath, dstpath) {
|
|
|
2004
2004
|
}
|
|
2005
2005
|
|
|
2006
2006
|
const dir = path$s.dirname(dstpath);
|
|
2007
|
-
const dirExists = fs$
|
|
2008
|
-
if (dirExists) return fs$
|
|
2007
|
+
const dirExists = fs$t.existsSync(dir);
|
|
2008
|
+
if (dirExists) return fs$t.linkSync(srcpath, dstpath)
|
|
2009
2009
|
mkdir$2.mkdirsSync(dir);
|
|
2010
2010
|
|
|
2011
|
-
return fs$
|
|
2011
|
+
return fs$t.linkSync(srcpath, dstpath)
|
|
2012
2012
|
}
|
|
2013
2013
|
|
|
2014
2014
|
var link = {
|
|
@@ -2017,7 +2017,7 @@ var link = {
|
|
|
2017
2017
|
};
|
|
2018
2018
|
|
|
2019
2019
|
const path$r = require$$0$7;
|
|
2020
|
-
const fs$
|
|
2020
|
+
const fs$s = fs$E;
|
|
2021
2021
|
const { pathExists: pathExists$4 } = pathExists_1;
|
|
2022
2022
|
|
|
2023
2023
|
const u$7 = universalify$1.fromPromise;
|
|
@@ -2047,7 +2047,7 @@ const u$7 = universalify$1.fromPromise;
|
|
|
2047
2047
|
async function symlinkPaths$1 (srcpath, dstpath) {
|
|
2048
2048
|
if (path$r.isAbsolute(srcpath)) {
|
|
2049
2049
|
try {
|
|
2050
|
-
await fs$
|
|
2050
|
+
await fs$s.lstat(srcpath);
|
|
2051
2051
|
} catch (err) {
|
|
2052
2052
|
err.message = err.message.replace('lstat', 'ensureSymlink');
|
|
2053
2053
|
throw err
|
|
@@ -2071,7 +2071,7 @@ async function symlinkPaths$1 (srcpath, dstpath) {
|
|
|
2071
2071
|
}
|
|
2072
2072
|
|
|
2073
2073
|
try {
|
|
2074
|
-
await fs$
|
|
2074
|
+
await fs$s.lstat(srcpath);
|
|
2075
2075
|
} catch (err) {
|
|
2076
2076
|
err.message = err.message.replace('lstat', 'ensureSymlink');
|
|
2077
2077
|
throw err
|
|
@@ -2085,7 +2085,7 @@ async function symlinkPaths$1 (srcpath, dstpath) {
|
|
|
2085
2085
|
|
|
2086
2086
|
function symlinkPathsSync$1 (srcpath, dstpath) {
|
|
2087
2087
|
if (path$r.isAbsolute(srcpath)) {
|
|
2088
|
-
const exists = fs$
|
|
2088
|
+
const exists = fs$s.existsSync(srcpath);
|
|
2089
2089
|
if (!exists) throw new Error('absolute srcpath does not exist')
|
|
2090
2090
|
return {
|
|
2091
2091
|
toCwd: srcpath,
|
|
@@ -2095,7 +2095,7 @@ function symlinkPathsSync$1 (srcpath, dstpath) {
|
|
|
2095
2095
|
|
|
2096
2096
|
const dstdir = path$r.dirname(dstpath);
|
|
2097
2097
|
const relativeToDst = path$r.join(dstdir, srcpath);
|
|
2098
|
-
const exists = fs$
|
|
2098
|
+
const exists = fs$s.existsSync(relativeToDst);
|
|
2099
2099
|
if (exists) {
|
|
2100
2100
|
return {
|
|
2101
2101
|
toCwd: relativeToDst,
|
|
@@ -2103,7 +2103,7 @@ function symlinkPathsSync$1 (srcpath, dstpath) {
|
|
|
2103
2103
|
}
|
|
2104
2104
|
}
|
|
2105
2105
|
|
|
2106
|
-
const srcExists = fs$
|
|
2106
|
+
const srcExists = fs$s.existsSync(srcpath);
|
|
2107
2107
|
if (!srcExists) throw new Error('relative srcpath does not exist')
|
|
2108
2108
|
return {
|
|
2109
2109
|
toCwd: srcpath,
|
|
@@ -2116,7 +2116,7 @@ var symlinkPaths_1 = {
|
|
|
2116
2116
|
symlinkPathsSync: symlinkPathsSync$1
|
|
2117
2117
|
};
|
|
2118
2118
|
|
|
2119
|
-
const fs$
|
|
2119
|
+
const fs$r = fs$E;
|
|
2120
2120
|
const u$6 = universalify$1.fromPromise;
|
|
2121
2121
|
|
|
2122
2122
|
async function symlinkType$1 (srcpath, type) {
|
|
@@ -2124,7 +2124,7 @@ async function symlinkType$1 (srcpath, type) {
|
|
|
2124
2124
|
|
|
2125
2125
|
let stats;
|
|
2126
2126
|
try {
|
|
2127
|
-
stats = await fs$
|
|
2127
|
+
stats = await fs$r.lstat(srcpath);
|
|
2128
2128
|
} catch {
|
|
2129
2129
|
return 'file'
|
|
2130
2130
|
}
|
|
@@ -2137,7 +2137,7 @@ function symlinkTypeSync$1 (srcpath, type) {
|
|
|
2137
2137
|
|
|
2138
2138
|
let stats;
|
|
2139
2139
|
try {
|
|
2140
|
-
stats = fs$
|
|
2140
|
+
stats = fs$r.lstatSync(srcpath);
|
|
2141
2141
|
} catch {
|
|
2142
2142
|
return 'file'
|
|
2143
2143
|
}
|
|
@@ -2151,7 +2151,7 @@ var symlinkType_1 = {
|
|
|
2151
2151
|
|
|
2152
2152
|
const u$5 = universalify$1.fromPromise;
|
|
2153
2153
|
const path$q = require$$0$7;
|
|
2154
|
-
const fs$
|
|
2154
|
+
const fs$q = fs$E;
|
|
2155
2155
|
|
|
2156
2156
|
const { mkdirs, mkdirsSync } = mkdirs$2;
|
|
2157
2157
|
|
|
@@ -2165,13 +2165,13 @@ const { areIdentical } = stat$5;
|
|
|
2165
2165
|
async function createSymlink$1 (srcpath, dstpath, type) {
|
|
2166
2166
|
let stats;
|
|
2167
2167
|
try {
|
|
2168
|
-
stats = await fs$
|
|
2168
|
+
stats = await fs$q.lstat(dstpath);
|
|
2169
2169
|
} catch { }
|
|
2170
2170
|
|
|
2171
2171
|
if (stats && stats.isSymbolicLink()) {
|
|
2172
2172
|
const [srcStat, dstStat] = await Promise.all([
|
|
2173
|
-
fs$
|
|
2174
|
-
fs$
|
|
2173
|
+
fs$q.stat(srcpath),
|
|
2174
|
+
fs$q.stat(dstpath)
|
|
2175
2175
|
]);
|
|
2176
2176
|
|
|
2177
2177
|
if (areIdentical(srcStat, dstStat)) return
|
|
@@ -2186,17 +2186,17 @@ async function createSymlink$1 (srcpath, dstpath, type) {
|
|
|
2186
2186
|
await mkdirs(dir);
|
|
2187
2187
|
}
|
|
2188
2188
|
|
|
2189
|
-
return fs$
|
|
2189
|
+
return fs$q.symlink(srcpath, dstpath, toType)
|
|
2190
2190
|
}
|
|
2191
2191
|
|
|
2192
2192
|
function createSymlinkSync$1 (srcpath, dstpath, type) {
|
|
2193
2193
|
let stats;
|
|
2194
2194
|
try {
|
|
2195
|
-
stats = fs$
|
|
2195
|
+
stats = fs$q.lstatSync(dstpath);
|
|
2196
2196
|
} catch { }
|
|
2197
2197
|
if (stats && stats.isSymbolicLink()) {
|
|
2198
|
-
const srcStat = fs$
|
|
2199
|
-
const dstStat = fs$
|
|
2198
|
+
const srcStat = fs$q.statSync(srcpath);
|
|
2199
|
+
const dstStat = fs$q.statSync(dstpath);
|
|
2200
2200
|
if (areIdentical(srcStat, dstStat)) return
|
|
2201
2201
|
}
|
|
2202
2202
|
|
|
@@ -2204,10 +2204,10 @@ function createSymlinkSync$1 (srcpath, dstpath, type) {
|
|
|
2204
2204
|
srcpath = relative.toDst;
|
|
2205
2205
|
type = symlinkTypeSync(relative.toCwd, type);
|
|
2206
2206
|
const dir = path$q.dirname(dstpath);
|
|
2207
|
-
const exists = fs$
|
|
2208
|
-
if (exists) return fs$
|
|
2207
|
+
const exists = fs$q.existsSync(dir);
|
|
2208
|
+
if (exists) return fs$q.symlinkSync(srcpath, dstpath, type)
|
|
2209
2209
|
mkdirsSync(dir);
|
|
2210
|
-
return fs$
|
|
2210
|
+
return fs$q.symlinkSync(srcpath, dstpath, type)
|
|
2211
2211
|
}
|
|
2212
2212
|
|
|
2213
2213
|
var symlink = {
|
|
@@ -2352,7 +2352,7 @@ var jsonfile = {
|
|
|
2352
2352
|
};
|
|
2353
2353
|
|
|
2354
2354
|
const u$4 = universalify$1.fromPromise;
|
|
2355
|
-
const fs$
|
|
2355
|
+
const fs$p = fs$E;
|
|
2356
2356
|
const path$p = require$$0$7;
|
|
2357
2357
|
const mkdir$1 = mkdirs$2;
|
|
2358
2358
|
const pathExists$2 = pathExists_1.pathExists;
|
|
@@ -2364,16 +2364,16 @@ async function outputFile$1 (file, data, encoding = 'utf-8') {
|
|
|
2364
2364
|
await mkdir$1.mkdirs(dir);
|
|
2365
2365
|
}
|
|
2366
2366
|
|
|
2367
|
-
return fs$
|
|
2367
|
+
return fs$p.writeFile(file, data, encoding)
|
|
2368
2368
|
}
|
|
2369
2369
|
|
|
2370
2370
|
function outputFileSync$1 (file, ...args) {
|
|
2371
2371
|
const dir = path$p.dirname(file);
|
|
2372
|
-
if (!fs$
|
|
2372
|
+
if (!fs$p.existsSync(dir)) {
|
|
2373
2373
|
mkdir$1.mkdirsSync(dir);
|
|
2374
2374
|
}
|
|
2375
2375
|
|
|
2376
|
-
fs$
|
|
2376
|
+
fs$p.writeFileSync(file, ...args);
|
|
2377
2377
|
}
|
|
2378
2378
|
|
|
2379
2379
|
var outputFile_1 = {
|
|
@@ -2418,7 +2418,7 @@ jsonFile.readJSONSync = jsonFile.readJsonSync;
|
|
|
2418
2418
|
|
|
2419
2419
|
var json$3 = jsonFile;
|
|
2420
2420
|
|
|
2421
|
-
const fs$
|
|
2421
|
+
const fs$o = fs$E;
|
|
2422
2422
|
const path$o = require$$0$7;
|
|
2423
2423
|
const { copy } = copy$1;
|
|
2424
2424
|
const { remove: remove$1 } = remove_1;
|
|
@@ -2454,7 +2454,7 @@ async function doRename$1 (src, dest, overwrite, isChangingCase) {
|
|
|
2454
2454
|
|
|
2455
2455
|
try {
|
|
2456
2456
|
// Try w/ rename first, and try copy + remove if EXDEV
|
|
2457
|
-
await fs$
|
|
2457
|
+
await fs$o.rename(src, dest);
|
|
2458
2458
|
} catch (err) {
|
|
2459
2459
|
if (err.code !== 'EXDEV') {
|
|
2460
2460
|
throw err
|
|
@@ -2476,7 +2476,7 @@ async function moveAcrossDevice$1 (src, dest, overwrite) {
|
|
|
2476
2476
|
|
|
2477
2477
|
var move_1 = move$1;
|
|
2478
2478
|
|
|
2479
|
-
const fs$
|
|
2479
|
+
const fs$n = gracefulFs;
|
|
2480
2480
|
const path$n = require$$0$7;
|
|
2481
2481
|
const copySync = copy$1.copySync;
|
|
2482
2482
|
const removeSync = remove_1.removeSync;
|
|
@@ -2505,13 +2505,13 @@ function doRename (src, dest, overwrite, isChangingCase) {
|
|
|
2505
2505
|
removeSync(dest);
|
|
2506
2506
|
return rename(src, dest, overwrite)
|
|
2507
2507
|
}
|
|
2508
|
-
if (fs$
|
|
2508
|
+
if (fs$n.existsSync(dest)) throw new Error('dest already exists.')
|
|
2509
2509
|
return rename(src, dest, overwrite)
|
|
2510
2510
|
}
|
|
2511
2511
|
|
|
2512
2512
|
function rename (src, dest, overwrite) {
|
|
2513
2513
|
try {
|
|
2514
|
-
fs$
|
|
2514
|
+
fs$n.renameSync(src, dest);
|
|
2515
2515
|
} catch (err) {
|
|
2516
2516
|
if (err.code !== 'EXDEV') throw err
|
|
2517
2517
|
return moveAcrossDevice(src, dest, overwrite)
|
|
@@ -2538,7 +2538,7 @@ var move = {
|
|
|
2538
2538
|
|
|
2539
2539
|
var lib$3 = {
|
|
2540
2540
|
// Export promiseified graceful-fs:
|
|
2541
|
-
...fs$
|
|
2541
|
+
...fs$E,
|
|
2542
2542
|
// Export extra methods:
|
|
2543
2543
|
...copy$1,
|
|
2544
2544
|
...empty,
|
|
@@ -2551,7 +2551,7 @@ var lib$3 = {
|
|
|
2551
2551
|
...remove_1
|
|
2552
2552
|
};
|
|
2553
2553
|
|
|
2554
|
-
var fs$
|
|
2554
|
+
var fs$m = /*@__PURE__*/getDefaultExportFromCjs(lib$3);
|
|
2555
2555
|
|
|
2556
2556
|
var tasks = {};
|
|
2557
2557
|
|
|
@@ -2590,10 +2590,10 @@ function isEnoentCodeError(error) {
|
|
|
2590
2590
|
}
|
|
2591
2591
|
errno$1.isEnoentCodeError = isEnoentCodeError;
|
|
2592
2592
|
|
|
2593
|
-
var fs$
|
|
2593
|
+
var fs$l = {};
|
|
2594
2594
|
|
|
2595
|
-
Object.defineProperty(fs$
|
|
2596
|
-
fs$
|
|
2595
|
+
Object.defineProperty(fs$l, "__esModule", { value: true });
|
|
2596
|
+
fs$l.createDirentFromStats = void 0;
|
|
2597
2597
|
let DirentFromStats$1 = class DirentFromStats {
|
|
2598
2598
|
constructor(name, stats) {
|
|
2599
2599
|
this.name = name;
|
|
@@ -2609,7 +2609,7 @@ let DirentFromStats$1 = class DirentFromStats {
|
|
|
2609
2609
|
function createDirentFromStats$1(name, stats) {
|
|
2610
2610
|
return new DirentFromStats$1(name, stats);
|
|
2611
2611
|
}
|
|
2612
|
-
fs$
|
|
2612
|
+
fs$l.createDirentFromStats = createDirentFromStats$1;
|
|
2613
2613
|
|
|
2614
2614
|
var path$m = {};
|
|
2615
2615
|
|
|
@@ -7241,8 +7241,8 @@ const array = array$1;
|
|
|
7241
7241
|
utils$w.array = array;
|
|
7242
7242
|
const errno = errno$1;
|
|
7243
7243
|
utils$w.errno = errno;
|
|
7244
|
-
const fs$
|
|
7245
|
-
utils$w.fs = fs$
|
|
7244
|
+
const fs$k = fs$l;
|
|
7245
|
+
utils$w.fs = fs$k;
|
|
7246
7246
|
const path$h = path$m;
|
|
7247
7247
|
utils$w.path = path$h;
|
|
7248
7248
|
const pattern = pattern$1;
|
|
@@ -7443,7 +7443,7 @@ sync$9.read = read$2;
|
|
|
7443
7443
|
|
|
7444
7444
|
var settings$3 = {};
|
|
7445
7445
|
|
|
7446
|
-
var fs$
|
|
7446
|
+
var fs$j = {};
|
|
7447
7447
|
|
|
7448
7448
|
(function (exports) {
|
|
7449
7449
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -7462,15 +7462,15 @@ var fs$h = {};
|
|
|
7462
7462
|
return Object.assign(Object.assign({}, exports.FILE_SYSTEM_ADAPTER), fsMethods);
|
|
7463
7463
|
}
|
|
7464
7464
|
exports.createFileSystemAdapter = createFileSystemAdapter;
|
|
7465
|
-
} (fs$
|
|
7465
|
+
} (fs$j));
|
|
7466
7466
|
|
|
7467
7467
|
Object.defineProperty(settings$3, "__esModule", { value: true });
|
|
7468
|
-
const fs$
|
|
7468
|
+
const fs$i = fs$j;
|
|
7469
7469
|
let Settings$2 = class Settings {
|
|
7470
7470
|
constructor(_options = {}) {
|
|
7471
7471
|
this._options = _options;
|
|
7472
7472
|
this.followSymbolicLink = this._getValue(this._options.followSymbolicLink, true);
|
|
7473
|
-
this.fs = fs$
|
|
7473
|
+
this.fs = fs$i.createFileSystemAdapter(this._options.fs);
|
|
7474
7474
|
this.markSymbolicLink = this._getValue(this._options.markSymbolicLink, false);
|
|
7475
7475
|
this.throwErrorOnBrokenSymbolicLink = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, true);
|
|
7476
7476
|
}
|
|
@@ -7591,10 +7591,10 @@ constants$h.IS_SUPPORT_READDIR_WITH_FILE_TYPES = IS_MATCHED_BY_MAJOR || IS_MATCH
|
|
|
7591
7591
|
|
|
7592
7592
|
var utils$l = {};
|
|
7593
7593
|
|
|
7594
|
-
var fs$
|
|
7594
|
+
var fs$h = {};
|
|
7595
7595
|
|
|
7596
|
-
Object.defineProperty(fs$
|
|
7597
|
-
fs$
|
|
7596
|
+
Object.defineProperty(fs$h, "__esModule", { value: true });
|
|
7597
|
+
fs$h.createDirentFromStats = void 0;
|
|
7598
7598
|
class DirentFromStats {
|
|
7599
7599
|
constructor(name, stats) {
|
|
7600
7600
|
this.name = name;
|
|
@@ -7610,12 +7610,12 @@ class DirentFromStats {
|
|
|
7610
7610
|
function createDirentFromStats(name, stats) {
|
|
7611
7611
|
return new DirentFromStats(name, stats);
|
|
7612
7612
|
}
|
|
7613
|
-
fs$
|
|
7613
|
+
fs$h.createDirentFromStats = createDirentFromStats;
|
|
7614
7614
|
|
|
7615
7615
|
Object.defineProperty(utils$l, "__esModule", { value: true });
|
|
7616
7616
|
utils$l.fs = void 0;
|
|
7617
|
-
const fs$
|
|
7618
|
-
utils$l.fs = fs$
|
|
7617
|
+
const fs$g = fs$h;
|
|
7618
|
+
utils$l.fs = fs$g;
|
|
7619
7619
|
|
|
7620
7620
|
var common$c = {};
|
|
7621
7621
|
|
|
@@ -7794,7 +7794,7 @@ sync$7.readdir = readdir;
|
|
|
7794
7794
|
|
|
7795
7795
|
var settings$2 = {};
|
|
7796
7796
|
|
|
7797
|
-
var fs$
|
|
7797
|
+
var fs$f = {};
|
|
7798
7798
|
|
|
7799
7799
|
(function (exports) {
|
|
7800
7800
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -7815,17 +7815,17 @@ var fs$d = {};
|
|
|
7815
7815
|
return Object.assign(Object.assign({}, exports.FILE_SYSTEM_ADAPTER), fsMethods);
|
|
7816
7816
|
}
|
|
7817
7817
|
exports.createFileSystemAdapter = createFileSystemAdapter;
|
|
7818
|
-
} (fs$
|
|
7818
|
+
} (fs$f));
|
|
7819
7819
|
|
|
7820
7820
|
Object.defineProperty(settings$2, "__esModule", { value: true });
|
|
7821
7821
|
const path$g = require$$0$7;
|
|
7822
7822
|
const fsStat$3 = out$1;
|
|
7823
|
-
const fs$
|
|
7823
|
+
const fs$e = fs$f;
|
|
7824
7824
|
let Settings$1 = class Settings {
|
|
7825
7825
|
constructor(_options = {}) {
|
|
7826
7826
|
this._options = _options;
|
|
7827
7827
|
this.followSymbolicLinks = this._getValue(this._options.followSymbolicLinks, false);
|
|
7828
|
-
this.fs = fs$
|
|
7828
|
+
this.fs = fs$e.createFileSystemAdapter(this._options.fs);
|
|
7829
7829
|
this.pathSegmentSeparator = this._getValue(this._options.pathSegmentSeparator, path$g.sep);
|
|
7830
7830
|
this.stats = this._getValue(this._options.stats, false);
|
|
7831
7831
|
this.throwErrorOnBrokenSymbolicLink = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, true);
|
|
@@ -11351,44 +11351,44 @@ const RETRYIFY_OPTIONS = {
|
|
|
11351
11351
|
const FS = {
|
|
11352
11352
|
attempt: {
|
|
11353
11353
|
/* ASYNC */
|
|
11354
|
-
chmod: attemptifyAsync(require$$3$1.promisify(fs$
|
|
11355
|
-
chown: attemptifyAsync(require$$3$1.promisify(fs$
|
|
11356
|
-
close: attemptifyAsync(require$$3$1.promisify(fs$
|
|
11357
|
-
fsync: attemptifyAsync(require$$3$1.promisify(fs$
|
|
11358
|
-
mkdir: attemptifyAsync(require$$3$1.promisify(fs$
|
|
11359
|
-
realpath: attemptifyAsync(require$$3$1.promisify(fs$
|
|
11360
|
-
stat: attemptifyAsync(require$$3$1.promisify(fs$
|
|
11361
|
-
unlink: attemptifyAsync(require$$3$1.promisify(fs$
|
|
11354
|
+
chmod: attemptifyAsync(require$$3$1.promisify(fs$F.chmod), ATTEMPTIFY_CHANGE_ERROR_OPTIONS),
|
|
11355
|
+
chown: attemptifyAsync(require$$3$1.promisify(fs$F.chown), ATTEMPTIFY_CHANGE_ERROR_OPTIONS),
|
|
11356
|
+
close: attemptifyAsync(require$$3$1.promisify(fs$F.close), ATTEMPTIFY_NOOP_OPTIONS),
|
|
11357
|
+
fsync: attemptifyAsync(require$$3$1.promisify(fs$F.fsync), ATTEMPTIFY_NOOP_OPTIONS),
|
|
11358
|
+
mkdir: attemptifyAsync(require$$3$1.promisify(fs$F.mkdir), ATTEMPTIFY_NOOP_OPTIONS),
|
|
11359
|
+
realpath: attemptifyAsync(require$$3$1.promisify(fs$F.realpath), ATTEMPTIFY_NOOP_OPTIONS),
|
|
11360
|
+
stat: attemptifyAsync(require$$3$1.promisify(fs$F.stat), ATTEMPTIFY_NOOP_OPTIONS),
|
|
11361
|
+
unlink: attemptifyAsync(require$$3$1.promisify(fs$F.unlink), ATTEMPTIFY_NOOP_OPTIONS),
|
|
11362
11362
|
/* SYNC */
|
|
11363
|
-
chmodSync: attemptifySync(fs$
|
|
11364
|
-
chownSync: attemptifySync(fs$
|
|
11365
|
-
closeSync: attemptifySync(fs$
|
|
11366
|
-
existsSync: attemptifySync(fs$
|
|
11367
|
-
fsyncSync: attemptifySync(fs$
|
|
11368
|
-
mkdirSync: attemptifySync(fs$
|
|
11369
|
-
realpathSync: attemptifySync(fs$
|
|
11370
|
-
statSync: attemptifySync(fs$
|
|
11371
|
-
unlinkSync: attemptifySync(fs$
|
|
11363
|
+
chmodSync: attemptifySync(fs$F.chmodSync, ATTEMPTIFY_CHANGE_ERROR_OPTIONS),
|
|
11364
|
+
chownSync: attemptifySync(fs$F.chownSync, ATTEMPTIFY_CHANGE_ERROR_OPTIONS),
|
|
11365
|
+
closeSync: attemptifySync(fs$F.closeSync, ATTEMPTIFY_NOOP_OPTIONS),
|
|
11366
|
+
existsSync: attemptifySync(fs$F.existsSync, ATTEMPTIFY_NOOP_OPTIONS),
|
|
11367
|
+
fsyncSync: attemptifySync(fs$F.fsync, ATTEMPTIFY_NOOP_OPTIONS),
|
|
11368
|
+
mkdirSync: attemptifySync(fs$F.mkdirSync, ATTEMPTIFY_NOOP_OPTIONS),
|
|
11369
|
+
realpathSync: attemptifySync(fs$F.realpathSync, ATTEMPTIFY_NOOP_OPTIONS),
|
|
11370
|
+
statSync: attemptifySync(fs$F.statSync, ATTEMPTIFY_NOOP_OPTIONS),
|
|
11371
|
+
unlinkSync: attemptifySync(fs$F.unlinkSync, ATTEMPTIFY_NOOP_OPTIONS)
|
|
11372
11372
|
},
|
|
11373
11373
|
retry: {
|
|
11374
11374
|
/* ASYNC */
|
|
11375
|
-
close: retryifyAsync(require$$3$1.promisify(fs$
|
|
11376
|
-
fsync: retryifyAsync(require$$3$1.promisify(fs$
|
|
11377
|
-
open: retryifyAsync(require$$3$1.promisify(fs$
|
|
11378
|
-
readFile: retryifyAsync(require$$3$1.promisify(fs$
|
|
11379
|
-
rename: retryifyAsync(require$$3$1.promisify(fs$
|
|
11380
|
-
stat: retryifyAsync(require$$3$1.promisify(fs$
|
|
11381
|
-
write: retryifyAsync(require$$3$1.promisify(fs$
|
|
11382
|
-
writeFile: retryifyAsync(require$$3$1.promisify(fs$
|
|
11375
|
+
close: retryifyAsync(require$$3$1.promisify(fs$F.close), RETRYIFY_OPTIONS),
|
|
11376
|
+
fsync: retryifyAsync(require$$3$1.promisify(fs$F.fsync), RETRYIFY_OPTIONS),
|
|
11377
|
+
open: retryifyAsync(require$$3$1.promisify(fs$F.open), RETRYIFY_OPTIONS),
|
|
11378
|
+
readFile: retryifyAsync(require$$3$1.promisify(fs$F.readFile), RETRYIFY_OPTIONS),
|
|
11379
|
+
rename: retryifyAsync(require$$3$1.promisify(fs$F.rename), RETRYIFY_OPTIONS),
|
|
11380
|
+
stat: retryifyAsync(require$$3$1.promisify(fs$F.stat), RETRYIFY_OPTIONS),
|
|
11381
|
+
write: retryifyAsync(require$$3$1.promisify(fs$F.write), RETRYIFY_OPTIONS),
|
|
11382
|
+
writeFile: retryifyAsync(require$$3$1.promisify(fs$F.writeFile), RETRYIFY_OPTIONS),
|
|
11383
11383
|
/* SYNC */
|
|
11384
|
-
closeSync: retryifySync(fs$
|
|
11385
|
-
fsyncSync: retryifySync(fs$
|
|
11386
|
-
openSync: retryifySync(fs$
|
|
11387
|
-
readFileSync: retryifySync(fs$
|
|
11388
|
-
renameSync: retryifySync(fs$
|
|
11389
|
-
statSync: retryifySync(fs$
|
|
11390
|
-
writeSync: retryifySync(fs$
|
|
11391
|
-
writeFileSync: retryifySync(fs$
|
|
11384
|
+
closeSync: retryifySync(fs$F.closeSync, RETRYIFY_OPTIONS),
|
|
11385
|
+
fsyncSync: retryifySync(fs$F.fsyncSync, RETRYIFY_OPTIONS),
|
|
11386
|
+
openSync: retryifySync(fs$F.openSync, RETRYIFY_OPTIONS),
|
|
11387
|
+
readFileSync: retryifySync(fs$F.readFileSync, RETRYIFY_OPTIONS),
|
|
11388
|
+
renameSync: retryifySync(fs$F.renameSync, RETRYIFY_OPTIONS),
|
|
11389
|
+
statSync: retryifySync(fs$F.statSync, RETRYIFY_OPTIONS),
|
|
11390
|
+
writeSync: retryifySync(fs$F.writeSync, RETRYIFY_OPTIONS),
|
|
11391
|
+
writeFileSync: retryifySync(fs$F.writeFileSync, RETRYIFY_OPTIONS)
|
|
11392
11392
|
}
|
|
11393
11393
|
};
|
|
11394
11394
|
|
|
@@ -11625,7 +11625,7 @@ async function writeFileAsync(filePath, data, options = DEFAULT_WRITE_OPTIONS) {
|
|
|
11625
11625
|
await FS.retry.write(retryOptions)(fd, data, 0, options.encoding || DEFAULT_ENCODING);
|
|
11626
11626
|
}
|
|
11627
11627
|
else if (data instanceof require$$0$b.Readable) {
|
|
11628
|
-
const writeStream = fs$
|
|
11628
|
+
const writeStream = fs$F.createWriteStream(tempPath, { fd, autoClose: false });
|
|
11629
11629
|
const finishPromise = EventEmitter$k.once(writeStream, 'finish');
|
|
11630
11630
|
data.pipe(writeStream);
|
|
11631
11631
|
await finishPromise;
|
|
@@ -11744,8 +11744,8 @@ class CommonPreset {
|
|
|
11744
11744
|
// 读取所有预设
|
|
11745
11745
|
async list() {
|
|
11746
11746
|
const presetsPath = this.filepath;
|
|
11747
|
-
if (await fs$
|
|
11748
|
-
const presets = await fs$
|
|
11747
|
+
if (await fs$m.pathExists(presetsPath)) {
|
|
11748
|
+
const presets = await fs$m.readJSON(presetsPath);
|
|
11749
11749
|
presets.map((preset) => {
|
|
11750
11750
|
preset.config = { ...this.defaultConfig, ...preset.config };
|
|
11751
11751
|
return preset;
|
|
@@ -11850,6 +11850,7 @@ const APP_DEFAULT_CONFIG = {
|
|
|
11850
11850
|
biliUploadFileNameType: "ask",
|
|
11851
11851
|
cutPageInNewWindow: false,
|
|
11852
11852
|
bilibiliUser: {},
|
|
11853
|
+
douyuUser: {},
|
|
11853
11854
|
tool: {
|
|
11854
11855
|
home: {
|
|
11855
11856
|
uploadPresetId: "default",
|
|
@@ -11951,6 +11952,7 @@ const APP_DEFAULT_CONFIG = {
|
|
|
11951
11952
|
threshold: 10,
|
|
11952
11953
|
},
|
|
11953
11954
|
sync: [],
|
|
11955
|
+
douyuAccountExpiry: false,
|
|
11954
11956
|
},
|
|
11955
11957
|
setting: {
|
|
11956
11958
|
type: undefined,
|
|
@@ -11988,6 +11990,7 @@ const APP_DEFAULT_CONFIG = {
|
|
|
11988
11990
|
taskNotificationType: {
|
|
11989
11991
|
liveStart: "system",
|
|
11990
11992
|
chargeLive: "system",
|
|
11993
|
+
douyuAccountExpiry: null,
|
|
11991
11994
|
},
|
|
11992
11995
|
},
|
|
11993
11996
|
sync: {
|
|
@@ -12142,9 +12145,9 @@ const APP_DEFAULT_CONFIG = {
|
|
|
12142
12145
|
waitTime: undefined,
|
|
12143
12146
|
},
|
|
12144
12147
|
douyu: {
|
|
12148
|
+
uid: undefined,
|
|
12145
12149
|
quality: 0,
|
|
12146
12150
|
source: "auto",
|
|
12147
|
-
cookie: "",
|
|
12148
12151
|
checkInterval: undefined,
|
|
12149
12152
|
maxThreadCount: undefined,
|
|
12150
12153
|
waitTime: undefined,
|
|
@@ -40041,7 +40044,7 @@ var path$c = require$$0$7;
|
|
|
40041
40044
|
var http$e = require$$1$4;
|
|
40042
40045
|
var https$b = require$$1$5;
|
|
40043
40046
|
var parseUrl$2 = require$$0$9.parse;
|
|
40044
|
-
var fs$
|
|
40047
|
+
var fs$d = require$$0$6;
|
|
40045
40048
|
var Stream$2 = require$$0$4.Stream;
|
|
40046
40049
|
var crypto$c = require$$1$6;
|
|
40047
40050
|
var mime = mimeTypes$3;
|
|
@@ -40168,7 +40171,7 @@ FormData$1.prototype._lengthRetriever = function (value, callback) {
|
|
|
40168
40171
|
// not that fast snoopy
|
|
40169
40172
|
} else {
|
|
40170
40173
|
// still need to fetch file size from fs
|
|
40171
|
-
fs$
|
|
40174
|
+
fs$d.stat(value.path, function (err, stat) {
|
|
40172
40175
|
if (err) {
|
|
40173
40176
|
callback(err);
|
|
40174
40177
|
return;
|
|
@@ -47298,7 +47301,7 @@ const {
|
|
|
47298
47301
|
mergeConfig,
|
|
47299
47302
|
} = axios;
|
|
47300
47303
|
|
|
47301
|
-
const fs$
|
|
47304
|
+
const fs$c = require$$0$6;
|
|
47302
47305
|
const path$b = require$$0$7;
|
|
47303
47306
|
|
|
47304
47307
|
var packageJson$1 = {
|
|
@@ -47334,7 +47337,7 @@ function tryReadJsonAt(...searchPaths) {
|
|
|
47334
47337
|
return undefined;
|
|
47335
47338
|
}
|
|
47336
47339
|
|
|
47337
|
-
const json = JSON.parse(fs$
|
|
47340
|
+
const json = JSON.parse(fs$c.readFileSync(fileName, 'utf8'));
|
|
47338
47341
|
const name = json?.productName || json?.name;
|
|
47339
47342
|
if (!name || name.toLowerCase() === 'electron') {
|
|
47340
47343
|
return undefined;
|
|
@@ -47363,7 +47366,7 @@ function findUp(fileName, cwd) {
|
|
|
47363
47366
|
const root = parsedPath.root;
|
|
47364
47367
|
const dir = parsedPath.dir;
|
|
47365
47368
|
|
|
47366
|
-
if (fs$
|
|
47369
|
+
if (fs$c.existsSync(path$b.join(currentPath, fileName))) {
|
|
47367
47370
|
return path$b.resolve(path$b.join(currentPath, fileName));
|
|
47368
47371
|
}
|
|
47369
47372
|
|
|
@@ -48715,7 +48718,7 @@ function levelToStyle(level) {
|
|
|
48715
48718
|
}
|
|
48716
48719
|
|
|
48717
48720
|
const EventEmitter$j = require$$0$8;
|
|
48718
|
-
const fs$
|
|
48721
|
+
const fs$b = require$$0$6;
|
|
48719
48722
|
const os$2 = require$$1$2;
|
|
48720
48723
|
|
|
48721
48724
|
let File$3 = class File extends EventEmitter$j {
|
|
@@ -48745,7 +48748,7 @@ let File$3 = class File extends EventEmitter$j {
|
|
|
48745
48748
|
|
|
48746
48749
|
clear() {
|
|
48747
48750
|
try {
|
|
48748
|
-
fs$
|
|
48751
|
+
fs$b.writeFileSync(this.path, '', {
|
|
48749
48752
|
mode: this.writeOptions.mode,
|
|
48750
48753
|
flag: 'w',
|
|
48751
48754
|
});
|
|
@@ -48778,7 +48781,7 @@ let File$3 = class File extends EventEmitter$j {
|
|
|
48778
48781
|
getSize() {
|
|
48779
48782
|
if (this.initialSize === undefined) {
|
|
48780
48783
|
try {
|
|
48781
|
-
const stats = fs$
|
|
48784
|
+
const stats = fs$b.statSync(this.path);
|
|
48782
48785
|
this.initialSize = stats.size;
|
|
48783
48786
|
} catch (e) {
|
|
48784
48787
|
this.initialSize = 0;
|
|
@@ -48807,7 +48810,7 @@ let File$3 = class File extends EventEmitter$j {
|
|
|
48807
48810
|
this.asyncWriteQueue = [];
|
|
48808
48811
|
this.hasActiveAsyncWriting = true;
|
|
48809
48812
|
|
|
48810
|
-
fs$
|
|
48813
|
+
fs$b.writeFile(this.path, text, this.writeOptions, (e) => {
|
|
48811
48814
|
file.hasActiveAsyncWriting = false;
|
|
48812
48815
|
|
|
48813
48816
|
if (e) {
|
|
@@ -48843,7 +48846,7 @@ let File$3 = class File extends EventEmitter$j {
|
|
|
48843
48846
|
}
|
|
48844
48847
|
|
|
48845
48848
|
try {
|
|
48846
|
-
fs$
|
|
48849
|
+
fs$b.writeFileSync(this.path, text, this.writeOptions);
|
|
48847
48850
|
this.increaseBytesWrittenCounter(text);
|
|
48848
48851
|
} catch (e) {
|
|
48849
48852
|
this.emit(
|
|
@@ -48859,14 +48862,14 @@ var File_1 = File$3;
|
|
|
48859
48862
|
|
|
48860
48863
|
function readFileSyncFromEnd(filePath, bytesCount) {
|
|
48861
48864
|
const buffer = Buffer.alloc(bytesCount);
|
|
48862
|
-
const stats = fs$
|
|
48865
|
+
const stats = fs$b.statSync(filePath);
|
|
48863
48866
|
|
|
48864
48867
|
const readLength = Math.min(stats.size, bytesCount);
|
|
48865
48868
|
const offset = Math.max(0, stats.size - bytesCount);
|
|
48866
48869
|
|
|
48867
|
-
const fd = fs$
|
|
48868
|
-
const totalBytes = fs$
|
|
48869
|
-
fs$
|
|
48870
|
+
const fd = fs$b.openSync(filePath, 'r');
|
|
48871
|
+
const totalBytes = fs$b.readSync(fd, buffer, 0, readLength, offset);
|
|
48872
|
+
fs$b.closeSync(fd);
|
|
48870
48873
|
|
|
48871
48874
|
return buffer.toString('utf8', 0, totalBytes);
|
|
48872
48875
|
}
|
|
@@ -48898,7 +48901,7 @@ let NullFile$1 = class NullFile extends File$2 {
|
|
|
48898
48901
|
var NullFile_1 = NullFile$1;
|
|
48899
48902
|
|
|
48900
48903
|
const EventEmitter$i = require$$0$8;
|
|
48901
|
-
const fs$
|
|
48904
|
+
const fs$a = require$$0$6;
|
|
48902
48905
|
const path$9 = require$$0$7;
|
|
48903
48906
|
const File$1 = File_1;
|
|
48904
48907
|
const NullFile = NullFile_1;
|
|
@@ -48965,14 +48968,14 @@ let FileRegistry$1 = class FileRegistry extends EventEmitter$i {
|
|
|
48965
48968
|
* @private
|
|
48966
48969
|
*/
|
|
48967
48970
|
testFileWriting({ filePath, writeOptions }) {
|
|
48968
|
-
fs$
|
|
48969
|
-
fs$
|
|
48971
|
+
fs$a.mkdirSync(path$9.dirname(filePath), { recursive: true });
|
|
48972
|
+
fs$a.writeFileSync(filePath, '', { flag: 'a', mode: writeOptions.mode });
|
|
48970
48973
|
}
|
|
48971
48974
|
};
|
|
48972
48975
|
|
|
48973
48976
|
var FileRegistry_1 = FileRegistry$1;
|
|
48974
48977
|
|
|
48975
|
-
const fs$
|
|
48978
|
+
const fs$9 = require$$0$6;
|
|
48976
48979
|
const os$1 = require$$1$2;
|
|
48977
48980
|
const path$8 = require$$0$7;
|
|
48978
48981
|
const FileRegistry = FileRegistry_1;
|
|
@@ -49018,7 +49021,7 @@ function fileTransportFactory(
|
|
|
49018
49021
|
const oldPath = file.toString();
|
|
49019
49022
|
const inf = path$8.parse(oldPath);
|
|
49020
49023
|
try {
|
|
49021
|
-
fs$
|
|
49024
|
+
fs$9.renameSync(oldPath, path$8.join(inf.dir, `${inf.name}.old${inf.ext}`));
|
|
49022
49025
|
} catch (e) {
|
|
49023
49026
|
logConsole('Could not rotate log', e);
|
|
49024
49027
|
const quarterOfMaxSize = Math.round(transport.maxSize / 4);
|
|
@@ -49107,18 +49110,18 @@ function fileTransportFactory(
|
|
|
49107
49110
|
initializeOnFirstAccess();
|
|
49108
49111
|
const logsPath = path$8.dirname(transport.resolvePathFn(pathVariables));
|
|
49109
49112
|
|
|
49110
|
-
if (!fs$
|
|
49113
|
+
if (!fs$9.existsSync(logsPath)) {
|
|
49111
49114
|
return [];
|
|
49112
49115
|
}
|
|
49113
49116
|
|
|
49114
|
-
return fs$
|
|
49117
|
+
return fs$9.readdirSync(logsPath)
|
|
49115
49118
|
.map((fileName) => path$8.join(logsPath, fileName))
|
|
49116
49119
|
.filter(fileFilter)
|
|
49117
49120
|
.map((logPath) => {
|
|
49118
49121
|
try {
|
|
49119
49122
|
return {
|
|
49120
49123
|
path: logPath,
|
|
49121
|
-
lines: fs$
|
|
49124
|
+
lines: fs$9.readFileSync(logPath, 'utf8').split(os$1.EOL),
|
|
49122
49125
|
};
|
|
49123
49126
|
} catch {
|
|
49124
49127
|
return null;
|
|
@@ -50725,7 +50728,7 @@ var old$1 = {};
|
|
|
50725
50728
|
|
|
50726
50729
|
var pathModule = require$$0$7;
|
|
50727
50730
|
var isWindows$2 = process.platform === 'win32';
|
|
50728
|
-
var fs$
|
|
50731
|
+
var fs$8 = require$$0$6;
|
|
50729
50732
|
|
|
50730
50733
|
// JavaScript implementation of realpath, ported from node pre-v6
|
|
50731
50734
|
|
|
@@ -50820,7 +50823,7 @@ old$1.realpathSync = function realpathSync(p, cache) {
|
|
|
50820
50823
|
|
|
50821
50824
|
// On windows, check that the root exists. On unix there is no need.
|
|
50822
50825
|
if (isWindows$2 && !knownHard[base]) {
|
|
50823
|
-
fs$
|
|
50826
|
+
fs$8.lstatSync(base);
|
|
50824
50827
|
knownHard[base] = true;
|
|
50825
50828
|
}
|
|
50826
50829
|
}
|
|
@@ -50847,7 +50850,7 @@ old$1.realpathSync = function realpathSync(p, cache) {
|
|
|
50847
50850
|
// some known symbolic link. no need to stat again.
|
|
50848
50851
|
resolvedLink = cache[base];
|
|
50849
50852
|
} else {
|
|
50850
|
-
var stat = fs$
|
|
50853
|
+
var stat = fs$8.lstatSync(base);
|
|
50851
50854
|
if (!stat.isSymbolicLink()) {
|
|
50852
50855
|
knownHard[base] = true;
|
|
50853
50856
|
if (cache) cache[base] = base;
|
|
@@ -50864,8 +50867,8 @@ old$1.realpathSync = function realpathSync(p, cache) {
|
|
|
50864
50867
|
}
|
|
50865
50868
|
}
|
|
50866
50869
|
if (linkTarget === null) {
|
|
50867
|
-
fs$
|
|
50868
|
-
linkTarget = fs$
|
|
50870
|
+
fs$8.statSync(base);
|
|
50871
|
+
linkTarget = fs$8.readlinkSync(base);
|
|
50869
50872
|
}
|
|
50870
50873
|
resolvedLink = pathModule.resolve(previous, linkTarget);
|
|
50871
50874
|
// track this, if given a cache.
|
|
@@ -50922,7 +50925,7 @@ old$1.realpath = function realpath(p, cache, cb) {
|
|
|
50922
50925
|
|
|
50923
50926
|
// On windows, check that the root exists. On unix there is no need.
|
|
50924
50927
|
if (isWindows$2 && !knownHard[base]) {
|
|
50925
|
-
fs$
|
|
50928
|
+
fs$8.lstat(base, function(err) {
|
|
50926
50929
|
if (err) return cb(err);
|
|
50927
50930
|
knownHard[base] = true;
|
|
50928
50931
|
LOOP();
|
|
@@ -50959,7 +50962,7 @@ old$1.realpath = function realpath(p, cache, cb) {
|
|
|
50959
50962
|
return gotResolvedLink(cache[base]);
|
|
50960
50963
|
}
|
|
50961
50964
|
|
|
50962
|
-
return fs$
|
|
50965
|
+
return fs$8.lstat(base, gotStat);
|
|
50963
50966
|
}
|
|
50964
50967
|
|
|
50965
50968
|
function gotStat(err, stat) {
|
|
@@ -50981,10 +50984,10 @@ old$1.realpath = function realpath(p, cache, cb) {
|
|
|
50981
50984
|
return gotTarget(null, seenLinks[id], base);
|
|
50982
50985
|
}
|
|
50983
50986
|
}
|
|
50984
|
-
fs$
|
|
50987
|
+
fs$8.stat(base, function(err) {
|
|
50985
50988
|
if (err) return cb(err);
|
|
50986
50989
|
|
|
50987
|
-
fs$
|
|
50990
|
+
fs$8.readlink(base, function(err, target) {
|
|
50988
50991
|
if (!isWindows$2) seenLinks[id] = target;
|
|
50989
50992
|
gotTarget(err, target);
|
|
50990
50993
|
});
|
|
@@ -51013,9 +51016,9 @@ realpath.realpathSync = realpathSync;
|
|
|
51013
51016
|
realpath.monkeypatch = monkeypatch;
|
|
51014
51017
|
realpath.unmonkeypatch = unmonkeypatch;
|
|
51015
51018
|
|
|
51016
|
-
var fs$
|
|
51017
|
-
var origRealpath = fs$
|
|
51018
|
-
var origRealpathSync = fs$
|
|
51019
|
+
var fs$7 = require$$0$6;
|
|
51020
|
+
var origRealpath = fs$7.realpath;
|
|
51021
|
+
var origRealpathSync = fs$7.realpathSync;
|
|
51019
51022
|
|
|
51020
51023
|
var version$2 = process.version;
|
|
51021
51024
|
var ok = /^v[0-5]\./.test(version$2);
|
|
@@ -51064,13 +51067,13 @@ function realpathSync (p, cache) {
|
|
|
51064
51067
|
}
|
|
51065
51068
|
|
|
51066
51069
|
function monkeypatch () {
|
|
51067
|
-
fs$
|
|
51068
|
-
fs$
|
|
51070
|
+
fs$7.realpath = realpath;
|
|
51071
|
+
fs$7.realpathSync = realpathSync;
|
|
51069
51072
|
}
|
|
51070
51073
|
|
|
51071
51074
|
function unmonkeypatch () {
|
|
51072
|
-
fs$
|
|
51073
|
-
fs$
|
|
51075
|
+
fs$7.realpath = origRealpath;
|
|
51076
|
+
fs$7.realpathSync = origRealpathSync;
|
|
51074
51077
|
}
|
|
51075
51078
|
|
|
51076
51079
|
var concatMap$1 = function (xs, fn) {
|
|
@@ -52382,7 +52385,7 @@ function ownProp (obj, field) {
|
|
|
52382
52385
|
return Object.prototype.hasOwnProperty.call(obj, field)
|
|
52383
52386
|
}
|
|
52384
52387
|
|
|
52385
|
-
var fs$
|
|
52388
|
+
var fs$6 = require$$0$6;
|
|
52386
52389
|
var path$6 = require$$0$7;
|
|
52387
52390
|
var minimatch = minimatch_1;
|
|
52388
52391
|
var isAbsolute = pathIsAbsoluteExports;
|
|
@@ -52448,7 +52451,7 @@ function setopts (self, pattern, options) {
|
|
|
52448
52451
|
self.stat = !!options.stat;
|
|
52449
52452
|
self.noprocess = !!options.noprocess;
|
|
52450
52453
|
self.absolute = !!options.absolute;
|
|
52451
|
-
self.fs = options.fs || fs$
|
|
52454
|
+
self.fs = options.fs || fs$6;
|
|
52452
52455
|
|
|
52453
52456
|
self.maxLength = options.maxLength || Infinity;
|
|
52454
52457
|
self.cache = options.cache || Object.create(null);
|
|
@@ -54117,7 +54120,7 @@ var dirGlob$1 = {exports: {}};
|
|
|
54117
54120
|
|
|
54118
54121
|
var pathType$1 = {};
|
|
54119
54122
|
|
|
54120
|
-
const fs$
|
|
54123
|
+
const fs$5 = require$$0$6;
|
|
54121
54124
|
const pify$2 = pify$3;
|
|
54122
54125
|
|
|
54123
54126
|
function type$1(fn, fn2, fp) {
|
|
@@ -54125,7 +54128,7 @@ function type$1(fn, fn2, fp) {
|
|
|
54125
54128
|
return Promise.reject(new TypeError(`Expected a string, got ${typeof fp}`));
|
|
54126
54129
|
}
|
|
54127
54130
|
|
|
54128
|
-
return pify$2(fs$
|
|
54131
|
+
return pify$2(fs$5[fn])(fp)
|
|
54129
54132
|
.then(stats => stats[fn2]())
|
|
54130
54133
|
.catch(err => {
|
|
54131
54134
|
if (err.code === 'ENOENT') {
|
|
@@ -54142,7 +54145,7 @@ function typeSync(fn, fn2, fp) {
|
|
|
54142
54145
|
}
|
|
54143
54146
|
|
|
54144
54147
|
try {
|
|
54145
|
-
return fs$
|
|
54148
|
+
return fs$5[fn](fp)[fn2]();
|
|
54146
54149
|
} catch (err) {
|
|
54147
54150
|
if (err.code === 'ENOENT') {
|
|
54148
54151
|
return false;
|
|
@@ -54663,7 +54666,7 @@ var slash$1 = function (str) {
|
|
|
54663
54666
|
return str.replace(/\\/g, '/');
|
|
54664
54667
|
};
|
|
54665
54668
|
|
|
54666
|
-
const fs$
|
|
54669
|
+
const fs$4 = require$$0$6;
|
|
54667
54670
|
const path$4 = require$$0$7;
|
|
54668
54671
|
const glob$1 = requireGlob();
|
|
54669
54672
|
const gitIgnore = ignore;
|
|
@@ -54671,7 +54674,7 @@ const pify$1 = pify$3;
|
|
|
54671
54674
|
const slash = slash$1;
|
|
54672
54675
|
|
|
54673
54676
|
const globP$1 = pify$1(glob$1);
|
|
54674
|
-
const readFileP = pify$1(fs$
|
|
54677
|
+
const readFileP = pify$1(fs$4.readFile);
|
|
54675
54678
|
|
|
54676
54679
|
const mapGitIgnorePatternTo = base => ignore => {
|
|
54677
54680
|
if (ignore.startsWith('!')) {
|
|
@@ -54717,7 +54720,7 @@ const getFile = (file, cwd) => {
|
|
|
54717
54720
|
|
|
54718
54721
|
const getFileSync = (file, cwd) => {
|
|
54719
54722
|
const filePath = path$4.join(cwd, file);
|
|
54720
|
-
const content = fs$
|
|
54723
|
+
const content = fs$4.readFileSync(filePath, 'utf8');
|
|
54721
54724
|
|
|
54722
54725
|
return {
|
|
54723
54726
|
content,
|
|
@@ -54924,7 +54927,7 @@ async function trash(paths, options) {
|
|
|
54924
54927
|
}
|
|
54925
54928
|
|
|
54926
54929
|
try {
|
|
54927
|
-
await fs$
|
|
54930
|
+
await fs$F.promises.lstat(filePath);
|
|
54928
54931
|
} catch (error) {
|
|
54929
54932
|
if (error.code === 'ENOENT') {
|
|
54930
54933
|
return;
|
|
@@ -54948,7 +54951,7 @@ async function trash(paths, options) {
|
|
|
54948
54951
|
} else if (process$2.platform === 'win32') {
|
|
54949
54952
|
module = await Promise.resolve().then(function () { return require('./windows-C30k1cv-.cjs'); });
|
|
54950
54953
|
} else {
|
|
54951
|
-
module = await Promise.resolve().then(function () { return require('./linux-
|
|
54954
|
+
module = await Promise.resolve().then(function () { return require('./linux-Cy2IwLL8.cjs'); });
|
|
54952
54955
|
}
|
|
54953
54956
|
|
|
54954
54957
|
return module.default(paths);
|
|
@@ -60211,14 +60214,14 @@ class Config extends TypedEmitter {
|
|
|
60211
60214
|
}
|
|
60212
60215
|
save() {
|
|
60213
60216
|
// 保存文件
|
|
60214
|
-
fs$
|
|
60217
|
+
fs$F.writeFileSync(this.filepath, JSON.stringify(this.data));
|
|
60215
60218
|
}
|
|
60216
60219
|
load(filepath) {
|
|
60217
60220
|
this.filepath = filepath;
|
|
60218
60221
|
}
|
|
60219
60222
|
init(filepath, initData = {}) {
|
|
60220
60223
|
this.filepath = filepath;
|
|
60221
|
-
if (!fs$
|
|
60224
|
+
if (!fs$F.existsSync(this.filepath)) {
|
|
60222
60225
|
this.data = initData;
|
|
60223
60226
|
}
|
|
60224
60227
|
else {
|
|
@@ -60241,7 +60244,7 @@ class Config extends TypedEmitter {
|
|
|
60241
60244
|
}
|
|
60242
60245
|
read() {
|
|
60243
60246
|
// 读取文件
|
|
60244
|
-
this.data = JSON.parse(fs$
|
|
60247
|
+
this.data = JSON.parse(fs$F.readFileSync(this.filepath, "utf-8"));
|
|
60245
60248
|
return this.data;
|
|
60246
60249
|
}
|
|
60247
60250
|
}
|
|
@@ -61911,11 +61914,11 @@ const uuid$4 = () => {
|
|
|
61911
61914
|
return crypto$d.randomUUID();
|
|
61912
61915
|
};
|
|
61913
61916
|
const pathExists = async (path) => {
|
|
61914
|
-
return await fs$
|
|
61917
|
+
return await fs$m.pathExists(path);
|
|
61915
61918
|
};
|
|
61916
61919
|
const deleteFile = async (path) => {
|
|
61917
61920
|
try {
|
|
61918
|
-
await fs$
|
|
61921
|
+
await fs$m.unlink(path);
|
|
61919
61922
|
}
|
|
61920
61923
|
catch (error) {
|
|
61921
61924
|
console.error(error);
|
|
@@ -61935,7 +61938,7 @@ const trashItem = async (path) => {
|
|
|
61935
61938
|
};
|
|
61936
61939
|
const isWin32 = process.platform === "win32";
|
|
61937
61940
|
async function getFileSize$1(filePath) {
|
|
61938
|
-
const stats = await fs$
|
|
61941
|
+
const stats = await fs$m.promises.stat(filePath);
|
|
61939
61942
|
const fileSizeInBytes = stats.size;
|
|
61940
61943
|
return fileSizeInBytes;
|
|
61941
61944
|
}
|
|
@@ -61976,18 +61979,18 @@ function getTempPath() {
|
|
|
61976
61979
|
}
|
|
61977
61980
|
if (cacheFolder) {
|
|
61978
61981
|
try {
|
|
61979
|
-
fs$
|
|
61982
|
+
fs$m.ensureDirSync(cacheFolder);
|
|
61980
61983
|
return cacheFolder;
|
|
61981
61984
|
}
|
|
61982
61985
|
catch (e) {
|
|
61983
61986
|
console.error("缓存文件夹创建失败,使用系统临时文件夹", e);
|
|
61984
61987
|
}
|
|
61985
61988
|
}
|
|
61986
|
-
fs$
|
|
61989
|
+
fs$m.ensureDirSync(cacheFolder);
|
|
61987
61990
|
return cacheFolder;
|
|
61988
61991
|
}
|
|
61989
61992
|
async function readLines(filePath, startLine, endLine) {
|
|
61990
|
-
const fileStream = fs$
|
|
61993
|
+
const fileStream = fs$m.createReadStream(filePath);
|
|
61991
61994
|
const rl = readline.createInterface({
|
|
61992
61995
|
input: fileStream,
|
|
61993
61996
|
crlfDelay: Infinity,
|
|
@@ -62065,7 +62068,7 @@ const parseSavePath = async (input, options, createDir = true) => {
|
|
|
62065
62068
|
throw new Error("没有找到保存路径");
|
|
62066
62069
|
}
|
|
62067
62070
|
if (createDir && !(await pathExists(savePath))) {
|
|
62068
|
-
await fs$
|
|
62071
|
+
await fs$m.ensureDir(savePath);
|
|
62069
62072
|
}
|
|
62070
62073
|
return savePath;
|
|
62071
62074
|
};
|
|
@@ -62108,7 +62111,7 @@ async function getUnusedFileName(filePath) {
|
|
|
62108
62111
|
const baseName = path$z.basename(filePath, ext);
|
|
62109
62112
|
let newFilePath = filePath;
|
|
62110
62113
|
let counter = 1;
|
|
62111
|
-
while (await fs$
|
|
62114
|
+
while (await fs$m.pathExists(newFilePath)) {
|
|
62112
62115
|
newFilePath = path$z.join(dir, `${baseName}(${counter})${ext}`);
|
|
62113
62116
|
counter++;
|
|
62114
62117
|
if (counter > 100) {
|
|
@@ -62132,7 +62135,7 @@ async function calculateFileQuickHash(filePath, headSize = 1 * 1024 * 1024, tail
|
|
|
62132
62135
|
// 如果文件小于等于头部大小,直接读取整个文件
|
|
62133
62136
|
if (fileSize <= headSize) {
|
|
62134
62137
|
return new Promise((resolve, reject) => {
|
|
62135
|
-
const stream = fs$
|
|
62138
|
+
const stream = fs$F.createReadStream(filePath);
|
|
62136
62139
|
stream.on("data", (chunk) => {
|
|
62137
62140
|
hash.update(chunk);
|
|
62138
62141
|
});
|
|
@@ -62144,7 +62147,7 @@ async function calculateFileQuickHash(filePath, headSize = 1 * 1024 * 1024, tail
|
|
|
62144
62147
|
}
|
|
62145
62148
|
// 读取头部
|
|
62146
62149
|
await new Promise((resolve, reject) => {
|
|
62147
|
-
const headStream = fs$
|
|
62150
|
+
const headStream = fs$F.createReadStream(filePath, {
|
|
62148
62151
|
start: 0,
|
|
62149
62152
|
end: headSize - 1,
|
|
62150
62153
|
highWaterMark: 64 * 1024,
|
|
@@ -62160,7 +62163,7 @@ async function calculateFileQuickHash(filePath, headSize = 1 * 1024 * 1024, tail
|
|
|
62160
62163
|
// 读取尾部
|
|
62161
62164
|
await new Promise((resolve, reject) => {
|
|
62162
62165
|
const tailStart = Math.max(headSize, fileSize - tailSize);
|
|
62163
|
-
const tailStream = fs$
|
|
62166
|
+
const tailStream = fs$F.createReadStream(filePath, {
|
|
62164
62167
|
start: tailStart,
|
|
62165
62168
|
end: fileSize - 1,
|
|
62166
62169
|
highWaterMark: 64 * 1024,
|
|
@@ -62259,7 +62262,7 @@ function RGB2BGR(color, reverseAlpha = true) {
|
|
|
62259
62262
|
|
|
62260
62263
|
async function getFileSize(filePath) {
|
|
62261
62264
|
try {
|
|
62262
|
-
const stats = await fs$
|
|
62265
|
+
const stats = await fs$F.promises.stat(filePath);
|
|
62263
62266
|
const fileSizeInBytes = stats.size;
|
|
62264
62267
|
return fileSizeInBytes;
|
|
62265
62268
|
}
|
|
@@ -62270,11 +62273,11 @@ async function getFileSize(filePath) {
|
|
|
62270
62273
|
let isString$1 = (value) => typeof value === "string";
|
|
62271
62274
|
function createReadStream(filePath, start, numBytes, totalBytes) {
|
|
62272
62275
|
const endByte = Math.min(start + numBytes - 1, totalBytes - 1);
|
|
62273
|
-
const readStream = fs$
|
|
62276
|
+
const readStream = fs$F.createReadStream(filePath, { start, end: endByte });
|
|
62274
62277
|
return [readStream, endByte - start + 1];
|
|
62275
62278
|
}
|
|
62276
62279
|
async function readFileAsBase64(filePath) {
|
|
62277
|
-
return fs$
|
|
62280
|
+
return fs$F.promises
|
|
62278
62281
|
.readFile(filePath)
|
|
62279
62282
|
.then(data => {
|
|
62280
62283
|
// 获取文件扩展名
|
|
@@ -62997,7 +63000,7 @@ class Auth {
|
|
|
62997
63000
|
* @param path cookie文件路径
|
|
62998
63001
|
*/
|
|
62999
63002
|
async loadCookieFile(path) {
|
|
63000
|
-
const cookie = await fs$
|
|
63003
|
+
const cookie = await fs$F.promises.readFile(path, "utf-8");
|
|
63001
63004
|
const cookieObj = JSON.parse(cookie);
|
|
63002
63005
|
const cookieStr = cookieObj.cookie_info.cookies
|
|
63003
63006
|
.map((item) => `${item.name}=${item.value}`)
|
|
@@ -65320,7 +65323,7 @@ class WebVideoUploader extends BaseRequest {
|
|
|
65320
65323
|
}
|
|
65321
65324
|
}
|
|
65322
65325
|
getFileSizeSync(filePath) {
|
|
65323
|
-
const stats = fs$
|
|
65326
|
+
const stats = fs$F.statSync(filePath);
|
|
65324
65327
|
const fileSizeInBytes = stats.size;
|
|
65325
65328
|
return fileSizeInBytes;
|
|
65326
65329
|
}
|
|
@@ -67062,7 +67065,7 @@ class RangeDownloader {
|
|
|
67062
67065
|
return;
|
|
67063
67066
|
if (this.status === "pending") {
|
|
67064
67067
|
try {
|
|
67065
|
-
await fs$
|
|
67068
|
+
await fs$F.promises.unlink(this.filePath);
|
|
67066
67069
|
}
|
|
67067
67070
|
catch (error) { }
|
|
67068
67071
|
}
|
|
@@ -67116,7 +67119,7 @@ class RangeDownloader {
|
|
|
67116
67119
|
_self.totalSize = isNaN(_self.totalSize)
|
|
67117
67120
|
? parseInt(response.headers["content-length"] || "0", 10)
|
|
67118
67121
|
: _self.totalSize;
|
|
67119
|
-
const writableStream = fs$
|
|
67122
|
+
const writableStream = fs$F.createWriteStream(this.filePath, {
|
|
67120
67123
|
flags: "a",
|
|
67121
67124
|
});
|
|
67122
67125
|
response.data.pipe(writableStream);
|
|
@@ -67527,7 +67530,7 @@ class Video extends BaseRequest {
|
|
|
67527
67530
|
});
|
|
67528
67531
|
const jsonData = (await res.json());
|
|
67529
67532
|
const srtData = subtitleJsonToSrt(jsonData);
|
|
67530
|
-
fs$
|
|
67533
|
+
fs$F.writeFileSync(options.output, srtData);
|
|
67531
67534
|
return options.output;
|
|
67532
67535
|
}
|
|
67533
67536
|
authAid() {
|
|
@@ -67711,8 +67714,8 @@ class Video extends BaseRequest {
|
|
|
67711
67714
|
}
|
|
67712
67715
|
const clean = () => {
|
|
67713
67716
|
try {
|
|
67714
|
-
fs$
|
|
67715
|
-
fs$
|
|
67717
|
+
fs$F.promises.unlink(videoDownloader.filePath);
|
|
67718
|
+
fs$F.promises.unlink(audioDownloader.filePath);
|
|
67716
67719
|
}
|
|
67717
67720
|
catch (error) {
|
|
67718
67721
|
console.warn(error);
|
|
@@ -67826,7 +67829,7 @@ class Video extends BaseRequest {
|
|
|
67826
67829
|
});
|
|
67827
67830
|
const clean = () => {
|
|
67828
67831
|
try {
|
|
67829
|
-
fs$
|
|
67832
|
+
fs$F.promises.unlink(videoDownloader.filePath);
|
|
67830
67833
|
}
|
|
67831
67834
|
catch (error) {
|
|
67832
67835
|
console.warn(error);
|
|
@@ -75940,7 +75943,7 @@ class BcutASR {
|
|
|
75940
75943
|
* 从文件设置数据
|
|
75941
75944
|
*/
|
|
75942
75945
|
setDataFromFile(file) {
|
|
75943
|
-
this.soundBin = fs$
|
|
75946
|
+
this.soundBin = fs$F.readFileSync(file);
|
|
75944
75947
|
const suffix = file.split(".").pop()?.toLowerCase();
|
|
75945
75948
|
if (!this.isSupportFormat(suffix)) {
|
|
75946
75949
|
throw new TypeError(`Format ${suffix} is not supported`);
|
|
@@ -78337,7 +78340,7 @@ class M3U8Downloader extends TypedEmitter {
|
|
|
78337
78340
|
this.totalSegments = 0;
|
|
78338
78341
|
this.downloadedSegments = 0;
|
|
78339
78342
|
this.downloadedFiles = [];
|
|
78340
|
-
fs$
|
|
78343
|
+
fs$m.ensureDirSync(this.segmentsDir);
|
|
78341
78344
|
console.log("Temporary segments directory:", this.segmentsDir);
|
|
78342
78345
|
// axios 统一实例化,方便增加axios功能,比如拦截器
|
|
78343
78346
|
this.http = axios.create({
|
|
@@ -78368,10 +78371,10 @@ class M3U8Downloader extends TypedEmitter {
|
|
|
78368
78371
|
try {
|
|
78369
78372
|
this.emit("start");
|
|
78370
78373
|
this.status = "running";
|
|
78371
|
-
if (!(await fs$
|
|
78372
|
-
await fs$
|
|
78374
|
+
if (!(await fs$m.pathExists(this.segmentsDir))) {
|
|
78375
|
+
await fs$m.mkdir(this.segmentsDir, { recursive: true });
|
|
78373
78376
|
}
|
|
78374
|
-
if (!(await fs$
|
|
78377
|
+
if (!(await fs$m.pathExists(path$z.dirname(this.output)))) {
|
|
78375
78378
|
throw new Error("Output directory does not exist");
|
|
78376
78379
|
}
|
|
78377
78380
|
const m3u8Content = await this.getM3U8();
|
|
@@ -78491,7 +78494,7 @@ class M3U8Downloader extends TypedEmitter {
|
|
|
78491
78494
|
return;
|
|
78492
78495
|
const formattedIndex = String(index).padStart(5, "0");
|
|
78493
78496
|
const segmentPath = path$z.resolve(this.segmentsDir, `segment${formattedIndex}.${this.options.suffix}`);
|
|
78494
|
-
if (this.options.skipExistSegments && (await fs$
|
|
78497
|
+
if (this.options.skipExistSegments && (await fs$m.pathExists(segmentPath))) {
|
|
78495
78498
|
this.downloadedSegments++;
|
|
78496
78499
|
const progress = {
|
|
78497
78500
|
downloadedFile: segmentPath,
|
|
@@ -78504,7 +78507,7 @@ class M3U8Downloader extends TypedEmitter {
|
|
|
78504
78507
|
const response = await this.http.get(tsUrl, {
|
|
78505
78508
|
responseType: "arraybuffer",
|
|
78506
78509
|
});
|
|
78507
|
-
await fs$
|
|
78510
|
+
await fs$m.writeFile(segmentPath, response.data);
|
|
78508
78511
|
this.downloadedFiles.push(segmentPath);
|
|
78509
78512
|
this.downloadedSegments++;
|
|
78510
78513
|
const progress = {
|
|
@@ -78540,7 +78543,7 @@ class M3U8Downloader extends TypedEmitter {
|
|
|
78540
78543
|
if (!this.options.convert2Mp4) {
|
|
78541
78544
|
mergedFilePath = this.output;
|
|
78542
78545
|
}
|
|
78543
|
-
const writeStream = fs$
|
|
78546
|
+
const writeStream = fs$m.createWriteStream(mergedFilePath, {
|
|
78544
78547
|
highWaterMark: 1024 * 1024,
|
|
78545
78548
|
});
|
|
78546
78549
|
writeStream.on("error", error => {
|
|
@@ -78571,10 +78574,10 @@ class M3U8Downloader extends TypedEmitter {
|
|
|
78571
78574
|
const formattedIndex = String(index).padStart(5, "0");
|
|
78572
78575
|
const segmentPath = path$z.resolve(this.segmentsDir, `segment${formattedIndex}.${this.options.suffix}`);
|
|
78573
78576
|
// 读取并安全写入
|
|
78574
|
-
const segmentData = await fs$
|
|
78577
|
+
const segmentData = await fs$m.promises.readFile(segmentPath);
|
|
78575
78578
|
await safeWrite(segmentData);
|
|
78576
78579
|
if (deleteSource)
|
|
78577
|
-
await fs$
|
|
78580
|
+
await fs$m.promises.unlink(segmentPath);
|
|
78578
78581
|
}
|
|
78579
78582
|
// 关键:等待流完全关闭
|
|
78580
78583
|
await new Promise((resolve, reject) => {
|
|
@@ -78594,14 +78597,14 @@ class M3U8Downloader extends TypedEmitter {
|
|
|
78594
78597
|
return;
|
|
78595
78598
|
await Promise.all(this.downloadedFiles.map(async (file) => {
|
|
78596
78599
|
try {
|
|
78597
|
-
await fs$
|
|
78600
|
+
await fs$m.unlink(file);
|
|
78598
78601
|
}
|
|
78599
78602
|
catch (error) { }
|
|
78600
78603
|
}));
|
|
78601
78604
|
if (this.options.convert2Mp4) {
|
|
78602
78605
|
let mergedFilePath = path$z.resolve(this.segmentsDir, `output.${this.options.suffix}`);
|
|
78603
|
-
if (await fs$
|
|
78604
|
-
await fs$
|
|
78606
|
+
if (await fs$m.pathExists(mergedFilePath)) {
|
|
78607
|
+
await fs$m.unlink(mergedFilePath);
|
|
78605
78608
|
}
|
|
78606
78609
|
}
|
|
78607
78610
|
}
|
|
@@ -78635,7 +78638,7 @@ class M3U8Downloader extends TypedEmitter {
|
|
|
78635
78638
|
}
|
|
78636
78639
|
// remove merged TS file with retry
|
|
78637
78640
|
try {
|
|
78638
|
-
await retry$2(() => fs$
|
|
78641
|
+
await retry$2(() => fs$m.unlink(inputFilePath), 5, 1000);
|
|
78639
78642
|
}
|
|
78640
78643
|
catch (error) {
|
|
78641
78644
|
console.error(`Failed to delete temporary TS file: ${error}`);
|
|
@@ -78654,7 +78657,7 @@ var nodemailer = {};
|
|
|
78654
78657
|
|
|
78655
78658
|
var shared$c = {exports: {}};
|
|
78656
78659
|
|
|
78657
|
-
var fetch$
|
|
78660
|
+
var fetch$3 = {exports: {}};
|
|
78658
78661
|
|
|
78659
78662
|
// module to handle cookies
|
|
78660
78663
|
|
|
@@ -79004,11 +79007,11 @@ const net$b = require$$4;
|
|
|
79004
79007
|
|
|
79005
79008
|
const MAX_REDIRECTS = 5;
|
|
79006
79009
|
|
|
79007
|
-
fetch$
|
|
79010
|
+
fetch$3.exports = function (url, options) {
|
|
79008
79011
|
return nmfetch$3(url, options);
|
|
79009
79012
|
};
|
|
79010
79013
|
|
|
79011
|
-
fetch$
|
|
79014
|
+
fetch$3.exports.Cookies = Cookies;
|
|
79012
79015
|
|
|
79013
79016
|
function nmfetch$3(url, options) {
|
|
79014
79017
|
options = options || {};
|
|
@@ -79266,7 +79269,7 @@ function nmfetch$3(url, options) {
|
|
|
79266
79269
|
return fetchRes;
|
|
79267
79270
|
}
|
|
79268
79271
|
|
|
79269
|
-
var fetchExports = fetch$
|
|
79272
|
+
var fetchExports = fetch$3.exports;
|
|
79270
79273
|
|
|
79271
79274
|
/* eslint no-console: 0 */
|
|
79272
79275
|
|
|
@@ -83956,7 +83959,7 @@ var leUnix = LeWindows$2;
|
|
|
83956
83959
|
/* eslint no-undefined: 0, prefer-spread: 0, no-control-regex: 0 */
|
|
83957
83960
|
|
|
83958
83961
|
const crypto$b = require$$1$6;
|
|
83959
|
-
const fs$
|
|
83962
|
+
const fs$3 = require$$0$6;
|
|
83960
83963
|
const punycode$2 = punycode_1;
|
|
83961
83964
|
const PassThrough$4 = require$$0$4.PassThrough;
|
|
83962
83965
|
const shared$b = sharedExports;
|
|
@@ -84932,7 +84935,7 @@ let MimeNode$2 = class MimeNode {
|
|
|
84932
84935
|
return contentStream;
|
|
84933
84936
|
}
|
|
84934
84937
|
// read file
|
|
84935
|
-
return fs$
|
|
84938
|
+
return fs$3.createReadStream(content.path);
|
|
84936
84939
|
} else if (content && typeof content.href === 'string') {
|
|
84937
84940
|
if (this.disableUrlAccess) {
|
|
84938
84941
|
contentStream = new PassThrough$4();
|
|
@@ -86260,7 +86263,7 @@ const MessageParser = messageParser;
|
|
|
86260
86263
|
const RelaxedBody = relaxedBody;
|
|
86261
86264
|
const sign$2 = signExports;
|
|
86262
86265
|
const PassThrough$3 = require$$0$4.PassThrough;
|
|
86263
|
-
const fs = require$$0$6;
|
|
86266
|
+
const fs$2 = require$$0$6;
|
|
86264
86267
|
const path$2 = require$$0$7;
|
|
86265
86268
|
const crypto$8 = require$$1$6;
|
|
86266
86269
|
|
|
@@ -86320,12 +86323,12 @@ class DKIMSigner {
|
|
|
86320
86323
|
if (!this.cache || !this.cachePath) {
|
|
86321
86324
|
return;
|
|
86322
86325
|
}
|
|
86323
|
-
fs.unlink(this.cachePath, () => false);
|
|
86326
|
+
fs$2.unlink(this.cachePath, () => false);
|
|
86324
86327
|
}
|
|
86325
86328
|
|
|
86326
86329
|
createReadCache() {
|
|
86327
86330
|
// pipe remainings to cache file
|
|
86328
|
-
this.cache = fs.createReadStream(this.cachePath);
|
|
86331
|
+
this.cache = fs$2.createReadStream(this.cachePath);
|
|
86329
86332
|
this.cache.once('error', err => {
|
|
86330
86333
|
this.cleanup();
|
|
86331
86334
|
this.output.emit('error', err);
|
|
@@ -86388,7 +86391,7 @@ class DKIMSigner {
|
|
|
86388
86391
|
createWriteCache() {
|
|
86389
86392
|
this.output.usingCache = true;
|
|
86390
86393
|
// pipe remainings to cache file
|
|
86391
|
-
this.cache = fs.createWriteStream(this.cachePath);
|
|
86394
|
+
this.cache = fs$2.createWriteStream(this.cachePath);
|
|
86392
86395
|
this.cache.once('error', err => {
|
|
86393
86396
|
this.cleanup();
|
|
86394
86397
|
// drain input
|
|
@@ -173590,17 +173593,17 @@ const isSameProtocol = function isSameProtocol(destination, original) {
|
|
|
173590
173593
|
* @param Object opts Fetch options
|
|
173591
173594
|
* @return Promise
|
|
173592
173595
|
*/
|
|
173593
|
-
function fetch$
|
|
173596
|
+
function fetch$2(url, opts) {
|
|
173594
173597
|
|
|
173595
173598
|
// allow custom promise
|
|
173596
|
-
if (!fetch$
|
|
173599
|
+
if (!fetch$2.Promise) {
|
|
173597
173600
|
throw new Error('native promise missing, set fetch.Promise to your favorite alternative');
|
|
173598
173601
|
}
|
|
173599
173602
|
|
|
173600
|
-
Body.Promise = fetch$
|
|
173603
|
+
Body.Promise = fetch$2.Promise;
|
|
173601
173604
|
|
|
173602
173605
|
// wrap http.request into fetch
|
|
173603
|
-
return new fetch$
|
|
173606
|
+
return new fetch$2.Promise(function (resolve, reject) {
|
|
173604
173607
|
// build request object
|
|
173605
173608
|
const request = new Request$4(url, opts);
|
|
173606
173609
|
const options = getNodeRequestOptions(request);
|
|
@@ -173698,7 +173701,7 @@ function fetch$1(url, opts) {
|
|
|
173698
173701
|
const headers = createHeadersLenient(res.headers);
|
|
173699
173702
|
|
|
173700
173703
|
// HTTP fetch step 5
|
|
173701
|
-
if (fetch$
|
|
173704
|
+
if (fetch$2.isRedirect(res.statusCode)) {
|
|
173702
173705
|
// HTTP fetch step 5.2
|
|
173703
173706
|
const location = headers.get('Location');
|
|
173704
173707
|
|
|
@@ -173784,7 +173787,7 @@ function fetch$1(url, opts) {
|
|
|
173784
173787
|
}
|
|
173785
173788
|
|
|
173786
173789
|
// HTTP-redirect fetch step 15
|
|
173787
|
-
resolve(fetch$
|
|
173790
|
+
resolve(fetch$2(new Request$4(locationURL, requestOpts)));
|
|
173788
173791
|
finalize();
|
|
173789
173792
|
return;
|
|
173790
173793
|
}
|
|
@@ -173926,12 +173929,12 @@ function destroyStream(stream, err) {
|
|
|
173926
173929
|
* @param Number code Status code
|
|
173927
173930
|
* @return Boolean
|
|
173928
173931
|
*/
|
|
173929
|
-
fetch$
|
|
173932
|
+
fetch$2.isRedirect = function (code) {
|
|
173930
173933
|
return code === 301 || code === 302 || code === 303 || code === 307 || code === 308;
|
|
173931
173934
|
};
|
|
173932
173935
|
|
|
173933
173936
|
// expose Promise
|
|
173934
|
-
fetch$
|
|
173937
|
+
fetch$2.Promise = global.Promise;
|
|
173935
173938
|
|
|
173936
173939
|
var lib = /*#__PURE__*/Object.freeze({
|
|
173937
173940
|
__proto__: null,
|
|
@@ -173940,7 +173943,7 @@ var lib = /*#__PURE__*/Object.freeze({
|
|
|
173940
173943
|
Headers: Headers$1,
|
|
173941
173944
|
Request: Request$4,
|
|
173942
173945
|
Response: Response$2,
|
|
173943
|
-
default: fetch$
|
|
173946
|
+
default: fetch$2
|
|
173944
173947
|
});
|
|
173945
173948
|
|
|
173946
173949
|
var require$$0 = /*@__PURE__*/getAugmentedNamespace(lib);
|
|
@@ -179746,7 +179749,7 @@ class DanmakuFactory {
|
|
|
179746
179749
|
return params.filter((item) => item !== "");
|
|
179747
179750
|
};
|
|
179748
179751
|
convertXml2Ass = async (input, output, argsObj) => {
|
|
179749
|
-
if (!(await fs$
|
|
179752
|
+
if (!(await fs$m.pathExists(input))) {
|
|
179750
179753
|
throw new Error("input not exists");
|
|
179751
179754
|
}
|
|
179752
179755
|
const requiredArgs = [`-i "${input}"`, `-o "${output}"`, "--ignore-warnings", "--force"];
|
|
@@ -187066,7 +187069,7 @@ const traversalObject = (obj, callback) => {
|
|
|
187066
187069
|
}
|
|
187067
187070
|
};
|
|
187068
187071
|
async function processRawStream(inputFilePath) {
|
|
187069
|
-
const readStream = fs$
|
|
187072
|
+
const readStream = fs$m.createReadStream(inputFilePath, { encoding: "utf8" });
|
|
187070
187073
|
const rl = readline.createInterface({
|
|
187071
187074
|
input: readStream,
|
|
187072
187075
|
crlfDelay: Infinity,
|
|
@@ -187083,13 +187086,13 @@ async function processRawStream(inputFilePath) {
|
|
|
187083
187086
|
*/
|
|
187084
187087
|
const parseXmlFile = async (input, parseRaw = false) => {
|
|
187085
187088
|
let XMLdata;
|
|
187086
|
-
const stat = await fs$
|
|
187089
|
+
const stat = await fs$m.stat(input);
|
|
187087
187090
|
// 如果文件大于400M,且未开启parseRaw,使用processRawStream
|
|
187088
187091
|
if (stat.size > 400 * 1024 * 1024 && !parseRaw) {
|
|
187089
187092
|
XMLdata = await processRawStream(input);
|
|
187090
187093
|
}
|
|
187091
187094
|
else {
|
|
187092
|
-
XMLdata = await fs$
|
|
187095
|
+
XMLdata = await fs$m.promises.readFile(input, "utf8");
|
|
187093
187096
|
if (!parseRaw) {
|
|
187094
187097
|
XMLdata = XMLdata.replace(/raw=".*?"/g, "");
|
|
187095
187098
|
}
|
|
@@ -187317,7 +187320,7 @@ const genTimeData = async (input) => {
|
|
|
187317
187320
|
});
|
|
187318
187321
|
}
|
|
187319
187322
|
else if (ext === ".ass") {
|
|
187320
|
-
const content = await fs$
|
|
187323
|
+
const content = await fs$m.readFile(input, "utf-8");
|
|
187321
187324
|
const assData = compile(content, {});
|
|
187322
187325
|
return assData["dialogues"].map((item) => Math.floor(item.start));
|
|
187323
187326
|
}
|
|
@@ -187346,7 +187349,7 @@ const generateDanmakuImage = async (input, output, iOptions) => {
|
|
|
187346
187349
|
};
|
|
187347
187350
|
const options = Object.assign(defaultOptins, iOptions);
|
|
187348
187351
|
const data = await generateDanmakuData(input, options);
|
|
187349
|
-
await fs$
|
|
187352
|
+
await fs$m.ensureDir(output);
|
|
187350
187353
|
const canvas$1 = canvas.createCanvas(options.width, options.height);
|
|
187351
187354
|
const ctx = canvas$1.getContext("2d");
|
|
187352
187355
|
const points = createChartPoints(data, options.width, options.height);
|
|
@@ -187357,7 +187360,7 @@ const generateDanmakuImage = async (input, output, iOptions) => {
|
|
|
187357
187360
|
drawSmoothCurve(ctx, points);
|
|
187358
187361
|
const outputPath = path$z.join(output, `${String(i).padStart(4, "0")}.png`);
|
|
187359
187362
|
const png = await canvas$1.encode("png");
|
|
187360
|
-
await fs$
|
|
187363
|
+
await fs$m.promises.writeFile(outputPath, png);
|
|
187361
187364
|
}
|
|
187362
187365
|
return data;
|
|
187363
187366
|
};
|
|
@@ -187514,7 +187517,7 @@ const genProcessedXml = async (input, output, filterFunction) => {
|
|
|
187514
187517
|
];
|
|
187515
187518
|
const processedBuckets = processXmlItems(events, filterFunction);
|
|
187516
187519
|
const xmlData = generateMergedXmlContent(processedBuckets.danmu, processedBuckets.gift, processedBuckets.sc, processedBuckets.guard, jObj.i?.metadata || {});
|
|
187517
|
-
await fs$
|
|
187520
|
+
await fs$m.writeFile(output, xmlData);
|
|
187518
187521
|
return output;
|
|
187519
187522
|
};
|
|
187520
187523
|
/**
|
|
@@ -187552,7 +187555,7 @@ const addConvertDanmu2AssTask = async (originInput, output, danmuOptions, option
|
|
|
187552
187555
|
.split(",")
|
|
187553
187556
|
.filter((value) => value)
|
|
187554
187557
|
.join("\n");
|
|
187555
|
-
await fs$
|
|
187558
|
+
await fs$m.writeFile(fileTxtPath, fileTxtContent);
|
|
187556
187559
|
opts.blacklist = fileTxtPath;
|
|
187557
187560
|
}
|
|
187558
187561
|
const input = filteredOutput || originInput;
|
|
@@ -187567,10 +187570,10 @@ const addConvertDanmu2AssTask = async (originInput, output, danmuOptions, option
|
|
|
187567
187570
|
await trashItem(originInput);
|
|
187568
187571
|
}
|
|
187569
187572
|
if (opts.blacklist) {
|
|
187570
|
-
fs$
|
|
187573
|
+
fs$m.unlink(opts.blacklist);
|
|
187571
187574
|
}
|
|
187572
187575
|
if (filteredOutput) {
|
|
187573
|
-
fs$
|
|
187576
|
+
fs$m.unlink(filteredOutput);
|
|
187574
187577
|
}
|
|
187575
187578
|
},
|
|
187576
187579
|
onError: async (error) => {
|
|
@@ -187581,10 +187584,10 @@ const addConvertDanmu2AssTask = async (originInput, output, danmuOptions, option
|
|
|
187581
187584
|
output: output,
|
|
187582
187585
|
});
|
|
187583
187586
|
if (opts.blacklist) {
|
|
187584
|
-
fs$
|
|
187587
|
+
fs$m.unlink(opts.blacklist);
|
|
187585
187588
|
}
|
|
187586
187589
|
if (filteredOutput) {
|
|
187587
|
-
fs$
|
|
187590
|
+
fs$m.unlink(filteredOutput);
|
|
187588
187591
|
}
|
|
187589
187592
|
},
|
|
187590
187593
|
});
|
|
@@ -187622,7 +187625,7 @@ const convertXml2Ass = async (file, danmuOptions, options) => {
|
|
|
187622
187625
|
*
|
|
187623
187626
|
*/
|
|
187624
187627
|
const isEmptyDanmu = async (filepath) => {
|
|
187625
|
-
const readStream = fs$
|
|
187628
|
+
const readStream = fs$m.createReadStream(filepath, { encoding: "utf8" });
|
|
187626
187629
|
const rl = readline.createInterface({
|
|
187627
187630
|
input: readStream,
|
|
187628
187631
|
crlfDelay: Infinity,
|
|
@@ -187787,7 +187790,7 @@ const mergeXml = async (inputFiles, options = {}) => {
|
|
|
187787
187790
|
// 生成XML内容
|
|
187788
187791
|
const xmlContent = generateMergedXmlContent(mergedDanmuku, mergedGift, mergedSc, mergedGuard, metadata);
|
|
187789
187792
|
// 写入合并后的XML文件
|
|
187790
|
-
await fs$
|
|
187793
|
+
await fs$m.writeFile(outputPath, xmlContent);
|
|
187791
187794
|
logObj.info("mergeXml", {
|
|
187792
187795
|
status: "success",
|
|
187793
187796
|
text: `合并完成,共处理了${inputFiles.length}个文件`,
|
|
@@ -187914,7 +187917,7 @@ const convertImage2Video = async (inputDir, output, options) => {
|
|
|
187914
187917
|
onEnd: async () => {
|
|
187915
187918
|
if ((await pathExists(inputDir))) {
|
|
187916
187919
|
logObj.info("convertImage2Video, remove origin file", inputDir);
|
|
187917
|
-
fs$
|
|
187920
|
+
fs$m.rm(inputDir, { recursive: true, force: true });
|
|
187918
187921
|
}
|
|
187919
187922
|
},
|
|
187920
187923
|
});
|
|
@@ -188348,10 +188351,10 @@ async function parseMeta(files) {
|
|
|
188348
188351
|
duration: 0,
|
|
188349
188352
|
};
|
|
188350
188353
|
let content = "";
|
|
188351
|
-
if (files.danmaFilePath && (await fs$
|
|
188354
|
+
if (files.danmaFilePath && (await fs$m.pathExists(files.danmaFilePath))) {
|
|
188352
188355
|
content += (await readLines(files.danmaFilePath, 0, 30)).join("\n");
|
|
188353
188356
|
}
|
|
188354
|
-
if (files.videoFilePath && (await fs$
|
|
188357
|
+
if (files.videoFilePath && (await fs$m.pathExists(files.videoFilePath))) {
|
|
188355
188358
|
try {
|
|
188356
188359
|
const meta = await readVideoMeta(files.videoFilePath, {
|
|
188357
188360
|
json: true,
|
|
@@ -188638,17 +188641,17 @@ const mergeAssMp4 = async (files, options = {
|
|
|
188638
188641
|
}
|
|
188639
188642
|
if (files.hotProgressFilePath) {
|
|
188640
188643
|
logObj.info("mergrAssMp4, remove hot progress origin file", assFile);
|
|
188641
|
-
await fs$
|
|
188644
|
+
await fs$m.unlink(files.hotProgressFilePath);
|
|
188642
188645
|
}
|
|
188643
188646
|
if (files.subtitlePath && options.removeSubtitle) {
|
|
188644
188647
|
logObj.info("mergrAssMp4, remove subtitle origin file", files.subtitlePath);
|
|
188645
|
-
await fs$
|
|
188648
|
+
await fs$m.unlink(files.subtitlePath);
|
|
188646
188649
|
}
|
|
188647
188650
|
},
|
|
188648
188651
|
onError: async () => {
|
|
188649
188652
|
if (files.hotProgressFilePath) {
|
|
188650
188653
|
logObj.info("mergrAssMp4, remove hot progress origin file", assFile);
|
|
188651
|
-
await fs$
|
|
188654
|
+
await fs$m.unlink(files.hotProgressFilePath);
|
|
188652
188655
|
}
|
|
188653
188656
|
},
|
|
188654
188657
|
});
|
|
@@ -188786,7 +188789,7 @@ const mergeVideos = async (inputFiles, options = {
|
|
|
188786
188789
|
await setFfmpegPath();
|
|
188787
188790
|
const fileTxtPath = path$z.join(getTempPath(), `${uuid$4()}.txt`);
|
|
188788
188791
|
const fileTxtContent = inputFiles.map((videoFile) => `file '${videoFile}'`).join("\n");
|
|
188789
|
-
await fs$
|
|
188792
|
+
await fs$m.writeFile(fileTxtPath, fileTxtContent);
|
|
188790
188793
|
const command = ffmpeg(fileTxtPath).inputOptions("-f concat").inputOptions("-safe 0");
|
|
188791
188794
|
if (options.keepFirstVideoMeta) {
|
|
188792
188795
|
command.input(inputFiles[0]).outputOptions("-map 0").outputOptions(`-map_metadata 1`);
|
|
@@ -188815,13 +188818,13 @@ const mergeVideos = async (inputFiles, options = {
|
|
|
188815
188818
|
return { ...progress, percentage: Math.round((currentTime / duration) * 100) };
|
|
188816
188819
|
},
|
|
188817
188820
|
onEnd: async () => {
|
|
188818
|
-
fs$
|
|
188821
|
+
fs$m.remove(fileTxtPath);
|
|
188819
188822
|
if (options.removeOrigin) {
|
|
188820
188823
|
await Promise.all(inputFiles.map((videoInput) => trashItem(videoInput)));
|
|
188821
188824
|
}
|
|
188822
188825
|
},
|
|
188823
188826
|
onError: async () => {
|
|
188824
|
-
fs$
|
|
188827
|
+
fs$m.remove(fileTxtPath);
|
|
188825
188828
|
},
|
|
188826
188829
|
});
|
|
188827
188830
|
taskQueue.addTask(task, false);
|
|
@@ -189078,7 +189081,7 @@ async function getPlayUrl(bvid, cid, uid) {
|
|
|
189078
189081
|
* 直播回放下载
|
|
189079
189082
|
*/
|
|
189080
189083
|
async function sliceDownload(output, url, options) {
|
|
189081
|
-
if ((await fs$
|
|
189084
|
+
if ((await fs$m.pathExists(output)) && !options.override)
|
|
189082
189085
|
throw new Error(`${output}已存在`);
|
|
189083
189086
|
const { ffmpegPath } = getBinPath();
|
|
189084
189087
|
const downloader = new M3U8Downloader(url, output, {
|
|
@@ -189096,7 +189099,7 @@ async function sliceDownload(output, url, options) {
|
|
|
189096
189099
|
}
|
|
189097
189100
|
// 下载视频
|
|
189098
189101
|
async function download$2(options, uid) {
|
|
189099
|
-
if ((await fs$
|
|
189102
|
+
if ((await fs$m.pathExists(options.output)) && !options.override)
|
|
189100
189103
|
throw new Error(`${options.output}已存在`);
|
|
189101
189104
|
const client = createClient(uid);
|
|
189102
189105
|
const { ffmpegPath } = getBinPath();
|
|
@@ -189112,7 +189115,7 @@ async function download$2(options, uid) {
|
|
|
189112
189115
|
if (options.danmu !== "none") {
|
|
189113
189116
|
const data = await client.video.getAllDm({ bvid: options.bvid, cid: options.cid });
|
|
189114
189117
|
const xmlContent = await utils$8.protoBufToXml(data);
|
|
189115
|
-
fs$
|
|
189118
|
+
fs$m.writeFile(path$z.join(path$z.dirname(options.output), `${path$z.parse(options.output).name}.xml`), xmlContent);
|
|
189116
189119
|
}
|
|
189117
189120
|
},
|
|
189118
189121
|
});
|
|
@@ -189178,7 +189181,7 @@ function formatOptions(options, coverDir = undefined) {
|
|
|
189178
189181
|
else {
|
|
189179
189182
|
cover = undefined;
|
|
189180
189183
|
}
|
|
189181
|
-
if (cover && !fs$
|
|
189184
|
+
if (cover && !fs$m.pathExistsSync(cover)) {
|
|
189182
189185
|
console.warn("封面不存在", cover);
|
|
189183
189186
|
cover = undefined;
|
|
189184
189187
|
}
|
|
@@ -189764,7 +189767,7 @@ const validateBiliupConfig = (config) => {
|
|
|
189764
189767
|
}
|
|
189765
189768
|
return [true, null];
|
|
189766
189769
|
};
|
|
189767
|
-
function getPassKey() {
|
|
189770
|
+
function getPassKey$1() {
|
|
189768
189771
|
if (process.env.BILILIVE_TOOLS_BILIKEY) {
|
|
189769
189772
|
return process.env.BILILIVE_TOOLS_BILIKEY;
|
|
189770
189773
|
}
|
|
@@ -189791,13 +189794,13 @@ const deleteUser = async (uid) => {
|
|
|
189791
189794
|
// 写入用户数据
|
|
189792
189795
|
const writeUser = async (data) => {
|
|
189793
189796
|
const users = appConfig.getAll().bilibiliUser || {};
|
|
189794
|
-
const passKey = getPassKey();
|
|
189797
|
+
const passKey = getPassKey$1();
|
|
189795
189798
|
users[data.mid] = encrypt(JSON.stringify(data), passKey);
|
|
189796
189799
|
appConfig.set("bilibiliUser", users);
|
|
189797
189800
|
};
|
|
189798
189801
|
// 解码用户数据并增加expires参数
|
|
189799
189802
|
const decodeUser = (data) => {
|
|
189800
|
-
const passKey = getPassKey();
|
|
189803
|
+
const passKey = getPassKey$1();
|
|
189801
189804
|
const user = JSON.parse(decrypt(data, passKey));
|
|
189802
189805
|
let expires = 0;
|
|
189803
189806
|
try {
|
|
@@ -189880,7 +189883,7 @@ const getCookie$2 = (uid) => {
|
|
|
189880
189883
|
return user.cookie;
|
|
189881
189884
|
};
|
|
189882
189885
|
// 检查b站账号有效期
|
|
189883
|
-
const
|
|
189886
|
+
const checkBiliAccountLoop = () => {
|
|
189884
189887
|
const canAutoCheck = appConfig.get("biliUpload")?.accountAutoCheck ?? false;
|
|
189885
189888
|
let interval = 24 * 60 * 60 * 1000;
|
|
189886
189889
|
try {
|
|
@@ -189910,7 +189913,7 @@ const checkAccountLoop = () => {
|
|
|
189910
189913
|
}
|
|
189911
189914
|
finally {
|
|
189912
189915
|
// 24小时检查一次
|
|
189913
|
-
setTimeout(
|
|
189916
|
+
setTimeout(checkBiliAccountLoop, interval);
|
|
189914
189917
|
}
|
|
189915
189918
|
};
|
|
189916
189919
|
async function getBuvidConf$1() {
|
|
@@ -190280,7 +190283,7 @@ async function post(url, data, config) {
|
|
|
190280
190283
|
function md5File(path) {
|
|
190281
190284
|
return new Promise((resolve, reject) => {
|
|
190282
190285
|
const output = crypto$d.createHash("md5");
|
|
190283
|
-
const input = fs$
|
|
190286
|
+
const input = fs$F.createReadStream(path);
|
|
190284
190287
|
input.on("error", err => {
|
|
190285
190288
|
reject(err);
|
|
190286
190289
|
});
|
|
@@ -190380,7 +190383,7 @@ class Uploader {
|
|
|
190380
190383
|
* @returns 文件大小(字节)
|
|
190381
190384
|
*/
|
|
190382
190385
|
getFileSizeSync(filePath) {
|
|
190383
|
-
const stats = fs$
|
|
190386
|
+
const stats = fs$F.statSync(filePath);
|
|
190384
190387
|
return stats.size;
|
|
190385
190388
|
}
|
|
190386
190389
|
/**
|
|
@@ -190636,7 +190639,7 @@ class Uploader {
|
|
|
190636
190639
|
*/
|
|
190637
190640
|
createChunkStream(filePath, start, chunkSize) {
|
|
190638
190641
|
const endByte = start + chunkSize - 1;
|
|
190639
|
-
return fs$
|
|
190642
|
+
return fs$F.createReadStream(filePath, {
|
|
190640
190643
|
start,
|
|
190641
190644
|
end: endByte,
|
|
190642
190645
|
highWaterMark: 64 * 1024, // 64KB 块大小
|
|
@@ -191130,7 +191133,7 @@ class Pan123 extends TypedEmitter {
|
|
|
191130
191133
|
* @returns Promise<void> 上传成功时resolve,失败时reject
|
|
191131
191134
|
*/
|
|
191132
191135
|
async uploadFile(localFilePath, remoteDir = "", options) {
|
|
191133
|
-
if (!(await fs$
|
|
191136
|
+
if (!(await fs$m.pathExists(localFilePath))) {
|
|
191134
191137
|
const error = new Error(`文件不存在: ${localFilePath}`);
|
|
191135
191138
|
this.logger.error(error.message);
|
|
191136
191139
|
console.log(remoteDir);
|
|
@@ -191138,7 +191141,7 @@ class Pan123 extends TypedEmitter {
|
|
|
191138
191141
|
throw error;
|
|
191139
191142
|
}
|
|
191140
191143
|
// 检查文件大小是否超过10GB
|
|
191141
|
-
const stats = await fs$
|
|
191144
|
+
const stats = await fs$m.stat(localFilePath);
|
|
191142
191145
|
const fileSize = stats.size;
|
|
191143
191146
|
const maxSize = 10 * 1024 * 1024 * 1024; // 10GB
|
|
191144
191147
|
if (fileSize > maxSize) {
|
|
@@ -191875,7 +191878,7 @@ const handleRestartTask = (taskId) => {
|
|
|
191875
191878
|
|
|
191876
191879
|
let ntsuspend;
|
|
191877
191880
|
function getNtSuspend() {
|
|
191878
|
-
ntsuspend ??= node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index-
|
|
191881
|
+
ntsuspend ??= node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index-Bqpkb00O.cjs', document.baseURI).href)))("ntsuspend");
|
|
191879
191882
|
return ntsuspend;
|
|
191880
191883
|
}
|
|
191881
191884
|
class DanmuTask extends AbstractTask {
|
|
@@ -192142,7 +192145,7 @@ class BiliPartVideoTask extends AbstractTask {
|
|
|
192142
192145
|
if (this.useUploadPartPersistence) {
|
|
192143
192146
|
try {
|
|
192144
192147
|
const fileHash = await calculateFileQuickHash(command.filePath);
|
|
192145
|
-
const fileSize = await fs$
|
|
192148
|
+
const fileSize = await fs$m.stat(command.filePath).then((stat) => stat.size);
|
|
192146
192149
|
uploadPartService.addOrUpdate({
|
|
192147
192150
|
file_hash: fileHash,
|
|
192148
192151
|
file_size: fileSize,
|
|
@@ -192208,7 +192211,7 @@ class BiliPartVideoTask extends AbstractTask {
|
|
|
192208
192211
|
if (this.useUploadPartPersistence) {
|
|
192209
192212
|
try {
|
|
192210
192213
|
const fileHash = await calculateFileQuickHash(command.filePath);
|
|
192211
|
-
const fileSize = await fs$
|
|
192214
|
+
const fileSize = await fs$m.stat(command.filePath).then((stat) => stat.size);
|
|
192212
192215
|
const part = uploadPartService.findValidPartByHash(fileHash, fileSize, String(this.uid));
|
|
192213
192216
|
if (part) {
|
|
192214
192217
|
this.status = "completed";
|
|
@@ -192238,7 +192241,7 @@ class BiliPartVideoTask extends AbstractTask {
|
|
|
192238
192241
|
this.scheduleStalledProgressTimer();
|
|
192239
192242
|
command.upload();
|
|
192240
192243
|
try {
|
|
192241
|
-
const fileSize = await fs$
|
|
192244
|
+
const fileSize = await fs$m.stat(command.filePath).then((stat) => stat.size);
|
|
192242
192245
|
this.extra = { ...this.extra, fileSize };
|
|
192243
192246
|
}
|
|
192244
192247
|
catch (error) {
|
|
@@ -193095,6 +193098,390 @@ class FlvRepairTask extends AbstractTask {
|
|
|
193095
193098
|
}
|
|
193096
193099
|
}
|
|
193097
193100
|
|
|
193101
|
+
const USER_AGENT = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36 Edg/115.0.1901.188";
|
|
193102
|
+
const QR_GENERATE_URL = "https://passport.douyu.com/scan/generateCode";
|
|
193103
|
+
const QR_AUTH_URL = "https://passport.douyu.com/japi/scan/auth";
|
|
193104
|
+
const LOGIN_REFERER = "https://passport.douyu.com/index/login?type=login&client_id=1";
|
|
193105
|
+
const MAIN_ORIGIN = "https://www.douyu.com";
|
|
193106
|
+
const MAIN_LOGIN_PATH = "/api/passport/login";
|
|
193107
|
+
const getPassKey = () => process.env.BILILIVE_TOOLS_BILIKEY ||
|
|
193108
|
+
"7d628cb145deba521d5b0195924c466cae6559289cf5a335624ad8e6d7ef0085";
|
|
193109
|
+
const parseCookie$1 = (cookie) => cookie.split(";").reduce((result, chunk) => {
|
|
193110
|
+
const [name, ...rest] = chunk.trim().split("=");
|
|
193111
|
+
if (name)
|
|
193112
|
+
result[name] = rest.join("=").trim();
|
|
193113
|
+
return result;
|
|
193114
|
+
}, {});
|
|
193115
|
+
const buildCookie = (cookies) => Object.entries(cookies)
|
|
193116
|
+
.filter(([, value]) => value !== "")
|
|
193117
|
+
.map(([name, value]) => `${name}=${value}`)
|
|
193118
|
+
.join("; ");
|
|
193119
|
+
const getSetCookieHeaders = (headers) => typeof headers.getSetCookie === "function"
|
|
193120
|
+
? headers.getSetCookie()
|
|
193121
|
+
: headers.get("set-cookie")
|
|
193122
|
+
? [headers.get("set-cookie")]
|
|
193123
|
+
: [];
|
|
193124
|
+
const parseSetCookiePair = (header) => {
|
|
193125
|
+
const pair = header.split(";", 1)[0];
|
|
193126
|
+
const index = pair.indexOf("=");
|
|
193127
|
+
return index > 0 ? [pair.slice(0, index).trim(), pair.slice(index + 1)] : null;
|
|
193128
|
+
};
|
|
193129
|
+
const mergeCookies = (currentCookie, headers) => {
|
|
193130
|
+
const cookies = parseCookie$1(currentCookie);
|
|
193131
|
+
for (const header of getSetCookieHeaders(headers)) {
|
|
193132
|
+
const pair = parseSetCookiePair(header);
|
|
193133
|
+
if (pair)
|
|
193134
|
+
cookies[pair[0]] = pair[1];
|
|
193135
|
+
}
|
|
193136
|
+
return buildCookie(cookies);
|
|
193137
|
+
};
|
|
193138
|
+
const decodeCookieValue = (value) => {
|
|
193139
|
+
if (!value)
|
|
193140
|
+
return "";
|
|
193141
|
+
try {
|
|
193142
|
+
return decodeURIComponent(value);
|
|
193143
|
+
}
|
|
193144
|
+
catch {
|
|
193145
|
+
return value;
|
|
193146
|
+
}
|
|
193147
|
+
};
|
|
193148
|
+
const createDeviceCookie = () => {
|
|
193149
|
+
const alphabet = "0123456789abcdefghijklmnopqrstuvwxyz";
|
|
193150
|
+
const suffix = [...crypto$d.randomBytes(31)].map((byte) => alphabet[byte % alphabet.length]).join("");
|
|
193151
|
+
const deviceId = `b${suffix}`;
|
|
193152
|
+
return `dy_did=${deviceId}; acf_did=${deviceId}; game_did=${deviceId}`;
|
|
193153
|
+
};
|
|
193154
|
+
const normalizeMainLoginUrl = (value) => {
|
|
193155
|
+
const url = new URL(value);
|
|
193156
|
+
if (url.origin !== MAIN_ORIGIN || url.pathname !== MAIN_LOGIN_PATH) {
|
|
193157
|
+
throw new Error("扫码登录主站地址无效");
|
|
193158
|
+
}
|
|
193159
|
+
if (!url.searchParams.has("callback"))
|
|
193160
|
+
url.searchParams.set("callback", "appClient_json_callback");
|
|
193161
|
+
if (!url.searchParams.has("_"))
|
|
193162
|
+
url.searchParams.set("_", String(Date.now()));
|
|
193163
|
+
return url.toString();
|
|
193164
|
+
};
|
|
193165
|
+
const parseJsonp = (text) => {
|
|
193166
|
+
const start = text.indexOf("{");
|
|
193167
|
+
const end = text.lastIndexOf("}");
|
|
193168
|
+
if (start < 0 || end <= start)
|
|
193169
|
+
return undefined;
|
|
193170
|
+
return JSON.parse(text.slice(start, end + 1));
|
|
193171
|
+
};
|
|
193172
|
+
class DouyuQrcodeLogin {
|
|
193173
|
+
code;
|
|
193174
|
+
url;
|
|
193175
|
+
expiresAt;
|
|
193176
|
+
passportCookie;
|
|
193177
|
+
cancelled = false;
|
|
193178
|
+
controller = null;
|
|
193179
|
+
pollPromise = null;
|
|
193180
|
+
constructor(code, url, expiresAt, passportCookie) {
|
|
193181
|
+
this.code = code;
|
|
193182
|
+
this.url = url;
|
|
193183
|
+
this.expiresAt = expiresAt;
|
|
193184
|
+
this.passportCookie = passportCookie;
|
|
193185
|
+
}
|
|
193186
|
+
static async create() {
|
|
193187
|
+
const passportCookie = createDeviceCookie();
|
|
193188
|
+
const body = new URLSearchParams({ client_id: "1", isMultiAccount: "0" });
|
|
193189
|
+
const response = await fetch(QR_GENERATE_URL, {
|
|
193190
|
+
method: "POST",
|
|
193191
|
+
body,
|
|
193192
|
+
headers: {
|
|
193193
|
+
"content-type": "application/x-www-form-urlencoded; charset=UTF-8",
|
|
193194
|
+
"x-requested-with": "XMLHttpRequest",
|
|
193195
|
+
"user-agent": USER_AGENT,
|
|
193196
|
+
referer: LOGIN_REFERER,
|
|
193197
|
+
cookie: passportCookie,
|
|
193198
|
+
},
|
|
193199
|
+
});
|
|
193200
|
+
if (!response.ok)
|
|
193201
|
+
throw new Error(`斗鱼接口请求失败(${response.status})`);
|
|
193202
|
+
const data = (await response.json());
|
|
193203
|
+
const expiresIn = data.data?.expire || 300;
|
|
193204
|
+
if (data.error !== 0 || !data.data?.code || !data.data.url) {
|
|
193205
|
+
throw new Error(data.msg || "获取斗鱼登录二维码失败");
|
|
193206
|
+
}
|
|
193207
|
+
return new DouyuQrcodeLogin(data.data.code, data.data.url, Date.now() + expiresIn * 1000, mergeCookies(passportCookie, response.headers));
|
|
193208
|
+
}
|
|
193209
|
+
cancel() {
|
|
193210
|
+
this.cancelled = true;
|
|
193211
|
+
this.controller?.abort();
|
|
193212
|
+
}
|
|
193213
|
+
poll() {
|
|
193214
|
+
if (!this.pollPromise) {
|
|
193215
|
+
this.pollPromise = this.pollInternal().finally(() => {
|
|
193216
|
+
this.pollPromise = null;
|
|
193217
|
+
});
|
|
193218
|
+
}
|
|
193219
|
+
return this.pollPromise;
|
|
193220
|
+
}
|
|
193221
|
+
async pollInternal() {
|
|
193222
|
+
if (this.cancelled)
|
|
193223
|
+
return { status: "error", failReason: "登录已取消" };
|
|
193224
|
+
if (Date.now() >= this.expiresAt)
|
|
193225
|
+
return { status: "error", failReason: "二维码已过期" };
|
|
193226
|
+
try {
|
|
193227
|
+
const checkUrl = new URL(QR_AUTH_URL);
|
|
193228
|
+
checkUrl.searchParams.set("time", String(Date.now()));
|
|
193229
|
+
checkUrl.searchParams.set("code", this.code);
|
|
193230
|
+
const response = await this.request(checkUrl.toString(), {
|
|
193231
|
+
headers: { cookie: this.passportCookie, "x-requested-with": "XMLHttpRequest" },
|
|
193232
|
+
});
|
|
193233
|
+
const result = (await response.json());
|
|
193234
|
+
if (result.error === -2 || result.error === 1)
|
|
193235
|
+
return { status: "scan" };
|
|
193236
|
+
if (result.error !== 0) {
|
|
193237
|
+
const fallback = result.error === -3 || result.error === 2 ? "二维码已过期" : "斗鱼登录失败";
|
|
193238
|
+
return { status: "error", failReason: result.msg || result.message || fallback };
|
|
193239
|
+
}
|
|
193240
|
+
if (!result.data?.url)
|
|
193241
|
+
throw new Error("扫码登录已确认,但斗鱼未返回主站登录地址");
|
|
193242
|
+
this.passportCookie = mergeCookies(this.passportCookie, response.headers);
|
|
193243
|
+
const { mainCookie, profile } = await this.fetchMainCookie(result.data.url);
|
|
193244
|
+
const mainCookies = parseCookie$1(mainCookie);
|
|
193245
|
+
const uid = Number(mainCookies.acf_uid);
|
|
193246
|
+
if (!Number.isSafeInteger(uid) || uid <= 0)
|
|
193247
|
+
throw new Error("登录成功但未获取到斗鱼 UID");
|
|
193248
|
+
const user = {
|
|
193249
|
+
uid,
|
|
193250
|
+
name: decodeCookieValue(profile.name) ||
|
|
193251
|
+
decodeCookieValue(mainCookies.acf_nickname) ||
|
|
193252
|
+
String(uid),
|
|
193253
|
+
avatar: decodeCookieValue(mainCookies.acf_avatar) || undefined,
|
|
193254
|
+
loginCookies: { passport: this.passportCookie, main: mainCookie },
|
|
193255
|
+
};
|
|
193256
|
+
return { status: "completed", user };
|
|
193257
|
+
}
|
|
193258
|
+
catch (error) {
|
|
193259
|
+
if (this.cancelled)
|
|
193260
|
+
return { status: "error", failReason: "登录已取消" };
|
|
193261
|
+
return {
|
|
193262
|
+
status: "error",
|
|
193263
|
+
failReason: error instanceof Error ? error.message : "斗鱼登录失败",
|
|
193264
|
+
};
|
|
193265
|
+
}
|
|
193266
|
+
}
|
|
193267
|
+
async fetchMainCookie(loginUrl) {
|
|
193268
|
+
const response = await this.request(normalizeMainLoginUrl(loginUrl), {
|
|
193269
|
+
headers: { cookie: this.passportCookie, referer: `${MAIN_ORIGIN}/` },
|
|
193270
|
+
});
|
|
193271
|
+
const body = parseJsonp(await response.text());
|
|
193272
|
+
if (body && Number(body.error) !== 0) {
|
|
193273
|
+
throw new Error(`扫码登录主站失败: ${String(body.msg || body.message || body.error)}`);
|
|
193274
|
+
}
|
|
193275
|
+
const passportCookies = parseCookie$1(this.passportCookie);
|
|
193276
|
+
const baseCookie = passportCookies.dy_did ? `dy_did=${passportCookies.dy_did}` : "";
|
|
193277
|
+
const mainCookie = mergeCookies(baseCookie, response.headers);
|
|
193278
|
+
const data = body?.data && typeof body.data === "object" ? body.data : {};
|
|
193279
|
+
return {
|
|
193280
|
+
mainCookie,
|
|
193281
|
+
profile: {
|
|
193282
|
+
name: typeof data.nickname === "string" ? data.nickname : undefined,
|
|
193283
|
+
avatar: typeof data.avatar === "string" ? data.avatar : undefined,
|
|
193284
|
+
},
|
|
193285
|
+
};
|
|
193286
|
+
}
|
|
193287
|
+
async request(url, init = {}) {
|
|
193288
|
+
if (this.cancelled)
|
|
193289
|
+
throw new Error("登录已取消");
|
|
193290
|
+
this.controller = new AbortController();
|
|
193291
|
+
const headers = new Headers(init.headers);
|
|
193292
|
+
headers.set("user-agent", USER_AGENT);
|
|
193293
|
+
if (!headers.has("referer"))
|
|
193294
|
+
headers.set("referer", LOGIN_REFERER);
|
|
193295
|
+
const response = await fetch(url, { ...init, headers, signal: this.controller.signal });
|
|
193296
|
+
if (!response.ok)
|
|
193297
|
+
throw new Error(`斗鱼接口请求失败(${response.status})`);
|
|
193298
|
+
return response;
|
|
193299
|
+
}
|
|
193300
|
+
}
|
|
193301
|
+
const writeDouyuUser = (user) => {
|
|
193302
|
+
const now = Date.now();
|
|
193303
|
+
const users = appConfig.get("douyuUser") || {};
|
|
193304
|
+
const storedUser = {
|
|
193305
|
+
uid: user.uid,
|
|
193306
|
+
name: user.name,
|
|
193307
|
+
avatar: user.avatar,
|
|
193308
|
+
createdAt: now,
|
|
193309
|
+
updatedAt: now,
|
|
193310
|
+
loginCookies: {
|
|
193311
|
+
passport: user.loginCookies.passport,
|
|
193312
|
+
main: user.loginCookies.main,
|
|
193313
|
+
},
|
|
193314
|
+
};
|
|
193315
|
+
users[user.uid] = encrypt(JSON.stringify(storedUser), getPassKey());
|
|
193316
|
+
appConfig.set("douyuUser", users);
|
|
193317
|
+
};
|
|
193318
|
+
const readDouyuUser = (uid) => {
|
|
193319
|
+
const value = (appConfig.get("douyuUser") || {})[uid];
|
|
193320
|
+
if (!value)
|
|
193321
|
+
return undefined;
|
|
193322
|
+
const storedUser = JSON.parse(decrypt(value, getPassKey()));
|
|
193323
|
+
const user = {
|
|
193324
|
+
uid: storedUser.uid,
|
|
193325
|
+
name: storedUser.name,
|
|
193326
|
+
avatar: storedUser.avatar,
|
|
193327
|
+
createdAt: storedUser.createdAt,
|
|
193328
|
+
updatedAt: storedUser.updatedAt,
|
|
193329
|
+
loginCookies: {
|
|
193330
|
+
passport: storedUser.loginCookies?.passport || "",
|
|
193331
|
+
main: storedUser.loginCookies?.main || storedUser.cookie || "",
|
|
193332
|
+
},
|
|
193333
|
+
};
|
|
193334
|
+
return user;
|
|
193335
|
+
};
|
|
193336
|
+
const readDouyuUserList = () => {
|
|
193337
|
+
const users = appConfig.get("douyuUser") || {};
|
|
193338
|
+
return Object.keys(users)
|
|
193339
|
+
.map((uid) => readDouyuUser(Number(uid)))
|
|
193340
|
+
.filter((user) => Boolean(user));
|
|
193341
|
+
};
|
|
193342
|
+
const deleteDouyuUser = (uid) => {
|
|
193343
|
+
const users = appConfig.get("douyuUser") || {};
|
|
193344
|
+
delete users[uid];
|
|
193345
|
+
appConfig.set("douyuUser", users);
|
|
193346
|
+
};
|
|
193347
|
+
/** 使用主站登录后可访问的粉丝牌接口校验 Cookie,不修改账号数据。 */
|
|
193348
|
+
const validateDouyuUser = async (uid) => {
|
|
193349
|
+
const user = readDouyuUser(uid);
|
|
193350
|
+
if (!user)
|
|
193351
|
+
throw new Error("斗鱼账号不存在");
|
|
193352
|
+
const cookie = user.loginCookies.main;
|
|
193353
|
+
if (!cookie)
|
|
193354
|
+
return false;
|
|
193355
|
+
const response = await fetch(`${MAIN_ORIGIN}/member/cp/getFansBadgeList`, {
|
|
193356
|
+
headers: {
|
|
193357
|
+
Cookie: cookie,
|
|
193358
|
+
"User-Agent": USER_AGENT,
|
|
193359
|
+
Referer: `${MAIN_ORIGIN}/`,
|
|
193360
|
+
},
|
|
193361
|
+
signal: AbortSignal.timeout(30_000),
|
|
193362
|
+
});
|
|
193363
|
+
if (response.status === 401 || response.status === 403)
|
|
193364
|
+
return false;
|
|
193365
|
+
if (!response.ok)
|
|
193366
|
+
throw new Error(`斗鱼校验请求失败(${response.status})`);
|
|
193367
|
+
const body = await response.text();
|
|
193368
|
+
return /fans-badge-list"\s*>[\s\S]*?<\/table>/.test(body);
|
|
193369
|
+
};
|
|
193370
|
+
const refreshRequests = new Map();
|
|
193371
|
+
/** 刷新主站 Cookie,保留本次登录记录的创建时间。 */
|
|
193372
|
+
const refreshDouyuUser = (uid) => {
|
|
193373
|
+
const pending = refreshRequests.get(uid);
|
|
193374
|
+
if (pending)
|
|
193375
|
+
return pending;
|
|
193376
|
+
const request = refreshDouyuUserInternal(uid).finally(() => refreshRequests.delete(uid));
|
|
193377
|
+
refreshRequests.set(uid, request);
|
|
193378
|
+
return request;
|
|
193379
|
+
};
|
|
193380
|
+
const refreshDouyuUserInternal = async (uid) => {
|
|
193381
|
+
const user = readDouyuUser(uid);
|
|
193382
|
+
if (!user)
|
|
193383
|
+
return;
|
|
193384
|
+
const passport = parseCookie$1(user.loginCookies.passport);
|
|
193385
|
+
const main = parseCookie$1(user.loginCookies.main);
|
|
193386
|
+
const did = passport.dy_did || main.dy_did;
|
|
193387
|
+
if (!did || !passport.LTP0)
|
|
193388
|
+
throw new Error("斗鱼刷新缺少 dy_did 或 LTP0");
|
|
193389
|
+
const timestamp = String(Date.now());
|
|
193390
|
+
const url = new URL("https://passport.douyu.com/lapi/passport/iframe/safeAuth");
|
|
193391
|
+
url.search = new URLSearchParams({
|
|
193392
|
+
client_id: "1",
|
|
193393
|
+
t: timestamp,
|
|
193394
|
+
_: timestamp,
|
|
193395
|
+
callback: "axiosJsonpCallback",
|
|
193396
|
+
}).toString();
|
|
193397
|
+
const response = await fetch(url.toString(), {
|
|
193398
|
+
headers: {
|
|
193399
|
+
Cookie: `dy_did=${did}; LTP0=${passport.LTP0}`,
|
|
193400
|
+
"User-Agent": USER_AGENT,
|
|
193401
|
+
Referer: `${MAIN_ORIGIN}/`,
|
|
193402
|
+
Origin: MAIN_ORIGIN,
|
|
193403
|
+
},
|
|
193404
|
+
signal: AbortSignal.timeout(30_000),
|
|
193405
|
+
});
|
|
193406
|
+
if (!response.ok)
|
|
193407
|
+
throw new Error(`斗鱼刷新请求失败(${response.status})`);
|
|
193408
|
+
const body = parseJsonp(await response.text());
|
|
193409
|
+
if (body?.error !== undefined && Number(body.error) !== 0) {
|
|
193410
|
+
throw new Error("斗鱼刷新登录态失败");
|
|
193411
|
+
}
|
|
193412
|
+
if (!getSetCookieHeaders(response.headers).some((header) => parseSetCookiePair(header))) {
|
|
193413
|
+
throw new Error("斗鱼刷新未返回 Cookie");
|
|
193414
|
+
}
|
|
193415
|
+
const cookie = mergeCookies(user.loginCookies.main, response.headers);
|
|
193416
|
+
if (Number(parseCookie$1(cookie).acf_uid) !== uid)
|
|
193417
|
+
throw new Error("斗鱼刷新账号 UID 不匹配");
|
|
193418
|
+
const users = appConfig.get("douyuUser") || {};
|
|
193419
|
+
users[uid] = encrypt(JSON.stringify({
|
|
193420
|
+
...user,
|
|
193421
|
+
loginCookies: { ...user.loginCookies, main: cookie },
|
|
193422
|
+
updatedAt: Date.now(),
|
|
193423
|
+
}), getPassKey());
|
|
193424
|
+
appConfig.set("douyuUser", users);
|
|
193425
|
+
};
|
|
193426
|
+
const checkDouyuAccounts = async () => {
|
|
193427
|
+
const now = Date.now();
|
|
193428
|
+
for (const uid of Object.keys(appConfig.get("douyuUser") || {})) {
|
|
193429
|
+
try {
|
|
193430
|
+
const user = readDouyuUser(Number(uid));
|
|
193431
|
+
if (user && now - (user.updatedAt ?? 0) > 4 * 24 * 60 * 60 * 1000) {
|
|
193432
|
+
await refreshDouyuUser(user.uid);
|
|
193433
|
+
}
|
|
193434
|
+
}
|
|
193435
|
+
catch {
|
|
193436
|
+
// 不输出响应、请求头或 Cookie。
|
|
193437
|
+
logObj.warn(`斗鱼账号 ${uid} Cookie 刷新失败,将在下次检查时重试`);
|
|
193438
|
+
}
|
|
193439
|
+
}
|
|
193440
|
+
};
|
|
193441
|
+
const DAY_MS = 24 * 60 * 60 * 1000;
|
|
193442
|
+
const DOUYU_EXPIRY_MS = 60 * DAY_MS;
|
|
193443
|
+
const DOUYU_EXPIRY_NOTICE_MS = 5 * DAY_MS;
|
|
193444
|
+
/** 每日检查预计过期的斗鱼账号;单个账号失败不影响其他账号。 */
|
|
193445
|
+
const checkDouyuAccountExpiry = async () => {
|
|
193446
|
+
if (!appConfig.get("notification")?.task?.douyuAccountExpiry)
|
|
193447
|
+
return;
|
|
193448
|
+
const now = Date.now();
|
|
193449
|
+
for (const uid of Object.keys(appConfig.get("douyuUser") || {})) {
|
|
193450
|
+
try {
|
|
193451
|
+
const user = readDouyuUser(Number(uid));
|
|
193452
|
+
if (!user || !Number.isFinite(user.createdAt) || user.createdAt <= 0)
|
|
193453
|
+
continue;
|
|
193454
|
+
const expiresAt = user.createdAt + DOUYU_EXPIRY_MS;
|
|
193455
|
+
const remaining = expiresAt - now;
|
|
193456
|
+
if (remaining >= DOUYU_EXPIRY_NOTICE_MS)
|
|
193457
|
+
continue;
|
|
193458
|
+
const status = remaining <= 0 ? "预计已过期" : `预计还剩 ${Math.ceil(remaining / DAY_MS)} 天过期`;
|
|
193459
|
+
await send(remaining <= 0 ? "斗鱼账号预计已过期" : "斗鱼账号即将过期", `斗鱼账号 ${user.name || user.uid}(UID:${user.uid})${status},请重新扫码登录。`, { type: "douyuAccountExpiry", context: { uid: user.uid, name: user.name, expiresAt } });
|
|
193460
|
+
}
|
|
193461
|
+
catch {
|
|
193462
|
+
logObj.warn(`斗鱼账号 ${uid} 过期通知失败,将在下次检查时重试`);
|
|
193463
|
+
}
|
|
193464
|
+
}
|
|
193465
|
+
};
|
|
193466
|
+
// 斗鱼账号cookie刷新检查,每天一次
|
|
193467
|
+
const checkDouyuAccountLoop = async () => {
|
|
193468
|
+
try {
|
|
193469
|
+
await checkDouyuAccounts();
|
|
193470
|
+
}
|
|
193471
|
+
catch {
|
|
193472
|
+
logObj.warn("斗鱼账号检查失败,将在下次检查时重试");
|
|
193473
|
+
}
|
|
193474
|
+
finally {
|
|
193475
|
+
try {
|
|
193476
|
+
await checkDouyuAccountExpiry();
|
|
193477
|
+
}
|
|
193478
|
+
catch {
|
|
193479
|
+
logObj.warn("斗鱼账号过期检查失败,将在下次检查时重试");
|
|
193480
|
+
}
|
|
193481
|
+
setTimeout(checkDouyuAccountLoop, 24 * 60 * 60 * 1000);
|
|
193482
|
+
}
|
|
193483
|
+
};
|
|
193484
|
+
|
|
193098
193485
|
class BiliCheckQueue extends TypedEmitter {
|
|
193099
193486
|
list = [];
|
|
193100
193487
|
appConfig;
|
|
@@ -193666,8 +194053,8 @@ function getValuesFromArrayLikeFlexSpaceBetween(array, columnCount) {
|
|
|
193666
194053
|
}
|
|
193667
194054
|
function ensureFolderExist(fileOrFolderPath) {
|
|
193668
194055
|
const folder = path$z.dirname(fileOrFolderPath);
|
|
193669
|
-
if (!fs$
|
|
193670
|
-
fs$
|
|
194056
|
+
if (!fs$F.existsSync(folder)) {
|
|
194057
|
+
fs$F.mkdirSync(folder, { recursive: true });
|
|
193671
194058
|
}
|
|
193672
194059
|
}
|
|
193673
194060
|
function assert$p(assertion, msg) {
|
|
@@ -193821,7 +194208,7 @@ async function downloadImage(imageUrl, savePath) {
|
|
|
193821
194208
|
if (!res.body) {
|
|
193822
194209
|
throw new Error("No body in response");
|
|
193823
194210
|
}
|
|
193824
|
-
const fileStream = fs$
|
|
194211
|
+
const fileStream = fs$F.createWriteStream(savePath, { flags: "wx" });
|
|
193825
194212
|
// @ts-ignore
|
|
193826
194213
|
await promises.finished(require$$0$b.Readable.fromWeb(res.body).pipe(fileStream));
|
|
193827
194214
|
}
|
|
@@ -194280,7 +194667,7 @@ function createRecordExtraDataController(savePath) {
|
|
|
194280
194667
|
const initializeFile = async (content) => {
|
|
194281
194668
|
// 这里有个假设,那就是第一次保存必然存在metatdata信息
|
|
194282
194669
|
const initialContent = data.header.replace(METADATA_PLACEHOLDER, generateMetadataXml(data.meta));
|
|
194283
|
-
await fs$
|
|
194670
|
+
await fs$F.promises.writeFile(savePath, initialContent + content);
|
|
194284
194671
|
hasPersistedHeader = true;
|
|
194285
194672
|
};
|
|
194286
194673
|
const writeToFile = async (force = false) => {
|
|
@@ -194457,7 +194844,7 @@ function generateXmlContent(metadata, messages) {
|
|
|
194457
194844
|
async function appendToXmlFile(filePath, content) {
|
|
194458
194845
|
try {
|
|
194459
194846
|
// 直接追加内容
|
|
194460
|
-
await fs$
|
|
194847
|
+
await fs$F.promises.appendFile(filePath, content);
|
|
194461
194848
|
}
|
|
194462
194849
|
catch (error) {
|
|
194463
194850
|
console.error(`写入XML文件失败: ${filePath}`, error);
|
|
@@ -194521,7 +194908,7 @@ class Segment extends EventEmitter$k {
|
|
|
194521
194908
|
text: `Renaming segment file: ${this.rawRecordingVideoPath} -> ${this.outputFilePath}`,
|
|
194522
194909
|
});
|
|
194523
194910
|
await Promise.all([
|
|
194524
|
-
retry$1(() => fs$
|
|
194911
|
+
retry$1(() => fs$G.rename(this.rawRecordingVideoPath, this.outputFilePath), 20, 1000),
|
|
194525
194912
|
this.extraDataController?.flush(),
|
|
194526
194913
|
]);
|
|
194527
194914
|
this.emit("videoFileCompleted", data);
|
|
@@ -224274,11 +224661,11 @@ function requireSubresourceIntegrity () {
|
|
|
224274
224661
|
}
|
|
224275
224662
|
|
|
224276
224663
|
var fetch_1$1;
|
|
224277
|
-
var hasRequiredFetch
|
|
224664
|
+
var hasRequiredFetch;
|
|
224278
224665
|
|
|
224279
|
-
function requireFetch
|
|
224280
|
-
if (hasRequiredFetch
|
|
224281
|
-
hasRequiredFetch
|
|
224666
|
+
function requireFetch () {
|
|
224667
|
+
if (hasRequiredFetch) return fetch_1$1;
|
|
224668
|
+
hasRequiredFetch = 1;
|
|
224282
224669
|
|
|
224283
224670
|
const {
|
|
224284
224671
|
makeNetworkError,
|
|
@@ -226708,7 +227095,7 @@ function requireCache () {
|
|
|
226708
227095
|
const { webidl } = requireWebidl();
|
|
226709
227096
|
const { cloneResponse, fromInnerResponse, getResponseState } = requireResponse();
|
|
226710
227097
|
const { Request, fromInnerRequest, getRequestState } = requireRequest();
|
|
226711
|
-
const { fetching } = requireFetch
|
|
227098
|
+
const { fetching } = requireFetch();
|
|
226712
227099
|
const { urlIsHttpHttpsScheme, readAllBytes } = requireUtil$5();
|
|
226713
227100
|
/**
|
|
226714
227101
|
* @see https://w3c.github.io/ServiceWorker/#dfn-cache-batch-operation
|
|
@@ -229535,7 +229922,7 @@ function requireConnection () {
|
|
|
229535
229922
|
const { uid, states, sentCloseFrameState, emptyBuffer, opcodes } = requireConstants();
|
|
229536
229923
|
const { parseExtensions, isClosed, isClosing, isEstablished, isConnecting, validateCloseCodeAndReason } = requireUtil$2();
|
|
229537
229924
|
const { makeRequest } = requireRequest();
|
|
229538
|
-
const { fetching } = requireFetch
|
|
229925
|
+
const { fetching } = requireFetch();
|
|
229539
229926
|
const { Headers, getHeadersList } = requireHeaders();
|
|
229540
229927
|
const { getDecodeSplit } = requireUtil$5();
|
|
229541
229928
|
const { WebsocketFrameSend } = requireFrame();
|
|
@@ -232562,7 +232949,7 @@ function requireEventsource () {
|
|
|
232562
232949
|
hasRequiredEventsource = 1;
|
|
232563
232950
|
|
|
232564
232951
|
const { pipeline } = require$$0$b;
|
|
232565
|
-
const { fetching } = requireFetch
|
|
232952
|
+
const { fetching } = requireFetch();
|
|
232566
232953
|
const { webidl } = requireWebidl();
|
|
232567
232954
|
const { EventSourceStream } = requireEventsourceStream();
|
|
232568
232955
|
const { parseMIMEType } = requireDataUrl();
|
|
@@ -233179,7 +233566,7 @@ undici.exports;
|
|
|
233179
233566
|
module.exports.setGlobalDispatcher = setGlobalDispatcher;
|
|
233180
233567
|
module.exports.getGlobalDispatcher = getGlobalDispatcher;
|
|
233181
233568
|
|
|
233182
|
-
const fetchImpl = requireFetch
|
|
233569
|
+
const fetchImpl = requireFetch().fetch;
|
|
233183
233570
|
|
|
233184
233571
|
// Capture __filename at module load time for stack trace augmentation.
|
|
233185
233572
|
// This may be undefined when bundled in environments like Node.js internals.
|
|
@@ -233813,6 +234200,357 @@ async function getH5Play(http, opts) {
|
|
|
233813
234200
|
}
|
|
233814
234201
|
}
|
|
233815
234202
|
|
|
234203
|
+
var dist$2 = {};
|
|
234204
|
+
|
|
234205
|
+
Object.defineProperty(dist$2, "__esModule", { value: true });
|
|
234206
|
+
dist$2.parseCookie = parseCookie;
|
|
234207
|
+
dist$2.parse = parseCookie;
|
|
234208
|
+
dist$2.stringifyCookie = stringifyCookie;
|
|
234209
|
+
dist$2.stringifySetCookie = stringifySetCookie;
|
|
234210
|
+
dist$2.serialize = stringifySetCookie;
|
|
234211
|
+
dist$2.parseSetCookie = parseSetCookie;
|
|
234212
|
+
dist$2.stringifySetCookie = stringifySetCookie;
|
|
234213
|
+
dist$2.serialize = stringifySetCookie;
|
|
234214
|
+
/**
|
|
234215
|
+
* RegExp to match cookie-name in RFC 6265 sec 4.1.1
|
|
234216
|
+
* This refers out to the obsoleted definition of token in RFC 2616 sec 2.2
|
|
234217
|
+
* which has been replaced by the token definition in RFC 7230 appendix B.
|
|
234218
|
+
*
|
|
234219
|
+
* cookie-name = token
|
|
234220
|
+
* token = 1*tchar
|
|
234221
|
+
* tchar = "!" / "#" / "$" / "%" / "&" / "'" /
|
|
234222
|
+
* "*" / "+" / "-" / "." / "^" / "_" /
|
|
234223
|
+
* "`" / "|" / "~" / DIGIT / ALPHA
|
|
234224
|
+
*
|
|
234225
|
+
* Note: Allowing more characters - https://github.com/jshttp/cookie/issues/191
|
|
234226
|
+
* Allow same range as cookie value, except `=`, which delimits end of name.
|
|
234227
|
+
*/
|
|
234228
|
+
const cookieNameRegExp = /^[\u0021-\u003A\u003C\u003E-\u007E]+$/;
|
|
234229
|
+
/**
|
|
234230
|
+
* RegExp to match cookie-value in RFC 6265 sec 4.1.1
|
|
234231
|
+
*
|
|
234232
|
+
* cookie-value = *cookie-octet / ( DQUOTE *cookie-octet DQUOTE )
|
|
234233
|
+
* cookie-octet = %x21 / %x23-2B / %x2D-3A / %x3C-5B / %x5D-7E
|
|
234234
|
+
* ; US-ASCII characters excluding CTLs,
|
|
234235
|
+
* ; whitespace DQUOTE, comma, semicolon,
|
|
234236
|
+
* ; and backslash
|
|
234237
|
+
*
|
|
234238
|
+
* Allowing more characters: https://github.com/jshttp/cookie/issues/191
|
|
234239
|
+
* Comma, backslash, and DQUOTE are not part of the parsing algorithm.
|
|
234240
|
+
*/
|
|
234241
|
+
const cookieValueRegExp = /^[\u0021-\u003A\u003C-\u007E]*$/;
|
|
234242
|
+
/**
|
|
234243
|
+
* RegExp to match domain-value in RFC 6265 sec 4.1.1
|
|
234244
|
+
*
|
|
234245
|
+
* domain-value = <subdomain>
|
|
234246
|
+
* ; defined in [RFC1034], Section 3.5, as
|
|
234247
|
+
* ; enhanced by [RFC1123], Section 2.1
|
|
234248
|
+
* <subdomain> = <label> | <subdomain> "." <label>
|
|
234249
|
+
* <label> = <let-dig> [ [ <ldh-str> ] <let-dig> ]
|
|
234250
|
+
* Labels must be 63 characters or less.
|
|
234251
|
+
* 'let-dig' not 'letter' in the first char, per RFC1123
|
|
234252
|
+
* <ldh-str> = <let-dig-hyp> | <let-dig-hyp> <ldh-str>
|
|
234253
|
+
* <let-dig-hyp> = <let-dig> | "-"
|
|
234254
|
+
* <let-dig> = <letter> | <digit>
|
|
234255
|
+
* <letter> = any one of the 52 alphabetic characters A through Z in
|
|
234256
|
+
* upper case and a through z in lower case
|
|
234257
|
+
* <digit> = any one of the ten digits 0 through 9
|
|
234258
|
+
*
|
|
234259
|
+
* Keep support for leading dot: https://github.com/jshttp/cookie/issues/173
|
|
234260
|
+
*
|
|
234261
|
+
* > (Note that a leading %x2E ("."), if present, is ignored even though that
|
|
234262
|
+
* character is not permitted, but a trailing %x2E ("."), if present, will
|
|
234263
|
+
* cause the user agent to ignore the attribute.)
|
|
234264
|
+
*/
|
|
234265
|
+
const domainValueRegExp = /^([.]?[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)([.][a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)*$/i;
|
|
234266
|
+
/**
|
|
234267
|
+
* RegExp to match path-value in RFC 6265 sec 4.1.1
|
|
234268
|
+
*
|
|
234269
|
+
* path-value = <any CHAR except CTLs or ";">
|
|
234270
|
+
* CHAR = %x01-7F
|
|
234271
|
+
* ; defined in RFC 5234 appendix B.1
|
|
234272
|
+
*/
|
|
234273
|
+
const pathValueRegExp = /^[\u0020-\u003A\u003D-\u007E]*$/;
|
|
234274
|
+
/**
|
|
234275
|
+
* RegExp to match max-age-value in RFC 6265 sec 5.6.2
|
|
234276
|
+
*/
|
|
234277
|
+
const maxAgeRegExp = /^-?\d+$/;
|
|
234278
|
+
const __toString = Object.prototype.toString;
|
|
234279
|
+
const NullObject = /* @__PURE__ */ (() => {
|
|
234280
|
+
const C = function () { };
|
|
234281
|
+
C.prototype = Object.create(null);
|
|
234282
|
+
return C;
|
|
234283
|
+
})();
|
|
234284
|
+
/**
|
|
234285
|
+
* Parse a `Cookie` header.
|
|
234286
|
+
*
|
|
234287
|
+
* Parse the given cookie header string into an object
|
|
234288
|
+
* The object has the various cookies as keys(names) => values
|
|
234289
|
+
*/
|
|
234290
|
+
function parseCookie(str, options) {
|
|
234291
|
+
const obj = new NullObject();
|
|
234292
|
+
const len = str.length;
|
|
234293
|
+
// RFC 6265 sec 4.1.1, RFC 2616 2.2 defines a cookie name consists of one char minimum, plus '='.
|
|
234294
|
+
if (len < 2)
|
|
234295
|
+
return obj;
|
|
234296
|
+
const dec = options?.decode || decode$1;
|
|
234297
|
+
let index = 0;
|
|
234298
|
+
do {
|
|
234299
|
+
const eqIdx = eqIndex(str, index, len);
|
|
234300
|
+
if (eqIdx === -1)
|
|
234301
|
+
break; // No more cookie pairs.
|
|
234302
|
+
const endIdx = endIndex(str, index, len);
|
|
234303
|
+
if (eqIdx > endIdx) {
|
|
234304
|
+
// backtrack on prior semicolon
|
|
234305
|
+
index = str.lastIndexOf(";", eqIdx - 1) + 1;
|
|
234306
|
+
continue;
|
|
234307
|
+
}
|
|
234308
|
+
const key = valueSlice(str, index, eqIdx);
|
|
234309
|
+
// only assign once
|
|
234310
|
+
if (obj[key] === undefined) {
|
|
234311
|
+
obj[key] = dec(valueSlice(str, eqIdx + 1, endIdx));
|
|
234312
|
+
}
|
|
234313
|
+
index = endIdx + 1;
|
|
234314
|
+
} while (index < len);
|
|
234315
|
+
return obj;
|
|
234316
|
+
}
|
|
234317
|
+
/**
|
|
234318
|
+
* Stringifies an object into an HTTP `Cookie` header.
|
|
234319
|
+
*/
|
|
234320
|
+
function stringifyCookie(cookie, options) {
|
|
234321
|
+
const enc = options?.encode || encodeURIComponent;
|
|
234322
|
+
const cookieStrings = [];
|
|
234323
|
+
for (const name of Object.keys(cookie)) {
|
|
234324
|
+
const val = cookie[name];
|
|
234325
|
+
if (val === undefined)
|
|
234326
|
+
continue;
|
|
234327
|
+
if (!cookieNameRegExp.test(name)) {
|
|
234328
|
+
throw new TypeError(`cookie name is invalid: ${name}`);
|
|
234329
|
+
}
|
|
234330
|
+
const value = enc(val);
|
|
234331
|
+
if (!cookieValueRegExp.test(value)) {
|
|
234332
|
+
throw new TypeError(`cookie val is invalid: ${val}`);
|
|
234333
|
+
}
|
|
234334
|
+
cookieStrings.push(`${name}=${value}`);
|
|
234335
|
+
}
|
|
234336
|
+
return cookieStrings.join("; ");
|
|
234337
|
+
}
|
|
234338
|
+
function stringifySetCookie(_name, _val, _opts) {
|
|
234339
|
+
const cookie = typeof _name === "object"
|
|
234340
|
+
? _name
|
|
234341
|
+
: { ..._opts, name: _name, value: String(_val) };
|
|
234342
|
+
const options = typeof _val === "object" ? _val : _opts;
|
|
234343
|
+
const enc = options?.encode || encodeURIComponent;
|
|
234344
|
+
if (!cookieNameRegExp.test(cookie.name)) {
|
|
234345
|
+
throw new TypeError(`argument name is invalid: ${cookie.name}`);
|
|
234346
|
+
}
|
|
234347
|
+
const value = cookie.value ? enc(cookie.value) : "";
|
|
234348
|
+
if (!cookieValueRegExp.test(value)) {
|
|
234349
|
+
throw new TypeError(`argument val is invalid: ${cookie.value}`);
|
|
234350
|
+
}
|
|
234351
|
+
let str = cookie.name + "=" + value;
|
|
234352
|
+
if (cookie.maxAge !== undefined) {
|
|
234353
|
+
if (!Number.isInteger(cookie.maxAge)) {
|
|
234354
|
+
throw new TypeError(`option maxAge is invalid: ${cookie.maxAge}`);
|
|
234355
|
+
}
|
|
234356
|
+
str += "; Max-Age=" + cookie.maxAge;
|
|
234357
|
+
}
|
|
234358
|
+
if (cookie.domain) {
|
|
234359
|
+
if (!domainValueRegExp.test(cookie.domain)) {
|
|
234360
|
+
throw new TypeError(`option domain is invalid: ${cookie.domain}`);
|
|
234361
|
+
}
|
|
234362
|
+
str += "; Domain=" + cookie.domain;
|
|
234363
|
+
}
|
|
234364
|
+
if (cookie.path) {
|
|
234365
|
+
if (!pathValueRegExp.test(cookie.path)) {
|
|
234366
|
+
throw new TypeError(`option path is invalid: ${cookie.path}`);
|
|
234367
|
+
}
|
|
234368
|
+
str += "; Path=" + cookie.path;
|
|
234369
|
+
}
|
|
234370
|
+
if (cookie.expires) {
|
|
234371
|
+
if (!isDate$1(cookie.expires) || !Number.isFinite(cookie.expires.valueOf())) {
|
|
234372
|
+
throw new TypeError(`option expires is invalid: ${cookie.expires}`);
|
|
234373
|
+
}
|
|
234374
|
+
str += "; Expires=" + cookie.expires.toUTCString();
|
|
234375
|
+
}
|
|
234376
|
+
if (cookie.httpOnly) {
|
|
234377
|
+
str += "; HttpOnly";
|
|
234378
|
+
}
|
|
234379
|
+
if (cookie.secure) {
|
|
234380
|
+
str += "; Secure";
|
|
234381
|
+
}
|
|
234382
|
+
if (cookie.partitioned) {
|
|
234383
|
+
str += "; Partitioned";
|
|
234384
|
+
}
|
|
234385
|
+
if (cookie.priority) {
|
|
234386
|
+
const priority = typeof cookie.priority === "string"
|
|
234387
|
+
? cookie.priority.toLowerCase()
|
|
234388
|
+
: undefined;
|
|
234389
|
+
switch (priority) {
|
|
234390
|
+
case "low":
|
|
234391
|
+
str += "; Priority=Low";
|
|
234392
|
+
break;
|
|
234393
|
+
case "medium":
|
|
234394
|
+
str += "; Priority=Medium";
|
|
234395
|
+
break;
|
|
234396
|
+
case "high":
|
|
234397
|
+
str += "; Priority=High";
|
|
234398
|
+
break;
|
|
234399
|
+
default:
|
|
234400
|
+
throw new TypeError(`option priority is invalid: ${cookie.priority}`);
|
|
234401
|
+
}
|
|
234402
|
+
}
|
|
234403
|
+
if (cookie.sameSite) {
|
|
234404
|
+
const sameSite = typeof cookie.sameSite === "string"
|
|
234405
|
+
? cookie.sameSite.toLowerCase()
|
|
234406
|
+
: cookie.sameSite;
|
|
234407
|
+
switch (sameSite) {
|
|
234408
|
+
case true:
|
|
234409
|
+
case "strict":
|
|
234410
|
+
str += "; SameSite=Strict";
|
|
234411
|
+
break;
|
|
234412
|
+
case "lax":
|
|
234413
|
+
str += "; SameSite=Lax";
|
|
234414
|
+
break;
|
|
234415
|
+
case "none":
|
|
234416
|
+
str += "; SameSite=None";
|
|
234417
|
+
break;
|
|
234418
|
+
default:
|
|
234419
|
+
throw new TypeError(`option sameSite is invalid: ${cookie.sameSite}`);
|
|
234420
|
+
}
|
|
234421
|
+
}
|
|
234422
|
+
return str;
|
|
234423
|
+
}
|
|
234424
|
+
/**
|
|
234425
|
+
* Deserialize a `Set-Cookie` header into an object.
|
|
234426
|
+
*
|
|
234427
|
+
* deserialize('foo=bar; httpOnly')
|
|
234428
|
+
* => { name: 'foo', value: 'bar', httpOnly: true }
|
|
234429
|
+
*/
|
|
234430
|
+
function parseSetCookie(str, options) {
|
|
234431
|
+
const dec = options?.decode || decode$1;
|
|
234432
|
+
const len = str.length;
|
|
234433
|
+
const endIdx = endIndex(str, 0, len);
|
|
234434
|
+
const eqIdx = eqIndex(str, 0, endIdx);
|
|
234435
|
+
const setCookie = eqIdx === -1
|
|
234436
|
+
? { name: "", value: dec(valueSlice(str, 0, endIdx)) }
|
|
234437
|
+
: {
|
|
234438
|
+
name: valueSlice(str, 0, eqIdx),
|
|
234439
|
+
value: dec(valueSlice(str, eqIdx + 1, endIdx)),
|
|
234440
|
+
};
|
|
234441
|
+
let index = endIdx + 1;
|
|
234442
|
+
while (index < len) {
|
|
234443
|
+
const endIdx = endIndex(str, index, len);
|
|
234444
|
+
const eqIdx = eqIndex(str, index, endIdx);
|
|
234445
|
+
const attr = eqIdx === -1
|
|
234446
|
+
? valueSlice(str, index, endIdx)
|
|
234447
|
+
: valueSlice(str, index, eqIdx);
|
|
234448
|
+
const val = eqIdx === -1 ? undefined : valueSlice(str, eqIdx + 1, endIdx);
|
|
234449
|
+
switch (attr.toLowerCase()) {
|
|
234450
|
+
case "httponly":
|
|
234451
|
+
setCookie.httpOnly = true;
|
|
234452
|
+
break;
|
|
234453
|
+
case "secure":
|
|
234454
|
+
setCookie.secure = true;
|
|
234455
|
+
break;
|
|
234456
|
+
case "partitioned":
|
|
234457
|
+
setCookie.partitioned = true;
|
|
234458
|
+
break;
|
|
234459
|
+
case "domain":
|
|
234460
|
+
setCookie.domain = val;
|
|
234461
|
+
break;
|
|
234462
|
+
case "path":
|
|
234463
|
+
setCookie.path = val;
|
|
234464
|
+
break;
|
|
234465
|
+
case "max-age":
|
|
234466
|
+
if (val && maxAgeRegExp.test(val))
|
|
234467
|
+
setCookie.maxAge = Number(val);
|
|
234468
|
+
break;
|
|
234469
|
+
case "expires":
|
|
234470
|
+
if (!val)
|
|
234471
|
+
break;
|
|
234472
|
+
const date = new Date(val);
|
|
234473
|
+
if (Number.isFinite(date.valueOf()))
|
|
234474
|
+
setCookie.expires = date;
|
|
234475
|
+
break;
|
|
234476
|
+
case "priority":
|
|
234477
|
+
if (!val)
|
|
234478
|
+
break;
|
|
234479
|
+
const priority = val.toLowerCase();
|
|
234480
|
+
if (priority === "low" ||
|
|
234481
|
+
priority === "medium" ||
|
|
234482
|
+
priority === "high") {
|
|
234483
|
+
setCookie.priority = priority;
|
|
234484
|
+
}
|
|
234485
|
+
break;
|
|
234486
|
+
case "samesite":
|
|
234487
|
+
if (!val)
|
|
234488
|
+
break;
|
|
234489
|
+
const sameSite = val.toLowerCase();
|
|
234490
|
+
if (sameSite === "lax" ||
|
|
234491
|
+
sameSite === "strict" ||
|
|
234492
|
+
sameSite === "none") {
|
|
234493
|
+
setCookie.sameSite = sameSite;
|
|
234494
|
+
}
|
|
234495
|
+
break;
|
|
234496
|
+
}
|
|
234497
|
+
index = endIdx + 1;
|
|
234498
|
+
}
|
|
234499
|
+
return setCookie;
|
|
234500
|
+
}
|
|
234501
|
+
/**
|
|
234502
|
+
* Find the `;` character between `min` and `len` in str.
|
|
234503
|
+
*/
|
|
234504
|
+
function endIndex(str, min, len) {
|
|
234505
|
+
const index = str.indexOf(";", min);
|
|
234506
|
+
return index === -1 ? len : index;
|
|
234507
|
+
}
|
|
234508
|
+
/**
|
|
234509
|
+
* Find the `=` character between `min` and `max` in str.
|
|
234510
|
+
*/
|
|
234511
|
+
function eqIndex(str, min, max) {
|
|
234512
|
+
const index = str.indexOf("=", min);
|
|
234513
|
+
return index < max ? index : -1;
|
|
234514
|
+
}
|
|
234515
|
+
/**
|
|
234516
|
+
* Slice out a value between startPod to max.
|
|
234517
|
+
*/
|
|
234518
|
+
function valueSlice(str, min, max) {
|
|
234519
|
+
let start = min;
|
|
234520
|
+
let end = max;
|
|
234521
|
+
do {
|
|
234522
|
+
const code = str.charCodeAt(start);
|
|
234523
|
+
if (code !== 0x20 /* */ && code !== 0x09 /* \t */)
|
|
234524
|
+
break;
|
|
234525
|
+
} while (++start < end);
|
|
234526
|
+
while (end > start) {
|
|
234527
|
+
const code = str.charCodeAt(end - 1);
|
|
234528
|
+
if (code !== 0x20 /* */ && code !== 0x09 /* \t */)
|
|
234529
|
+
break;
|
|
234530
|
+
end--;
|
|
234531
|
+
}
|
|
234532
|
+
return str.slice(start, end);
|
|
234533
|
+
}
|
|
234534
|
+
/**
|
|
234535
|
+
* URL-decode string value. Optimized to skip native call when no %.
|
|
234536
|
+
*/
|
|
234537
|
+
function decode$1(str) {
|
|
234538
|
+
if (str.indexOf("%") === -1)
|
|
234539
|
+
return str;
|
|
234540
|
+
try {
|
|
234541
|
+
return decodeURIComponent(str);
|
|
234542
|
+
}
|
|
234543
|
+
catch (e) {
|
|
234544
|
+
return str;
|
|
234545
|
+
}
|
|
234546
|
+
}
|
|
234547
|
+
/**
|
|
234548
|
+
* Determine if value is a Date.
|
|
234549
|
+
*/
|
|
234550
|
+
function isDate$1(val) {
|
|
234551
|
+
return __toString.call(val) === "[object Date]";
|
|
234552
|
+
}
|
|
234553
|
+
|
|
233816
234554
|
const DEFAULT_DID = "10000000000000000000000000001501";
|
|
233817
234555
|
const ENCRYPTION_CACHE_TTL = 5 * 60 * 1000;
|
|
233818
234556
|
const encryptionCache = new Map();
|
|
@@ -233864,7 +234602,13 @@ async function getEncryption(http, did) {
|
|
|
233864
234602
|
}
|
|
233865
234603
|
}
|
|
233866
234604
|
async function getH5PlayV1(http, opts) {
|
|
233867
|
-
|
|
234605
|
+
let did = DEFAULT_DID;
|
|
234606
|
+
if (http?.defaultOptions?.cookie) {
|
|
234607
|
+
const cookies = dist$2.parse(http.defaultOptions.cookie);
|
|
234608
|
+
if (cookies.dy_did) {
|
|
234609
|
+
did = cookies.dy_did;
|
|
234610
|
+
}
|
|
234611
|
+
}
|
|
233868
234612
|
const timestamp = Math.round(Date.now() / 1000);
|
|
233869
234613
|
const encryptionData = await getEncryption(http, did);
|
|
233870
234614
|
const auth = buildAuth(opts.channelId, timestamp, encryptionData);
|
|
@@ -237675,357 +238419,6 @@ var Client = class {
|
|
|
237675
238419
|
}
|
|
237676
238420
|
};
|
|
237677
238421
|
|
|
237678
|
-
var dist$2 = {};
|
|
237679
|
-
|
|
237680
|
-
Object.defineProperty(dist$2, "__esModule", { value: true });
|
|
237681
|
-
dist$2.parseCookie = parseCookie;
|
|
237682
|
-
dist$2.parse = parseCookie;
|
|
237683
|
-
dist$2.stringifyCookie = stringifyCookie;
|
|
237684
|
-
dist$2.stringifySetCookie = stringifySetCookie;
|
|
237685
|
-
dist$2.serialize = stringifySetCookie;
|
|
237686
|
-
dist$2.parseSetCookie = parseSetCookie;
|
|
237687
|
-
dist$2.stringifySetCookie = stringifySetCookie;
|
|
237688
|
-
dist$2.serialize = stringifySetCookie;
|
|
237689
|
-
/**
|
|
237690
|
-
* RegExp to match cookie-name in RFC 6265 sec 4.1.1
|
|
237691
|
-
* This refers out to the obsoleted definition of token in RFC 2616 sec 2.2
|
|
237692
|
-
* which has been replaced by the token definition in RFC 7230 appendix B.
|
|
237693
|
-
*
|
|
237694
|
-
* cookie-name = token
|
|
237695
|
-
* token = 1*tchar
|
|
237696
|
-
* tchar = "!" / "#" / "$" / "%" / "&" / "'" /
|
|
237697
|
-
* "*" / "+" / "-" / "." / "^" / "_" /
|
|
237698
|
-
* "`" / "|" / "~" / DIGIT / ALPHA
|
|
237699
|
-
*
|
|
237700
|
-
* Note: Allowing more characters - https://github.com/jshttp/cookie/issues/191
|
|
237701
|
-
* Allow same range as cookie value, except `=`, which delimits end of name.
|
|
237702
|
-
*/
|
|
237703
|
-
const cookieNameRegExp = /^[\u0021-\u003A\u003C\u003E-\u007E]+$/;
|
|
237704
|
-
/**
|
|
237705
|
-
* RegExp to match cookie-value in RFC 6265 sec 4.1.1
|
|
237706
|
-
*
|
|
237707
|
-
* cookie-value = *cookie-octet / ( DQUOTE *cookie-octet DQUOTE )
|
|
237708
|
-
* cookie-octet = %x21 / %x23-2B / %x2D-3A / %x3C-5B / %x5D-7E
|
|
237709
|
-
* ; US-ASCII characters excluding CTLs,
|
|
237710
|
-
* ; whitespace DQUOTE, comma, semicolon,
|
|
237711
|
-
* ; and backslash
|
|
237712
|
-
*
|
|
237713
|
-
* Allowing more characters: https://github.com/jshttp/cookie/issues/191
|
|
237714
|
-
* Comma, backslash, and DQUOTE are not part of the parsing algorithm.
|
|
237715
|
-
*/
|
|
237716
|
-
const cookieValueRegExp = /^[\u0021-\u003A\u003C-\u007E]*$/;
|
|
237717
|
-
/**
|
|
237718
|
-
* RegExp to match domain-value in RFC 6265 sec 4.1.1
|
|
237719
|
-
*
|
|
237720
|
-
* domain-value = <subdomain>
|
|
237721
|
-
* ; defined in [RFC1034], Section 3.5, as
|
|
237722
|
-
* ; enhanced by [RFC1123], Section 2.1
|
|
237723
|
-
* <subdomain> = <label> | <subdomain> "." <label>
|
|
237724
|
-
* <label> = <let-dig> [ [ <ldh-str> ] <let-dig> ]
|
|
237725
|
-
* Labels must be 63 characters or less.
|
|
237726
|
-
* 'let-dig' not 'letter' in the first char, per RFC1123
|
|
237727
|
-
* <ldh-str> = <let-dig-hyp> | <let-dig-hyp> <ldh-str>
|
|
237728
|
-
* <let-dig-hyp> = <let-dig> | "-"
|
|
237729
|
-
* <let-dig> = <letter> | <digit>
|
|
237730
|
-
* <letter> = any one of the 52 alphabetic characters A through Z in
|
|
237731
|
-
* upper case and a through z in lower case
|
|
237732
|
-
* <digit> = any one of the ten digits 0 through 9
|
|
237733
|
-
*
|
|
237734
|
-
* Keep support for leading dot: https://github.com/jshttp/cookie/issues/173
|
|
237735
|
-
*
|
|
237736
|
-
* > (Note that a leading %x2E ("."), if present, is ignored even though that
|
|
237737
|
-
* character is not permitted, but a trailing %x2E ("."), if present, will
|
|
237738
|
-
* cause the user agent to ignore the attribute.)
|
|
237739
|
-
*/
|
|
237740
|
-
const domainValueRegExp = /^([.]?[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)([.][a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)*$/i;
|
|
237741
|
-
/**
|
|
237742
|
-
* RegExp to match path-value in RFC 6265 sec 4.1.1
|
|
237743
|
-
*
|
|
237744
|
-
* path-value = <any CHAR except CTLs or ";">
|
|
237745
|
-
* CHAR = %x01-7F
|
|
237746
|
-
* ; defined in RFC 5234 appendix B.1
|
|
237747
|
-
*/
|
|
237748
|
-
const pathValueRegExp = /^[\u0020-\u003A\u003D-\u007E]*$/;
|
|
237749
|
-
/**
|
|
237750
|
-
* RegExp to match max-age-value in RFC 6265 sec 5.6.2
|
|
237751
|
-
*/
|
|
237752
|
-
const maxAgeRegExp = /^-?\d+$/;
|
|
237753
|
-
const __toString = Object.prototype.toString;
|
|
237754
|
-
const NullObject = /* @__PURE__ */ (() => {
|
|
237755
|
-
const C = function () { };
|
|
237756
|
-
C.prototype = Object.create(null);
|
|
237757
|
-
return C;
|
|
237758
|
-
})();
|
|
237759
|
-
/**
|
|
237760
|
-
* Parse a `Cookie` header.
|
|
237761
|
-
*
|
|
237762
|
-
* Parse the given cookie header string into an object
|
|
237763
|
-
* The object has the various cookies as keys(names) => values
|
|
237764
|
-
*/
|
|
237765
|
-
function parseCookie(str, options) {
|
|
237766
|
-
const obj = new NullObject();
|
|
237767
|
-
const len = str.length;
|
|
237768
|
-
// RFC 6265 sec 4.1.1, RFC 2616 2.2 defines a cookie name consists of one char minimum, plus '='.
|
|
237769
|
-
if (len < 2)
|
|
237770
|
-
return obj;
|
|
237771
|
-
const dec = options?.decode || decode$1;
|
|
237772
|
-
let index = 0;
|
|
237773
|
-
do {
|
|
237774
|
-
const eqIdx = eqIndex(str, index, len);
|
|
237775
|
-
if (eqIdx === -1)
|
|
237776
|
-
break; // No more cookie pairs.
|
|
237777
|
-
const endIdx = endIndex(str, index, len);
|
|
237778
|
-
if (eqIdx > endIdx) {
|
|
237779
|
-
// backtrack on prior semicolon
|
|
237780
|
-
index = str.lastIndexOf(";", eqIdx - 1) + 1;
|
|
237781
|
-
continue;
|
|
237782
|
-
}
|
|
237783
|
-
const key = valueSlice(str, index, eqIdx);
|
|
237784
|
-
// only assign once
|
|
237785
|
-
if (obj[key] === undefined) {
|
|
237786
|
-
obj[key] = dec(valueSlice(str, eqIdx + 1, endIdx));
|
|
237787
|
-
}
|
|
237788
|
-
index = endIdx + 1;
|
|
237789
|
-
} while (index < len);
|
|
237790
|
-
return obj;
|
|
237791
|
-
}
|
|
237792
|
-
/**
|
|
237793
|
-
* Stringifies an object into an HTTP `Cookie` header.
|
|
237794
|
-
*/
|
|
237795
|
-
function stringifyCookie(cookie, options) {
|
|
237796
|
-
const enc = options?.encode || encodeURIComponent;
|
|
237797
|
-
const cookieStrings = [];
|
|
237798
|
-
for (const name of Object.keys(cookie)) {
|
|
237799
|
-
const val = cookie[name];
|
|
237800
|
-
if (val === undefined)
|
|
237801
|
-
continue;
|
|
237802
|
-
if (!cookieNameRegExp.test(name)) {
|
|
237803
|
-
throw new TypeError(`cookie name is invalid: ${name}`);
|
|
237804
|
-
}
|
|
237805
|
-
const value = enc(val);
|
|
237806
|
-
if (!cookieValueRegExp.test(value)) {
|
|
237807
|
-
throw new TypeError(`cookie val is invalid: ${val}`);
|
|
237808
|
-
}
|
|
237809
|
-
cookieStrings.push(`${name}=${value}`);
|
|
237810
|
-
}
|
|
237811
|
-
return cookieStrings.join("; ");
|
|
237812
|
-
}
|
|
237813
|
-
function stringifySetCookie(_name, _val, _opts) {
|
|
237814
|
-
const cookie = typeof _name === "object"
|
|
237815
|
-
? _name
|
|
237816
|
-
: { ..._opts, name: _name, value: String(_val) };
|
|
237817
|
-
const options = typeof _val === "object" ? _val : _opts;
|
|
237818
|
-
const enc = options?.encode || encodeURIComponent;
|
|
237819
|
-
if (!cookieNameRegExp.test(cookie.name)) {
|
|
237820
|
-
throw new TypeError(`argument name is invalid: ${cookie.name}`);
|
|
237821
|
-
}
|
|
237822
|
-
const value = cookie.value ? enc(cookie.value) : "";
|
|
237823
|
-
if (!cookieValueRegExp.test(value)) {
|
|
237824
|
-
throw new TypeError(`argument val is invalid: ${cookie.value}`);
|
|
237825
|
-
}
|
|
237826
|
-
let str = cookie.name + "=" + value;
|
|
237827
|
-
if (cookie.maxAge !== undefined) {
|
|
237828
|
-
if (!Number.isInteger(cookie.maxAge)) {
|
|
237829
|
-
throw new TypeError(`option maxAge is invalid: ${cookie.maxAge}`);
|
|
237830
|
-
}
|
|
237831
|
-
str += "; Max-Age=" + cookie.maxAge;
|
|
237832
|
-
}
|
|
237833
|
-
if (cookie.domain) {
|
|
237834
|
-
if (!domainValueRegExp.test(cookie.domain)) {
|
|
237835
|
-
throw new TypeError(`option domain is invalid: ${cookie.domain}`);
|
|
237836
|
-
}
|
|
237837
|
-
str += "; Domain=" + cookie.domain;
|
|
237838
|
-
}
|
|
237839
|
-
if (cookie.path) {
|
|
237840
|
-
if (!pathValueRegExp.test(cookie.path)) {
|
|
237841
|
-
throw new TypeError(`option path is invalid: ${cookie.path}`);
|
|
237842
|
-
}
|
|
237843
|
-
str += "; Path=" + cookie.path;
|
|
237844
|
-
}
|
|
237845
|
-
if (cookie.expires) {
|
|
237846
|
-
if (!isDate$1(cookie.expires) || !Number.isFinite(cookie.expires.valueOf())) {
|
|
237847
|
-
throw new TypeError(`option expires is invalid: ${cookie.expires}`);
|
|
237848
|
-
}
|
|
237849
|
-
str += "; Expires=" + cookie.expires.toUTCString();
|
|
237850
|
-
}
|
|
237851
|
-
if (cookie.httpOnly) {
|
|
237852
|
-
str += "; HttpOnly";
|
|
237853
|
-
}
|
|
237854
|
-
if (cookie.secure) {
|
|
237855
|
-
str += "; Secure";
|
|
237856
|
-
}
|
|
237857
|
-
if (cookie.partitioned) {
|
|
237858
|
-
str += "; Partitioned";
|
|
237859
|
-
}
|
|
237860
|
-
if (cookie.priority) {
|
|
237861
|
-
const priority = typeof cookie.priority === "string"
|
|
237862
|
-
? cookie.priority.toLowerCase()
|
|
237863
|
-
: undefined;
|
|
237864
|
-
switch (priority) {
|
|
237865
|
-
case "low":
|
|
237866
|
-
str += "; Priority=Low";
|
|
237867
|
-
break;
|
|
237868
|
-
case "medium":
|
|
237869
|
-
str += "; Priority=Medium";
|
|
237870
|
-
break;
|
|
237871
|
-
case "high":
|
|
237872
|
-
str += "; Priority=High";
|
|
237873
|
-
break;
|
|
237874
|
-
default:
|
|
237875
|
-
throw new TypeError(`option priority is invalid: ${cookie.priority}`);
|
|
237876
|
-
}
|
|
237877
|
-
}
|
|
237878
|
-
if (cookie.sameSite) {
|
|
237879
|
-
const sameSite = typeof cookie.sameSite === "string"
|
|
237880
|
-
? cookie.sameSite.toLowerCase()
|
|
237881
|
-
: cookie.sameSite;
|
|
237882
|
-
switch (sameSite) {
|
|
237883
|
-
case true:
|
|
237884
|
-
case "strict":
|
|
237885
|
-
str += "; SameSite=Strict";
|
|
237886
|
-
break;
|
|
237887
|
-
case "lax":
|
|
237888
|
-
str += "; SameSite=Lax";
|
|
237889
|
-
break;
|
|
237890
|
-
case "none":
|
|
237891
|
-
str += "; SameSite=None";
|
|
237892
|
-
break;
|
|
237893
|
-
default:
|
|
237894
|
-
throw new TypeError(`option sameSite is invalid: ${cookie.sameSite}`);
|
|
237895
|
-
}
|
|
237896
|
-
}
|
|
237897
|
-
return str;
|
|
237898
|
-
}
|
|
237899
|
-
/**
|
|
237900
|
-
* Deserialize a `Set-Cookie` header into an object.
|
|
237901
|
-
*
|
|
237902
|
-
* deserialize('foo=bar; httpOnly')
|
|
237903
|
-
* => { name: 'foo', value: 'bar', httpOnly: true }
|
|
237904
|
-
*/
|
|
237905
|
-
function parseSetCookie(str, options) {
|
|
237906
|
-
const dec = options?.decode || decode$1;
|
|
237907
|
-
const len = str.length;
|
|
237908
|
-
const endIdx = endIndex(str, 0, len);
|
|
237909
|
-
const eqIdx = eqIndex(str, 0, endIdx);
|
|
237910
|
-
const setCookie = eqIdx === -1
|
|
237911
|
-
? { name: "", value: dec(valueSlice(str, 0, endIdx)) }
|
|
237912
|
-
: {
|
|
237913
|
-
name: valueSlice(str, 0, eqIdx),
|
|
237914
|
-
value: dec(valueSlice(str, eqIdx + 1, endIdx)),
|
|
237915
|
-
};
|
|
237916
|
-
let index = endIdx + 1;
|
|
237917
|
-
while (index < len) {
|
|
237918
|
-
const endIdx = endIndex(str, index, len);
|
|
237919
|
-
const eqIdx = eqIndex(str, index, endIdx);
|
|
237920
|
-
const attr = eqIdx === -1
|
|
237921
|
-
? valueSlice(str, index, endIdx)
|
|
237922
|
-
: valueSlice(str, index, eqIdx);
|
|
237923
|
-
const val = eqIdx === -1 ? undefined : valueSlice(str, eqIdx + 1, endIdx);
|
|
237924
|
-
switch (attr.toLowerCase()) {
|
|
237925
|
-
case "httponly":
|
|
237926
|
-
setCookie.httpOnly = true;
|
|
237927
|
-
break;
|
|
237928
|
-
case "secure":
|
|
237929
|
-
setCookie.secure = true;
|
|
237930
|
-
break;
|
|
237931
|
-
case "partitioned":
|
|
237932
|
-
setCookie.partitioned = true;
|
|
237933
|
-
break;
|
|
237934
|
-
case "domain":
|
|
237935
|
-
setCookie.domain = val;
|
|
237936
|
-
break;
|
|
237937
|
-
case "path":
|
|
237938
|
-
setCookie.path = val;
|
|
237939
|
-
break;
|
|
237940
|
-
case "max-age":
|
|
237941
|
-
if (val && maxAgeRegExp.test(val))
|
|
237942
|
-
setCookie.maxAge = Number(val);
|
|
237943
|
-
break;
|
|
237944
|
-
case "expires":
|
|
237945
|
-
if (!val)
|
|
237946
|
-
break;
|
|
237947
|
-
const date = new Date(val);
|
|
237948
|
-
if (Number.isFinite(date.valueOf()))
|
|
237949
|
-
setCookie.expires = date;
|
|
237950
|
-
break;
|
|
237951
|
-
case "priority":
|
|
237952
|
-
if (!val)
|
|
237953
|
-
break;
|
|
237954
|
-
const priority = val.toLowerCase();
|
|
237955
|
-
if (priority === "low" ||
|
|
237956
|
-
priority === "medium" ||
|
|
237957
|
-
priority === "high") {
|
|
237958
|
-
setCookie.priority = priority;
|
|
237959
|
-
}
|
|
237960
|
-
break;
|
|
237961
|
-
case "samesite":
|
|
237962
|
-
if (!val)
|
|
237963
|
-
break;
|
|
237964
|
-
const sameSite = val.toLowerCase();
|
|
237965
|
-
if (sameSite === "lax" ||
|
|
237966
|
-
sameSite === "strict" ||
|
|
237967
|
-
sameSite === "none") {
|
|
237968
|
-
setCookie.sameSite = sameSite;
|
|
237969
|
-
}
|
|
237970
|
-
break;
|
|
237971
|
-
}
|
|
237972
|
-
index = endIdx + 1;
|
|
237973
|
-
}
|
|
237974
|
-
return setCookie;
|
|
237975
|
-
}
|
|
237976
|
-
/**
|
|
237977
|
-
* Find the `;` character between `min` and `len` in str.
|
|
237978
|
-
*/
|
|
237979
|
-
function endIndex(str, min, len) {
|
|
237980
|
-
const index = str.indexOf(";", min);
|
|
237981
|
-
return index === -1 ? len : index;
|
|
237982
|
-
}
|
|
237983
|
-
/**
|
|
237984
|
-
* Find the `=` character between `min` and `max` in str.
|
|
237985
|
-
*/
|
|
237986
|
-
function eqIndex(str, min, max) {
|
|
237987
|
-
const index = str.indexOf("=", min);
|
|
237988
|
-
return index < max ? index : -1;
|
|
237989
|
-
}
|
|
237990
|
-
/**
|
|
237991
|
-
* Slice out a value between startPod to max.
|
|
237992
|
-
*/
|
|
237993
|
-
function valueSlice(str, min, max) {
|
|
237994
|
-
let start = min;
|
|
237995
|
-
let end = max;
|
|
237996
|
-
do {
|
|
237997
|
-
const code = str.charCodeAt(start);
|
|
237998
|
-
if (code !== 0x20 /* */ && code !== 0x09 /* \t */)
|
|
237999
|
-
break;
|
|
238000
|
-
} while (++start < end);
|
|
238001
|
-
while (end > start) {
|
|
238002
|
-
const code = str.charCodeAt(end - 1);
|
|
238003
|
-
if (code !== 0x20 /* */ && code !== 0x09 /* \t */)
|
|
238004
|
-
break;
|
|
238005
|
-
end--;
|
|
238006
|
-
}
|
|
238007
|
-
return str.slice(start, end);
|
|
238008
|
-
}
|
|
238009
|
-
/**
|
|
238010
|
-
* URL-decode string value. Optimized to skip native call when no %.
|
|
238011
|
-
*/
|
|
238012
|
-
function decode$1(str) {
|
|
238013
|
-
if (str.indexOf("%") === -1)
|
|
238014
|
-
return str;
|
|
238015
|
-
try {
|
|
238016
|
-
return decodeURIComponent(str);
|
|
238017
|
-
}
|
|
238018
|
-
catch (e) {
|
|
238019
|
-
return str;
|
|
238020
|
-
}
|
|
238021
|
-
}
|
|
238022
|
-
/**
|
|
238023
|
-
* Determine if value is a Date.
|
|
238024
|
-
*/
|
|
238025
|
-
function isDate$1(val) {
|
|
238026
|
-
return __toString.call(val) === "[object Date]";
|
|
238027
|
-
}
|
|
238028
|
-
|
|
238029
238422
|
/**
|
|
238030
238423
|
* 小红书 API 层
|
|
238031
238424
|
*/
|
|
@@ -245140,7 +245533,7 @@ const checkLiveStatusAndRecord$5 = async function ({ getSavePath, banLiveId, isM
|
|
|
245140
245533
|
avoidEdgeCDN: true,
|
|
245141
245534
|
codecName: this.codecName,
|
|
245142
245535
|
api: this.api,
|
|
245143
|
-
auth: this.auth,
|
|
245536
|
+
auth: this.auth || "",
|
|
245144
245537
|
});
|
|
245145
245538
|
}
|
|
245146
245539
|
catch (err) {
|
|
@@ -245484,13 +245877,13 @@ const getStream$6 = async (data, resoltion) => {
|
|
|
245484
245877
|
*/
|
|
245485
245878
|
async function download$1(output, decodeData, options) {
|
|
245486
245879
|
const mp4Output = replaceExtName$1(output, ".mp4");
|
|
245487
|
-
if ((await fs$
|
|
245880
|
+
if ((await fs$m.pathExists(mp4Output)) && !options.override)
|
|
245488
245881
|
throw new Error(`${mp4Output}已存在`);
|
|
245489
245882
|
if (options.danmu !== "none" && !options.vid)
|
|
245490
245883
|
throw new Error("下载弹幕时vid不能为空");
|
|
245491
245884
|
const { dir, name } = path$z.parse(output);
|
|
245492
245885
|
const tsOutput = path$z.join(dir, `${name}.ts`);
|
|
245493
|
-
if (await fs$
|
|
245886
|
+
if (await fs$m.pathExists(tsOutput)) {
|
|
245494
245887
|
throw new Error(`${tsOutput}已存在,您可以直接执行转封装命令,或者删除后重新下载`);
|
|
245495
245888
|
}
|
|
245496
245889
|
let m3u8Url = await getStream$6(decodeData, options.resoltion);
|
|
@@ -245513,7 +245906,7 @@ async function download$1(output, decodeData, options) {
|
|
|
245513
245906
|
if (options.danmu !== "none" && options.vid) {
|
|
245514
245907
|
const danmu = await getVideoDanmu(options.vid);
|
|
245515
245908
|
const xml = convert2Xml(danmu, options.danmuMeta || {});
|
|
245516
|
-
fs$
|
|
245909
|
+
fs$m.writeFile(path$z.join(path$z.dirname(output), `${path$z.parse(output).name}.xml`), xml);
|
|
245517
245910
|
}
|
|
245518
245911
|
const outputName = `${name}.mp4`;
|
|
245519
245912
|
await sleep$1(2000);
|
|
@@ -245553,11 +245946,11 @@ const parseVideo$1 = async (url) => {
|
|
|
245553
245946
|
return videoList;
|
|
245554
245947
|
};
|
|
245555
245948
|
const downloadDanmu = async (vid, output, override, meta) => {
|
|
245556
|
-
if ((await fs$
|
|
245949
|
+
if ((await fs$m.pathExists(output)) && !override)
|
|
245557
245950
|
throw new Error(`${output}已存在`);
|
|
245558
245951
|
const danmu = await getVideoDanmu(vid);
|
|
245559
245952
|
const xml = convert2Xml(danmu, meta || {});
|
|
245560
|
-
await fs$
|
|
245953
|
+
await fs$m.writeFile(output, xml);
|
|
245561
245954
|
return output;
|
|
245562
245955
|
};
|
|
245563
245956
|
async function getReplayList(subId, opts) {
|
|
@@ -245572,11 +245965,11 @@ var douyu = { download: download$1, parseVideo: parseVideo$1, getAvailableStream
|
|
|
245572
245965
|
|
|
245573
245966
|
async function download(output, url, options) {
|
|
245574
245967
|
const mp4Output = replaceExtName$1(output, ".mp4");
|
|
245575
|
-
if ((await fs$
|
|
245968
|
+
if ((await fs$m.pathExists(mp4Output)) && !options.override)
|
|
245576
245969
|
throw new Error(`${mp4Output}已存在`);
|
|
245577
245970
|
const { dir, name } = path$z.parse(output);
|
|
245578
245971
|
const tsOutput = path$z.join(dir, `${name}.ts`);
|
|
245579
|
-
if (await fs$
|
|
245972
|
+
if (await fs$m.pathExists(tsOutput)) {
|
|
245580
245973
|
throw new Error(`${tsOutput}已存在,您可以直接执行转封装命令,或者删除后重新下载`);
|
|
245581
245974
|
}
|
|
245582
245975
|
const { ffmpegPath } = getBinPath();
|
|
@@ -245952,7 +246345,7 @@ async function checkAll() {
|
|
|
245952
246345
|
if (!savePath) {
|
|
245953
246346
|
throw new Error("请先设置下载路径");
|
|
245954
246347
|
}
|
|
245955
|
-
await fs$
|
|
246348
|
+
await fs$m.ensureDir(savePath);
|
|
245956
246349
|
}
|
|
245957
246350
|
for (const item of needCheckItems) {
|
|
245958
246351
|
try {
|
|
@@ -246048,13 +246441,13 @@ const extractStartTimeFromFilename = (filename, startTimeAutoMatch, fileBirthtim
|
|
|
246048
246441
|
*/
|
|
246049
246442
|
const getMatchingFiles = async (config, folderPath, startTime) => {
|
|
246050
246443
|
// 检查监听文件夹是否存在
|
|
246051
|
-
const exists = await fs$
|
|
246444
|
+
const exists = await fs$m.pathExists(folderPath);
|
|
246052
246445
|
if (!exists) {
|
|
246053
246446
|
logObj.warn(`文件夹不存在: ${folderPath}`);
|
|
246054
246447
|
return [];
|
|
246055
246448
|
}
|
|
246056
246449
|
// 筛选出符合条件的文件
|
|
246057
|
-
const files = await fs$
|
|
246450
|
+
const files = await fs$m.readdir(folderPath);
|
|
246058
246451
|
const videoFiles = files
|
|
246059
246452
|
.filter((file) => {
|
|
246060
246453
|
// 使用配置的文件匹配规则,如果未配置则使用默认规则
|
|
@@ -246098,7 +246491,7 @@ const getMatchingFiles = async (config, folderPath, startTime) => {
|
|
|
246098
246491
|
if (unprocessedFiles.length === 0) {
|
|
246099
246492
|
return [];
|
|
246100
246493
|
}
|
|
246101
|
-
const stats = await Promise.allSettled(unprocessedFiles.map((file) => fs$
|
|
246494
|
+
const stats = await Promise.allSettled(unprocessedFiles.map((file) => fs$m.stat(file)));
|
|
246102
246495
|
const newRecords = stats
|
|
246103
246496
|
.map((item, index) => {
|
|
246104
246497
|
return {
|
|
@@ -265167,7 +265560,7 @@ var indexMinimal$1 = {};
|
|
|
265167
265560
|
|
|
265168
265561
|
var minimal$2 = {};
|
|
265169
265562
|
|
|
265170
|
-
var aspromise$1 = asPromise$
|
|
265563
|
+
var aspromise$1 = asPromise$3;
|
|
265171
265564
|
|
|
265172
265565
|
/**
|
|
265173
265566
|
* Callback as used by {@link util.asPromise}.
|
|
@@ -265186,7 +265579,7 @@ var aspromise$1 = asPromise$2;
|
|
|
265186
265579
|
* @param {...*} params Function arguments
|
|
265187
265580
|
* @returns {Promise<*>} Promisified function
|
|
265188
265581
|
*/
|
|
265189
|
-
function asPromise$
|
|
265582
|
+
function asPromise$3(fn, ctx/*, varargs */) {
|
|
265190
265583
|
var params = new Array(arguments.length - 1),
|
|
265191
265584
|
offset = 0,
|
|
265192
265585
|
index = 2,
|
|
@@ -269575,367 +269968,328 @@ var types$1 = {};
|
|
|
269575
269968
|
|
|
269576
269969
|
var util$7 = {exports: {}};
|
|
269577
269970
|
|
|
269578
|
-
var patterns = {};
|
|
269971
|
+
var patterns$1 = {};
|
|
269579
269972
|
|
|
269580
|
-
|
|
269973
|
+
(function (exports) {
|
|
269581
269974
|
|
|
269582
|
-
|
|
269583
|
-
if (hasRequiredPatterns) return patterns;
|
|
269584
|
-
hasRequiredPatterns = 1;
|
|
269585
|
-
(function (exports) {
|
|
269975
|
+
var patterns = exports;
|
|
269586
269976
|
|
|
269587
|
-
|
|
269977
|
+
patterns.numberRe = /^(?![eE])[0-9]*(?:\.[0-9]*)?(?:[eE][+-]?[0-9]+)?$/;
|
|
269978
|
+
patterns.typeRefRe = /^(?:\.?[a-zA-Z_][a-zA-Z_0-9]*)(?:\.[a-zA-Z_][a-zA-Z_0-9]*)*$/;
|
|
269979
|
+
patterns.reservedRe = /^(?:do|if|in|for|let|new|try|var|case|else|enum|eval|false|null|this|true|void|with|break|catch|class|const|super|throw|while|yield|delete|export|import|public|return|static|switch|typeof|default|extends|finally|package|private|continue|debugger|function|arguments|interface|protected|implements|instanceof)$/;
|
|
269980
|
+
patterns.unsafePropertyRe = /^(?:__proto__|prototype|constructor)$/;
|
|
269981
|
+
} (patterns$1));
|
|
269588
269982
|
|
|
269589
|
-
|
|
269590
|
-
patterns.typeRefRe = /^(?:\.?[a-zA-Z_][a-zA-Z_0-9]*)(?:\.[a-zA-Z_][a-zA-Z_0-9]*)*$/;
|
|
269591
|
-
patterns.reservedRe = /^(?:do|if|in|for|let|new|try|var|case|else|enum|eval|false|null|this|true|void|with|break|catch|class|const|super|throw|while|yield|delete|export|import|public|return|static|switch|typeof|default|extends|finally|package|private|continue|debugger|function|arguments|interface|protected|implements|instanceof)$/;
|
|
269592
|
-
patterns.unsafePropertyRe = /^(?:__proto__|prototype|constructor)$/;
|
|
269593
|
-
} (patterns));
|
|
269594
|
-
return patterns;
|
|
269595
|
-
}
|
|
269983
|
+
var codegen_1 = codegen;
|
|
269596
269984
|
|
|
269597
|
-
var
|
|
269598
|
-
var
|
|
269985
|
+
var patterns = patterns$1;
|
|
269986
|
+
var reservedRe = patterns.reservedRe;
|
|
269599
269987
|
|
|
269600
|
-
|
|
269601
|
-
|
|
269602
|
-
|
|
269603
|
-
|
|
269988
|
+
/**
|
|
269989
|
+
* Begins generating a function.
|
|
269990
|
+
* @memberof util
|
|
269991
|
+
* @param {string[]} functionParams Function parameter names
|
|
269992
|
+
* @param {string} [functionName] Function name if not anonymous
|
|
269993
|
+
* @returns {Codegen} Appender that appends code to the function's body
|
|
269994
|
+
*/
|
|
269995
|
+
function codegen(functionParams, functionName) {
|
|
269604
269996
|
|
|
269605
|
-
|
|
269606
|
-
|
|
269997
|
+
/* istanbul ignore if */
|
|
269998
|
+
if (typeof functionParams === "string") {
|
|
269999
|
+
functionName = functionParams;
|
|
270000
|
+
functionParams = undefined;
|
|
270001
|
+
}
|
|
269607
270002
|
|
|
269608
|
-
|
|
269609
|
-
* Begins generating a function.
|
|
269610
|
-
* @memberof util
|
|
269611
|
-
* @param {string[]} functionParams Function parameter names
|
|
269612
|
-
* @param {string} [functionName] Function name if not anonymous
|
|
269613
|
-
* @returns {Codegen} Appender that appends code to the function's body
|
|
269614
|
-
*/
|
|
269615
|
-
function codegen(functionParams, functionName) {
|
|
270003
|
+
var body = [];
|
|
269616
270004
|
|
|
269617
|
-
|
|
269618
|
-
|
|
269619
|
-
|
|
269620
|
-
|
|
269621
|
-
|
|
270005
|
+
/**
|
|
270006
|
+
* Appends code to the function's body or finishes generation.
|
|
270007
|
+
* @typedef Codegen
|
|
270008
|
+
* @type {function}
|
|
270009
|
+
* @param {string|Object.<string,*>} [formatStringOrScope] Format string or, to finish the function, an object of additional scope variables, if any
|
|
270010
|
+
* @param {...*} [formatParams] Format parameters
|
|
270011
|
+
* @returns {Codegen|Function} Itself or the generated function if finished
|
|
270012
|
+
* @throws {Error} If format parameter counts do not match
|
|
270013
|
+
*/
|
|
269622
270014
|
|
|
269623
|
-
|
|
270015
|
+
function Codegen(formatStringOrScope) {
|
|
270016
|
+
// note that explicit array handling below makes this ~50% faster
|
|
270017
|
+
|
|
270018
|
+
// finish the function
|
|
270019
|
+
if (typeof formatStringOrScope !== "string") {
|
|
270020
|
+
var source = toString();
|
|
270021
|
+
if (codegen.verbose)
|
|
270022
|
+
console.log("codegen: " + source); // eslint-disable-line no-console
|
|
270023
|
+
source = "return " + source;
|
|
270024
|
+
if (formatStringOrScope) {
|
|
270025
|
+
var scopeKeys = Object.keys(formatStringOrScope),
|
|
270026
|
+
scopeParams = new Array(scopeKeys.length + 1),
|
|
270027
|
+
scopeValues = new Array(scopeKeys.length),
|
|
270028
|
+
scopeOffset = 0;
|
|
270029
|
+
while (scopeOffset < scopeKeys.length) {
|
|
270030
|
+
scopeParams[scopeOffset] = scopeKeys[scopeOffset];
|
|
270031
|
+
scopeValues[scopeOffset] = formatStringOrScope[scopeKeys[scopeOffset++]];
|
|
270032
|
+
}
|
|
270033
|
+
scopeParams[scopeOffset] = source;
|
|
270034
|
+
return Function.apply(null, scopeParams).apply(null, scopeValues); // eslint-disable-line no-new-func
|
|
270035
|
+
}
|
|
270036
|
+
return Function(source)(); // eslint-disable-line no-new-func
|
|
270037
|
+
}
|
|
270038
|
+
|
|
270039
|
+
// otherwise append to body
|
|
270040
|
+
var formatParams = new Array(arguments.length - 1),
|
|
270041
|
+
formatOffset = 0;
|
|
270042
|
+
while (formatOffset < formatParams.length)
|
|
270043
|
+
formatParams[formatOffset] = arguments[++formatOffset];
|
|
270044
|
+
formatOffset = 0;
|
|
270045
|
+
formatStringOrScope = formatStringOrScope.replace(/%([%dfijs])/g, function replace($0, $1) {
|
|
270046
|
+
var value = formatParams[formatOffset++];
|
|
270047
|
+
switch ($1) {
|
|
270048
|
+
case "d": case "f": return String(Number(value));
|
|
270049
|
+
case "i": return String(Math.floor(value));
|
|
270050
|
+
case "j": return JSON.stringify(value);
|
|
270051
|
+
case "s": return String(value);
|
|
270052
|
+
}
|
|
270053
|
+
return "%";
|
|
270054
|
+
});
|
|
270055
|
+
if (formatOffset !== formatParams.length)
|
|
270056
|
+
throw Error("parameter count mismatch");
|
|
270057
|
+
body.push(formatStringOrScope);
|
|
270058
|
+
return Codegen;
|
|
270059
|
+
}
|
|
269624
270060
|
|
|
269625
|
-
|
|
269626
|
-
|
|
269627
|
-
|
|
269628
|
-
* @type {function}
|
|
269629
|
-
* @param {string|Object.<string,*>} [formatStringOrScope] Format string or, to finish the function, an object of additional scope variables, if any
|
|
269630
|
-
* @param {...*} [formatParams] Format parameters
|
|
269631
|
-
* @returns {Codegen|Function} Itself or the generated function if finished
|
|
269632
|
-
* @throws {Error} If format parameter counts do not match
|
|
269633
|
-
*/
|
|
270061
|
+
function toString(functionNameOverride) {
|
|
270062
|
+
return "function " + safeFunctionName(functionNameOverride || functionName) + "(" + (functionParams && functionParams.join(",") || "") + "){\n " + body.join("\n ") + "\n}";
|
|
270063
|
+
}
|
|
269634
270064
|
|
|
269635
|
-
|
|
269636
|
-
|
|
269637
|
-
|
|
269638
|
-
// finish the function
|
|
269639
|
-
if (typeof formatStringOrScope !== "string") {
|
|
269640
|
-
var source = toString();
|
|
269641
|
-
if (codegen.verbose)
|
|
269642
|
-
console.log("codegen: " + source); // eslint-disable-line no-console
|
|
269643
|
-
source = "return " + source;
|
|
269644
|
-
if (formatStringOrScope) {
|
|
269645
|
-
var scopeKeys = Object.keys(formatStringOrScope),
|
|
269646
|
-
scopeParams = new Array(scopeKeys.length + 1),
|
|
269647
|
-
scopeValues = new Array(scopeKeys.length),
|
|
269648
|
-
scopeOffset = 0;
|
|
269649
|
-
while (scopeOffset < scopeKeys.length) {
|
|
269650
|
-
scopeParams[scopeOffset] = scopeKeys[scopeOffset];
|
|
269651
|
-
scopeValues[scopeOffset] = formatStringOrScope[scopeKeys[scopeOffset++]];
|
|
269652
|
-
}
|
|
269653
|
-
scopeParams[scopeOffset] = source;
|
|
269654
|
-
return Function.apply(null, scopeParams).apply(null, scopeValues); // eslint-disable-line no-new-func
|
|
269655
|
-
}
|
|
269656
|
-
return Function(source)(); // eslint-disable-line no-new-func
|
|
269657
|
-
}
|
|
270065
|
+
Codegen.toString = toString;
|
|
270066
|
+
return Codegen;
|
|
270067
|
+
}
|
|
269658
270068
|
|
|
269659
|
-
|
|
269660
|
-
|
|
269661
|
-
|
|
269662
|
-
|
|
269663
|
-
|
|
269664
|
-
|
|
269665
|
-
|
|
269666
|
-
|
|
269667
|
-
switch ($1) {
|
|
269668
|
-
case "d": case "f": return String(Number(value));
|
|
269669
|
-
case "i": return String(Math.floor(value));
|
|
269670
|
-
case "j": return JSON.stringify(value);
|
|
269671
|
-
case "s": return String(value);
|
|
269672
|
-
}
|
|
269673
|
-
return "%";
|
|
269674
|
-
});
|
|
269675
|
-
if (formatOffset !== formatParams.length)
|
|
269676
|
-
throw Error("parameter count mismatch");
|
|
269677
|
-
body.push(formatStringOrScope);
|
|
269678
|
-
return Codegen;
|
|
269679
|
-
}
|
|
270069
|
+
/**
|
|
270070
|
+
* Begins generating a function.
|
|
270071
|
+
* @memberof util
|
|
270072
|
+
* @function codegen
|
|
270073
|
+
* @param {string} [functionName] Function name if not anonymous
|
|
270074
|
+
* @returns {Codegen} Appender that appends code to the function's body
|
|
270075
|
+
* @variation 2
|
|
270076
|
+
*/
|
|
269680
270077
|
|
|
269681
|
-
|
|
269682
|
-
|
|
269683
|
-
|
|
270078
|
+
/**
|
|
270079
|
+
* When set to `true`, codegen will log generated code to console. Useful for debugging.
|
|
270080
|
+
* @name util.codegen.verbose
|
|
270081
|
+
* @type {boolean}
|
|
270082
|
+
*/
|
|
270083
|
+
codegen.verbose = false;
|
|
269684
270084
|
|
|
269685
|
-
|
|
269686
|
-
|
|
269687
|
-
|
|
270085
|
+
function safeFunctionName(name) {
|
|
270086
|
+
if (!name)
|
|
270087
|
+
return "";
|
|
270088
|
+
name = String(name).replace(/[^\w$]/g, "");
|
|
270089
|
+
if (!name)
|
|
270090
|
+
return "";
|
|
270091
|
+
if (/^\d/.test(name))
|
|
270092
|
+
name = "_" + name;
|
|
270093
|
+
return reservedRe.test(name) ? name + "_" : name;
|
|
270094
|
+
}
|
|
269688
270095
|
|
|
269689
|
-
|
|
269690
|
-
|
|
269691
|
-
|
|
269692
|
-
|
|
269693
|
-
|
|
269694
|
-
|
|
269695
|
-
|
|
269696
|
-
|
|
270096
|
+
var fs$1 = null;
|
|
270097
|
+
try {
|
|
270098
|
+
fs$1 = require(/* webpackIgnore: true */ "fs");
|
|
270099
|
+
if (!fs$1 || !fs$1.readFile || !fs$1.readFileSync)
|
|
270100
|
+
fs$1 = null;
|
|
270101
|
+
} catch (e) {
|
|
270102
|
+
// `fs` is unavailable in browsers and browser-like bundles.
|
|
270103
|
+
}
|
|
270104
|
+
var fs_1 = fs$1;
|
|
269697
270105
|
|
|
269698
|
-
|
|
269699
|
-
* When set to `true`, codegen will log generated code to console. Useful for debugging.
|
|
269700
|
-
* @name util.codegen.verbose
|
|
269701
|
-
* @type {boolean}
|
|
269702
|
-
*/
|
|
269703
|
-
codegen.verbose = false;
|
|
270106
|
+
var fetch_1 = fetch$1;
|
|
269704
270107
|
|
|
269705
|
-
|
|
269706
|
-
|
|
269707
|
-
return "";
|
|
269708
|
-
name = String(name).replace(/[^\w$]/g, "");
|
|
269709
|
-
if (!name)
|
|
269710
|
-
return "";
|
|
269711
|
-
if (/^\d/.test(name))
|
|
269712
|
-
name = "_" + name;
|
|
269713
|
-
return reservedRe.test(name) ? name + "_" : name;
|
|
269714
|
-
}
|
|
269715
|
-
return codegen_1;
|
|
269716
|
-
}
|
|
270108
|
+
var asPromise$2 = aspromise$1,
|
|
270109
|
+
fs = fs_1;
|
|
269717
270110
|
|
|
269718
|
-
|
|
269719
|
-
|
|
270111
|
+
/**
|
|
270112
|
+
* Node-style callback as used by {@link util.fetch}.
|
|
270113
|
+
* @typedef FetchCallback
|
|
270114
|
+
* @type {function}
|
|
270115
|
+
* @param {?Error} error Error, if any, otherwise `null`
|
|
270116
|
+
* @param {string} [contents] File contents, if there hasn't been an error
|
|
270117
|
+
* @returns {undefined}
|
|
270118
|
+
*/
|
|
269720
270119
|
|
|
269721
|
-
|
|
269722
|
-
|
|
269723
|
-
|
|
270120
|
+
/**
|
|
270121
|
+
* Options as used by {@link util.fetch}.
|
|
270122
|
+
* @interface IFetchOptions
|
|
270123
|
+
* @property {boolean} [binary=false] Whether expecting a binary response
|
|
270124
|
+
* @property {boolean} [xhr=false] If `true`, forces the use of XMLHttpRequest
|
|
270125
|
+
*/
|
|
269724
270126
|
|
|
269725
|
-
|
|
269726
|
-
|
|
269727
|
-
|
|
269728
|
-
|
|
269729
|
-
|
|
269730
|
-
|
|
269731
|
-
|
|
269732
|
-
|
|
269733
|
-
|
|
269734
|
-
|
|
270127
|
+
/**
|
|
270128
|
+
* Fetches the contents of a file.
|
|
270129
|
+
* @memberof util
|
|
270130
|
+
* @param {string} filename File path or url
|
|
270131
|
+
* @param {IFetchOptions} options Fetch options
|
|
270132
|
+
* @param {FetchCallback} callback Callback function
|
|
270133
|
+
* @returns {undefined}
|
|
270134
|
+
*/
|
|
270135
|
+
function fetch$1(filename, options, callback) {
|
|
270136
|
+
if (typeof options === "function") {
|
|
270137
|
+
callback = options;
|
|
270138
|
+
options = {};
|
|
270139
|
+
} else if (!options)
|
|
270140
|
+
options = {};
|
|
270141
|
+
|
|
270142
|
+
if (!callback)
|
|
270143
|
+
return asPromise$2(fetch$1, this, filename, options); // eslint-disable-line no-invalid-this
|
|
270144
|
+
|
|
270145
|
+
// if a node-like filesystem is present, try it first but fall back to XHR if nothing is found.
|
|
270146
|
+
if (!options.xhr && fs && fs.readFile)
|
|
270147
|
+
return fs.readFile(filename, function fetchReadFileCallback(err, contents) {
|
|
270148
|
+
return err && typeof XMLHttpRequest !== "undefined"
|
|
270149
|
+
? fetch$1.xhr(filename, options, callback)
|
|
270150
|
+
: err
|
|
270151
|
+
? callback(err)
|
|
270152
|
+
: callback(null, options.binary ? contents : contents.toString("utf8"));
|
|
270153
|
+
});
|
|
270154
|
+
|
|
270155
|
+
// use the XHR version otherwise.
|
|
270156
|
+
return fetch$1.xhr(filename, options, callback);
|
|
269735
270157
|
}
|
|
269736
270158
|
|
|
269737
|
-
|
|
269738
|
-
|
|
270159
|
+
/**
|
|
270160
|
+
* Fetches the contents of a file.
|
|
270161
|
+
* @name util.fetch
|
|
270162
|
+
* @function
|
|
270163
|
+
* @param {string} path File path or url
|
|
270164
|
+
* @param {FetchCallback} callback Callback function
|
|
270165
|
+
* @returns {undefined}
|
|
270166
|
+
* @variation 2
|
|
270167
|
+
*/
|
|
269739
270168
|
|
|
269740
|
-
|
|
269741
|
-
|
|
269742
|
-
|
|
269743
|
-
|
|
270169
|
+
/**
|
|
270170
|
+
* Fetches the contents of a file.
|
|
270171
|
+
* @name util.fetch
|
|
270172
|
+
* @function
|
|
270173
|
+
* @param {string} path File path or url
|
|
270174
|
+
* @param {IFetchOptions} [options] Fetch options
|
|
270175
|
+
* @returns {Promise<string|Uint8Array>} Promise
|
|
270176
|
+
* @variation 3
|
|
270177
|
+
*/
|
|
269744
270178
|
|
|
269745
|
-
|
|
269746
|
-
|
|
270179
|
+
/**/
|
|
270180
|
+
fetch$1.xhr = function fetch_xhr(filename, options, callback) {
|
|
270181
|
+
var xhr = new XMLHttpRequest();
|
|
270182
|
+
xhr.onreadystatechange /* works everywhere */ = function fetchOnReadyStateChange() {
|
|
269747
270183
|
|
|
269748
|
-
|
|
269749
|
-
|
|
269750
|
-
* @typedef FetchCallback
|
|
269751
|
-
* @type {function}
|
|
269752
|
-
* @param {?Error} error Error, if any, otherwise `null`
|
|
269753
|
-
* @param {string} [contents] File contents, if there hasn't been an error
|
|
269754
|
-
* @returns {undefined}
|
|
269755
|
-
*/
|
|
270184
|
+
if (xhr.readyState !== 4)
|
|
270185
|
+
return undefined;
|
|
269756
270186
|
|
|
269757
|
-
|
|
269758
|
-
|
|
269759
|
-
|
|
269760
|
-
|
|
269761
|
-
|
|
269762
|
-
|
|
270187
|
+
// local cors security errors return status 0 / empty string, too. afaik this cannot be
|
|
270188
|
+
// reliably distinguished from an actually empty file for security reasons. feel free
|
|
270189
|
+
// to send a pull request if you are aware of a solution.
|
|
270190
|
+
if (xhr.status !== 0 && xhr.status !== 200)
|
|
270191
|
+
return callback(Error("status " + xhr.status));
|
|
270192
|
+
|
|
270193
|
+
// if binary data is expected, make sure that some sort of array is returned, even if
|
|
270194
|
+
// ArrayBuffers are not supported. the binary string fallback, however, is unsafe.
|
|
270195
|
+
if (options.binary) {
|
|
270196
|
+
var buffer = xhr.response;
|
|
270197
|
+
if (!buffer) {
|
|
270198
|
+
buffer = [];
|
|
270199
|
+
for (var i = 0; i < xhr.responseText.length; ++i)
|
|
270200
|
+
buffer.push(xhr.responseText.charCodeAt(i) & 255);
|
|
270201
|
+
}
|
|
270202
|
+
return callback(null, typeof Uint8Array !== "undefined" ? new Uint8Array(buffer) : buffer);
|
|
270203
|
+
}
|
|
270204
|
+
return callback(null, xhr.responseText);
|
|
270205
|
+
};
|
|
270206
|
+
|
|
270207
|
+
if (options.binary) {
|
|
270208
|
+
// ref: https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/Sending_and_Receiving_Binary_Data#Receiving_binary_data_in_older_browsers
|
|
270209
|
+
if ("overrideMimeType" in xhr)
|
|
270210
|
+
xhr.overrideMimeType("text/plain; charset=x-user-defined");
|
|
270211
|
+
xhr.responseType = "arraybuffer";
|
|
270212
|
+
}
|
|
270213
|
+
|
|
270214
|
+
xhr.open("GET", filename);
|
|
270215
|
+
xhr.send();
|
|
270216
|
+
};
|
|
270217
|
+
|
|
270218
|
+
var path = {};
|
|
270219
|
+
|
|
270220
|
+
(function (exports) {
|
|
269763
270221
|
|
|
269764
270222
|
/**
|
|
269765
|
-
*
|
|
270223
|
+
* A minimal path module to resolve Unix, Windows and URL paths alike.
|
|
269766
270224
|
* @memberof util
|
|
269767
|
-
* @
|
|
269768
|
-
* @param {IFetchOptions} options Fetch options
|
|
269769
|
-
* @param {FetchCallback} callback Callback function
|
|
269770
|
-
* @returns {undefined}
|
|
270225
|
+
* @namespace
|
|
269771
270226
|
*/
|
|
269772
|
-
|
|
269773
|
-
if (typeof options === "function") {
|
|
269774
|
-
callback = options;
|
|
269775
|
-
options = {};
|
|
269776
|
-
} else if (!options)
|
|
269777
|
-
options = {};
|
|
269778
|
-
|
|
269779
|
-
if (!callback)
|
|
269780
|
-
return asPromise(fetch, this, filename, options); // eslint-disable-line no-invalid-this
|
|
269781
|
-
|
|
269782
|
-
// if a node-like filesystem is present, try it first but fall back to XHR if nothing is found.
|
|
269783
|
-
if (!options.xhr && fs && fs.readFile)
|
|
269784
|
-
return fs.readFile(filename, function fetchReadFileCallback(err, contents) {
|
|
269785
|
-
return err && typeof XMLHttpRequest !== "undefined"
|
|
269786
|
-
? fetch.xhr(filename, options, callback)
|
|
269787
|
-
: err
|
|
269788
|
-
? callback(err)
|
|
269789
|
-
: callback(null, options.binary ? contents : contents.toString("utf8"));
|
|
269790
|
-
});
|
|
269791
|
-
|
|
269792
|
-
// use the XHR version otherwise.
|
|
269793
|
-
return fetch.xhr(filename, options, callback);
|
|
269794
|
-
}
|
|
270227
|
+
var path = exports;
|
|
269795
270228
|
|
|
270229
|
+
var isAbsolute =
|
|
269796
270230
|
/**
|
|
269797
|
-
*
|
|
269798
|
-
* @
|
|
269799
|
-
* @
|
|
269800
|
-
* @param {string} path File path or url
|
|
269801
|
-
* @param {FetchCallback} callback Callback function
|
|
269802
|
-
* @returns {undefined}
|
|
269803
|
-
* @variation 2
|
|
270231
|
+
* Tests if the specified path is absolute.
|
|
270232
|
+
* @param {string} path Path to test
|
|
270233
|
+
* @returns {boolean} `true` if path is absolute
|
|
269804
270234
|
*/
|
|
270235
|
+
path.isAbsolute = function isAbsolute(path) {
|
|
270236
|
+
return /^(?:\/|\w+:|\\\\\w+)/.test(path);
|
|
270237
|
+
};
|
|
269805
270238
|
|
|
270239
|
+
var normalize =
|
|
269806
270240
|
/**
|
|
269807
|
-
*
|
|
269808
|
-
* @
|
|
269809
|
-
* @
|
|
269810
|
-
* @param {string} path File path or url
|
|
269811
|
-
* @param {IFetchOptions} [options] Fetch options
|
|
269812
|
-
* @returns {Promise<string|Uint8Array>} Promise
|
|
269813
|
-
* @variation 3
|
|
270241
|
+
* Normalizes the specified path.
|
|
270242
|
+
* @param {string} path Path to normalize
|
|
270243
|
+
* @returns {string} Normalized path
|
|
269814
270244
|
*/
|
|
269815
|
-
|
|
269816
|
-
|
|
269817
|
-
|
|
269818
|
-
|
|
269819
|
-
|
|
269820
|
-
|
|
269821
|
-
if (xhr.readyState !== 4)
|
|
269822
|
-
return undefined;
|
|
269823
|
-
|
|
269824
|
-
// local cors security errors return status 0 / empty string, too. afaik this cannot be
|
|
269825
|
-
// reliably distinguished from an actually empty file for security reasons. feel free
|
|
269826
|
-
// to send a pull request if you are aware of a solution.
|
|
269827
|
-
if (xhr.status !== 0 && xhr.status !== 200)
|
|
269828
|
-
return callback(Error("status " + xhr.status));
|
|
269829
|
-
|
|
269830
|
-
// if binary data is expected, make sure that some sort of array is returned, even if
|
|
269831
|
-
// ArrayBuffers are not supported. the binary string fallback, however, is unsafe.
|
|
269832
|
-
if (options.binary) {
|
|
269833
|
-
var buffer = xhr.response;
|
|
269834
|
-
if (!buffer) {
|
|
269835
|
-
buffer = [];
|
|
269836
|
-
for (var i = 0; i < xhr.responseText.length; ++i)
|
|
269837
|
-
buffer.push(xhr.responseText.charCodeAt(i) & 255);
|
|
269838
|
-
}
|
|
269839
|
-
return callback(null, typeof Uint8Array !== "undefined" ? new Uint8Array(buffer) : buffer);
|
|
269840
|
-
}
|
|
269841
|
-
return callback(null, xhr.responseText);
|
|
269842
|
-
};
|
|
269843
|
-
|
|
269844
|
-
if (options.binary) {
|
|
269845
|
-
// ref: https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/Sending_and_Receiving_Binary_Data#Receiving_binary_data_in_older_browsers
|
|
269846
|
-
if ("overrideMimeType" in xhr)
|
|
269847
|
-
xhr.overrideMimeType("text/plain; charset=x-user-defined");
|
|
269848
|
-
xhr.responseType = "arraybuffer";
|
|
270245
|
+
path.normalize = function normalize(path) {
|
|
270246
|
+
var firstTwoCharacters = path.substring(0,2);
|
|
270247
|
+
var uncPrefix = "";
|
|
270248
|
+
if (firstTwoCharacters === "\\\\") {
|
|
270249
|
+
uncPrefix = firstTwoCharacters;
|
|
270250
|
+
path = path.substring(2);
|
|
269849
270251
|
}
|
|
269850
270252
|
|
|
269851
|
-
|
|
269852
|
-
|
|
270253
|
+
path = path.replace(/\\/g, "/")
|
|
270254
|
+
.replace(/\/{2,}/g, "/");
|
|
270255
|
+
var parts = path.split("/"),
|
|
270256
|
+
absolute = isAbsolute(path),
|
|
270257
|
+
prefix = "";
|
|
270258
|
+
if (absolute)
|
|
270259
|
+
prefix = parts.shift() + "/";
|
|
270260
|
+
for (var i = 0; i < parts.length;) {
|
|
270261
|
+
if (parts[i] === "..") {
|
|
270262
|
+
if (i > 0 && parts[i - 1] !== "..")
|
|
270263
|
+
parts.splice(--i, 2);
|
|
270264
|
+
else if (absolute)
|
|
270265
|
+
parts.splice(i, 1);
|
|
270266
|
+
else
|
|
270267
|
+
++i;
|
|
270268
|
+
} else if (parts[i] === ".")
|
|
270269
|
+
parts.splice(i, 1);
|
|
270270
|
+
else
|
|
270271
|
+
++i;
|
|
270272
|
+
}
|
|
270273
|
+
return uncPrefix + prefix + parts.join("/");
|
|
269853
270274
|
};
|
|
269854
|
-
return fetch_1;
|
|
269855
|
-
}
|
|
269856
|
-
|
|
269857
|
-
var path = {};
|
|
269858
|
-
|
|
269859
|
-
var hasRequiredPath;
|
|
269860
|
-
|
|
269861
|
-
function requirePath () {
|
|
269862
|
-
if (hasRequiredPath) return path;
|
|
269863
|
-
hasRequiredPath = 1;
|
|
269864
|
-
(function (exports) {
|
|
269865
270275
|
|
|
269866
|
-
|
|
269867
|
-
|
|
269868
|
-
|
|
269869
|
-
|
|
269870
|
-
|
|
269871
|
-
|
|
269872
|
-
|
|
269873
|
-
|
|
269874
|
-
|
|
269875
|
-
|
|
269876
|
-
|
|
269877
|
-
|
|
269878
|
-
|
|
269879
|
-
|
|
269880
|
-
|
|
269881
|
-
|
|
269882
|
-
|
|
269883
|
-
var normalize =
|
|
269884
|
-
/**
|
|
269885
|
-
* Normalizes the specified path.
|
|
269886
|
-
* @param {string} path Path to normalize
|
|
269887
|
-
* @returns {string} Normalized path
|
|
269888
|
-
*/
|
|
269889
|
-
path.normalize = function normalize(path) {
|
|
269890
|
-
var firstTwoCharacters = path.substring(0,2);
|
|
269891
|
-
var uncPrefix = "";
|
|
269892
|
-
if (firstTwoCharacters === "\\\\") {
|
|
269893
|
-
uncPrefix = firstTwoCharacters;
|
|
269894
|
-
path = path.substring(2);
|
|
269895
|
-
}
|
|
269896
|
-
|
|
269897
|
-
path = path.replace(/\\/g, "/")
|
|
269898
|
-
.replace(/\/{2,}/g, "/");
|
|
269899
|
-
var parts = path.split("/"),
|
|
269900
|
-
absolute = isAbsolute(path),
|
|
269901
|
-
prefix = "";
|
|
269902
|
-
if (absolute)
|
|
269903
|
-
prefix = parts.shift() + "/";
|
|
269904
|
-
for (var i = 0; i < parts.length;) {
|
|
269905
|
-
if (parts[i] === "..") {
|
|
269906
|
-
if (i > 0 && parts[i - 1] !== "..")
|
|
269907
|
-
parts.splice(--i, 2);
|
|
269908
|
-
else if (absolute)
|
|
269909
|
-
parts.splice(i, 1);
|
|
269910
|
-
else
|
|
269911
|
-
++i;
|
|
269912
|
-
} else if (parts[i] === ".")
|
|
269913
|
-
parts.splice(i, 1);
|
|
269914
|
-
else
|
|
269915
|
-
++i;
|
|
269916
|
-
}
|
|
269917
|
-
return uncPrefix + prefix + parts.join("/");
|
|
269918
|
-
};
|
|
269919
|
-
|
|
269920
|
-
/**
|
|
269921
|
-
* Resolves the specified include path against the specified origin path.
|
|
269922
|
-
* @param {string} originPath Path to the origin file
|
|
269923
|
-
* @param {string} includePath Include path relative to origin path
|
|
269924
|
-
* @param {boolean} [alreadyNormalized=false] `true` if both paths are already known to be normalized
|
|
269925
|
-
* @returns {string} Path to the include file
|
|
269926
|
-
*/
|
|
269927
|
-
path.resolve = function resolve(originPath, includePath, alreadyNormalized) {
|
|
269928
|
-
if (!alreadyNormalized)
|
|
269929
|
-
includePath = normalize(includePath);
|
|
269930
|
-
if (isAbsolute(includePath))
|
|
269931
|
-
return includePath;
|
|
269932
|
-
if (!alreadyNormalized)
|
|
269933
|
-
originPath = normalize(originPath);
|
|
269934
|
-
return (originPath = originPath.replace(/(?:\/|^)[^/]+$/, "")).length ? normalize(originPath + "/" + includePath) : includePath;
|
|
269935
|
-
};
|
|
269936
|
-
} (path));
|
|
269937
|
-
return path;
|
|
269938
|
-
}
|
|
270276
|
+
/**
|
|
270277
|
+
* Resolves the specified include path against the specified origin path.
|
|
270278
|
+
* @param {string} originPath Path to the origin file
|
|
270279
|
+
* @param {string} includePath Include path relative to origin path
|
|
270280
|
+
* @param {boolean} [alreadyNormalized=false] `true` if both paths are already known to be normalized
|
|
270281
|
+
* @returns {string} Path to the include file
|
|
270282
|
+
*/
|
|
270283
|
+
path.resolve = function resolve(originPath, includePath, alreadyNormalized) {
|
|
270284
|
+
if (!alreadyNormalized)
|
|
270285
|
+
includePath = normalize(includePath);
|
|
270286
|
+
if (isAbsolute(includePath))
|
|
270287
|
+
return includePath;
|
|
270288
|
+
if (!alreadyNormalized)
|
|
270289
|
+
originPath = normalize(originPath);
|
|
270290
|
+
return (originPath = originPath.replace(/(?:\/|^)[^/]+$/, "")).length ? normalize(originPath + "/" + includePath) : includePath;
|
|
270291
|
+
};
|
|
270292
|
+
} (path));
|
|
269939
270293
|
|
|
269940
270294
|
var namespace;
|
|
269941
270295
|
var hasRequiredNamespace;
|
|
@@ -273103,10 +273457,10 @@ function requireUtil () {
|
|
|
273103
273457
|
var Type, // cyclic
|
|
273104
273458
|
Enum;
|
|
273105
273459
|
|
|
273106
|
-
util.codegen =
|
|
273107
|
-
util.fetch =
|
|
273108
|
-
util.path =
|
|
273109
|
-
util.patterns =
|
|
273460
|
+
util.codegen = codegen_1;
|
|
273461
|
+
util.fetch = fetch_1;
|
|
273462
|
+
util.path = path;
|
|
273463
|
+
util.patterns = patterns$1;
|
|
273110
273464
|
|
|
273111
273465
|
var reservedRe = util.patterns.reservedRe,
|
|
273112
273466
|
unsafePropertyRe = util.patterns.unsafePropertyRe;
|
|
@@ -273115,7 +273469,7 @@ function requireUtil () {
|
|
|
273115
273469
|
* Node's fs module if available.
|
|
273116
273470
|
* @type {Object.<string,*>}
|
|
273117
273471
|
*/
|
|
273118
|
-
util.fs =
|
|
273472
|
+
util.fs = fs_1;
|
|
273119
273473
|
|
|
273120
273474
|
/**
|
|
273121
273475
|
* Converts an object's values to an array.
|
|
@@ -381205,7 +381559,13 @@ class RecorderConfig {
|
|
|
381205
381559
|
}
|
|
381206
381560
|
else {
|
|
381207
381561
|
if (key === "uid") {
|
|
381208
|
-
|
|
381562
|
+
if (setting.providerId === "Bilibili") {
|
|
381563
|
+
return get$1(globalConfig, "bilibili.uid");
|
|
381564
|
+
}
|
|
381565
|
+
else if (setting.providerId === "DouYu") {
|
|
381566
|
+
return get$1(globalConfig, "douyu.uid");
|
|
381567
|
+
}
|
|
381568
|
+
return setting?.uid;
|
|
381209
381569
|
}
|
|
381210
381570
|
else if (key === "useM3U8Proxy") {
|
|
381211
381571
|
return get$1(globalConfig, "bilibili.useM3U8Proxy");
|
|
@@ -381266,10 +381626,7 @@ class RecorderConfig {
|
|
|
381266
381626
|
return get$1(globalConfig, "douyu.source");
|
|
381267
381627
|
}
|
|
381268
381628
|
else if (key === "cookie") {
|
|
381269
|
-
if (setting.providerId === "
|
|
381270
|
-
return get$1(globalConfig, "douyu.cookie");
|
|
381271
|
-
}
|
|
381272
|
-
else if (setting.providerId === "DouYin") {
|
|
381629
|
+
if (setting.providerId === "DouYin") {
|
|
381273
381630
|
return get$1(globalConfig, "douyin.cookie");
|
|
381274
381631
|
}
|
|
381275
381632
|
else if (setting.providerId === "XHS") {
|
|
@@ -381371,7 +381728,16 @@ class RecorderConfig {
|
|
|
381371
381728
|
}
|
|
381372
381729
|
}
|
|
381373
381730
|
else if (setting.providerId === "DouYu") {
|
|
381374
|
-
|
|
381731
|
+
uid = getValue("uid");
|
|
381732
|
+
if (uid) {
|
|
381733
|
+
try {
|
|
381734
|
+
auth = readDouyuUser(Number(uid))?.loginCookies.main;
|
|
381735
|
+
// console.log("pp", readDouyuUser(Number(uid)));
|
|
381736
|
+
}
|
|
381737
|
+
catch (error) {
|
|
381738
|
+
console.error(error);
|
|
381739
|
+
}
|
|
381740
|
+
}
|
|
381375
381741
|
}
|
|
381376
381742
|
else if (setting.providerId === "DouYin") {
|
|
381377
381743
|
auth = getValue("cookie");
|
|
@@ -381599,7 +381965,7 @@ async function sendEndLiveNotification(appConfig, recorder, config) {
|
|
|
381599
381965
|
}
|
|
381600
381966
|
async function convert2Mp4(videoFile) {
|
|
381601
381967
|
const output = replaceExtName$1(videoFile, ".mp4");
|
|
381602
|
-
if (await fs$
|
|
381968
|
+
if (await fs$m.pathExists(output)) {
|
|
381603
381969
|
throw new Error(`目标文件已存在: ${output}`);
|
|
381604
381970
|
}
|
|
381605
381971
|
const name = path$z.basename(output);
|
|
@@ -381753,7 +382119,7 @@ async function createRecorderManager(appConfig) {
|
|
|
381753
382119
|
return;
|
|
381754
382120
|
if (recorder.recordHandle) {
|
|
381755
382121
|
const logFilePath = utils$3.replaceExtName(`${recorder.recordHandle.savePath}_${recorder.id}`, ".recorder.log");
|
|
381756
|
-
fs$
|
|
382122
|
+
fs$m.appendFile(logFilePath, log.text + "\n").catch(() => { });
|
|
381757
382123
|
return;
|
|
381758
382124
|
}
|
|
381759
382125
|
else {
|
|
@@ -381902,7 +382268,7 @@ async function createRecorderManager(appConfig) {
|
|
|
381902
382268
|
interact_num: stats.uniqMember,
|
|
381903
382269
|
});
|
|
381904
382270
|
}
|
|
381905
|
-
else if (xmlFile && (await fs$
|
|
382271
|
+
else if (xmlFile && (await fs$m.pathExists(xmlFile))) {
|
|
381906
382272
|
const { uniqMember, danmaNum } = await danmaReport(xmlFile);
|
|
381907
382273
|
recordHistory.upadteLive({
|
|
381908
382274
|
video_file: filename,
|
|
@@ -381915,7 +382281,7 @@ async function createRecorderManager(appConfig) {
|
|
|
381915
382281
|
if (data?.convert2Mp4) {
|
|
381916
382282
|
try {
|
|
381917
382283
|
await convert2Mp4(filename);
|
|
381918
|
-
await fs$
|
|
382284
|
+
await fs$m.unlink(filename);
|
|
381919
382285
|
logObj.info("转换 mp4 成功,已删除原文件", { filename });
|
|
381920
382286
|
}
|
|
381921
382287
|
catch (error) {
|
|
@@ -381987,7 +382353,7 @@ async function createRecorderManager(appConfig) {
|
|
|
381987
382353
|
}
|
|
381988
382354
|
}
|
|
381989
382355
|
const xmlFile = replaceExtName$1(filename, ".xml");
|
|
381990
|
-
if (config.recorder.saveDanma2DB && xmlFile && (await fs$
|
|
382356
|
+
if (config.recorder.saveDanma2DB && xmlFile && (await fs$m.pathExists(xmlFile))) {
|
|
381991
382357
|
const history = recordHistory.getRecord({
|
|
381992
382358
|
file: filename,
|
|
381993
382359
|
live_id: liveId,
|
|
@@ -382169,7 +382535,8 @@ const init = async (config) => {
|
|
|
382169
382535
|
try {
|
|
382170
382536
|
const commentQueue = container.resolve("commentQueue");
|
|
382171
382537
|
commentQueue.checkLoop();
|
|
382172
|
-
|
|
382538
|
+
checkBiliAccountLoop();
|
|
382539
|
+
void checkDouyuAccountLoop();
|
|
382173
382540
|
checkDiskSpaceLoop();
|
|
382174
382541
|
createInterval();
|
|
382175
382542
|
check$1();
|
|
@@ -382194,7 +382561,7 @@ const checkDiskSpaceLoop = async () => {
|
|
|
382194
382561
|
const threshold = config?.notification?.task?.diskSpaceCheck?.threshold ?? 10;
|
|
382195
382562
|
if (config?.notification?.task?.diskSpaceCheck?.values?.includes("bilirecorder")) {
|
|
382196
382563
|
if (config?.webhook?.recoderFolder &&
|
|
382197
|
-
(await fs$
|
|
382564
|
+
(await fs$m.pathExists(config?.webhook?.recoderFolder))) {
|
|
382198
382565
|
// @ts-ignore
|
|
382199
382566
|
const diskInfo = await checkDiskSpace(config?.webhook?.recoderFolder);
|
|
382200
382567
|
if (diskInfo.free < threshold * 1024 * 1024 * 1024) {
|
|
@@ -382213,7 +382580,7 @@ const checkDiskSpaceLoop = async () => {
|
|
|
382213
382580
|
}
|
|
382214
382581
|
}
|
|
382215
382582
|
if (config?.notification?.task?.diskSpaceCheck?.values?.includes("bililiveTools")) {
|
|
382216
|
-
if (config?.recorder?.savePath && (await fs$
|
|
382583
|
+
if (config?.recorder?.savePath && (await fs$m.pathExists(config?.recorder?.savePath))) {
|
|
382217
382584
|
// @ts-ignore
|
|
382218
382585
|
const diskInfo = await checkDiskSpace(config?.recorder?.savePath);
|
|
382219
382586
|
if (diskInfo.free < threshold * 1024 * 1024 * 1024) {
|
|
@@ -382255,6 +382622,7 @@ exports.Client = Client$9;
|
|
|
382255
382622
|
exports.DEFAULT_BILIUP_CONFIG = DEFAULT_BILIUP_CONFIG;
|
|
382256
382623
|
exports.DanmuPreset = DanmuPreset;
|
|
382257
382624
|
exports.DouyinDownloadVideoTask = DouyinDownloadVideoTask;
|
|
382625
|
+
exports.DouyuQrcodeLogin = DouyuQrcodeLogin;
|
|
382258
382626
|
exports.FFmpegPreset = FFmpegPreset;
|
|
382259
382627
|
exports.FlvRepairTask = FlvRepairTask;
|
|
382260
382628
|
exports.FormData = FormData$2;
|
|
@@ -382291,16 +382659,17 @@ exports.constants = constants$a;
|
|
|
382291
382659
|
exports.convertXml2Ass = convertXml2Ass;
|
|
382292
382660
|
exports.cut = cut;
|
|
382293
382661
|
exports.defaultRecordConfig = defaultRecordConfig;
|
|
382662
|
+
exports.deleteDouyuUser = deleteDouyuUser;
|
|
382294
382663
|
exports.douyu = douyu;
|
|
382295
382664
|
exports.esDefineProperty = esDefineProperty;
|
|
382296
382665
|
exports.escaped = escaped;
|
|
382297
382666
|
exports.executeVirtualRecordConfig = executeVirtualRecordConfig;
|
|
382298
382667
|
exports.extension = extension$4;
|
|
382299
|
-
exports.fetch = fetch$
|
|
382668
|
+
exports.fetch = fetch$2;
|
|
382300
382669
|
exports.formatDesc = formatDesc;
|
|
382301
382670
|
exports.formatPartTitle = formatPartTitle;
|
|
382302
382671
|
exports.formatTitle = formatTitle;
|
|
382303
|
-
exports.fs = fs$
|
|
382672
|
+
exports.fs = fs$m;
|
|
382304
382673
|
exports.functionBind = functionBind;
|
|
382305
382674
|
exports.genTimeData = genTimeData;
|
|
382306
382675
|
exports.getBinPath = getBinPath;
|
|
@@ -382342,10 +382711,12 @@ exports.parseSavePath = parseSavePath;
|
|
|
382342
382711
|
exports.permessageDeflate = permessageDeflate$2;
|
|
382343
382712
|
exports.pick = pick;
|
|
382344
382713
|
exports.picomatch = picomatch$1;
|
|
382714
|
+
exports.readDouyuUserList = readDouyuUserList;
|
|
382345
382715
|
exports.readVideoMeta = readVideoMeta;
|
|
382346
382716
|
exports.readXmlTimestamp = readXmlTimestamp;
|
|
382347
382717
|
exports.reconnectDB = reconnectDB;
|
|
382348
382718
|
exports.recordHistory = recordHistory;
|
|
382719
|
+
exports.refreshDouyuUser = refreshDouyuUser;
|
|
382349
382720
|
exports.replaceExtName = replaceExtName$1;
|
|
382350
382721
|
exports.replaceFourByteUnicode = replaceFourByteUnicode$1;
|
|
382351
382722
|
exports.requireMs = requireMs$1;
|
|
@@ -382363,6 +382734,8 @@ exports.transcode = transcode;
|
|
|
382363
382734
|
exports.trashItem = trashItem;
|
|
382364
382735
|
exports.uuid = uuid$4;
|
|
382365
382736
|
exports.validateBiliupConfig = validateBiliupConfig;
|
|
382737
|
+
exports.validateDouyuUser = validateDouyuUser;
|
|
382366
382738
|
exports.validationExports = validationExports$1;
|
|
382367
382739
|
exports.videoSub = videoSub;
|
|
382368
382740
|
exports.websocket = websocket$2;
|
|
382741
|
+
exports.writeDouyuUser = writeDouyuUser;
|