bililive-cli 4.0.0 → 4.1.0
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-Cl9Q2SkN.cjs → fileFromPath-DN6n6hnT.cjs} +2 -2
- package/lib/{index-DonNRzzv.cjs → index-BfVtxagW.cjs} +59 -8
- package/lib/{index-CWkwaDmT.cjs → index-CyQ_VJuq.cjs} +809 -702
- package/lib/index.cjs +3 -3
- package/lib/{linux-dGf0gycY.cjs → linux-BInfI0l8.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$l = require('node:events');
|
|
20
|
-
var fs$
|
|
20
|
+
var fs$D = 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$E = 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$C = {};
|
|
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$B = 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$B[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$B, 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$B.close = (function (fs$close) {
|
|
691
691
|
function close (fd, cb) {
|
|
692
|
-
return fs$close.call(fs$
|
|
692
|
+
return fs$close.call(fs$B, 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$D[gracefulQueue]) {
|
|
|
704
704
|
value: fs$close
|
|
705
705
|
});
|
|
706
706
|
return close
|
|
707
|
-
})(fs$
|
|
707
|
+
})(fs$B.close);
|
|
708
708
|
|
|
709
|
-
fs$
|
|
709
|
+
fs$B.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$B, arguments);
|
|
713
713
|
resetQueue();
|
|
714
714
|
}
|
|
715
715
|
|
|
@@ -717,24 +717,24 @@ if (!fs$D[gracefulQueue]) {
|
|
|
717
717
|
value: fs$closeSync
|
|
718
718
|
});
|
|
719
719
|
return closeSync
|
|
720
|
-
})(fs$
|
|
720
|
+
})(fs$B.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$B[gracefulQueue]);
|
|
725
|
+
require$$0$5.equal(fs$B[gracefulQueue].length, 0);
|
|
726
726
|
});
|
|
727
727
|
}
|
|
728
728
|
}
|
|
729
729
|
|
|
730
730
|
if (!commonjsGlobal[gracefulQueue]) {
|
|
731
|
-
publishQueue(commonjsGlobal, fs$
|
|
731
|
+
publishQueue(commonjsGlobal, fs$B[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$B));
|
|
735
|
+
if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs$B.__patched) {
|
|
736
|
+
gracefulFs = patch(fs$B);
|
|
737
|
+
fs$B.__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$B[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$B[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$B[gracefulQueue][i].length > 2) {
|
|
1027
|
+
fs$B[gracefulQueue][i][3] = now; // startTime
|
|
1028
|
+
fs$B[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$B[gracefulQueue].length === 0)
|
|
1041
1041
|
return
|
|
1042
1042
|
|
|
1043
|
-
var elem = fs$
|
|
1043
|
+
var elem = fs$B[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$B[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$C));
|
|
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$A = fs$C;
|
|
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$A.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$A.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$z = fs$C;
|
|
1293
1293
|
|
|
1294
1294
|
function pathExists$7 (path) {
|
|
1295
|
-
return fs$
|
|
1295
|
+
return fs$z.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$z.existsSync
|
|
1301
1301
|
};
|
|
1302
1302
|
|
|
1303
|
-
const fs$
|
|
1303
|
+
const fs$y = fs$C;
|
|
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$y.open(path, 'r+');
|
|
1309
1309
|
|
|
1310
1310
|
let closeErr = null;
|
|
1311
1311
|
|
|
1312
1312
|
try {
|
|
1313
|
-
await fs$
|
|
1313
|
+
await fs$y.futimes(fd, atime, mtime);
|
|
1314
1314
|
} finally {
|
|
1315
1315
|
try {
|
|
1316
|
-
await fs$
|
|
1316
|
+
await fs$y.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$y.openSync(path, 'r+');
|
|
1329
|
+
fs$y.futimesSync(fd, atime, mtime);
|
|
1330
|
+
return fs$y.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$x = fs$C;
|
|
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$x.stat(file, { bigint: true })
|
|
1345
|
+
: (file) => fs$x.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$x.statSync(file, { bigint: true })
|
|
1359
|
+
: (file) => fs$x.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$x.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$x.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$w = fs$C;
|
|
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$w.stat : fs$w.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$w.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$w.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$w.stat(src);
|
|
1588
1588
|
await utimesMillis(dest, updatedSrcStat.atime, updatedSrcStat.mtime);
|
|
1589
1589
|
}
|
|
1590
1590
|
|
|
1591
|
-
return fs$
|
|
1591
|
+
return fs$w.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$w.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$w.mkdir(dest);
|
|
1606
1606
|
}
|
|
1607
1607
|
|
|
1608
|
-
const items = await fs$
|
|
1608
|
+
const items = await fs$w.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$w.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$w.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$w.symlink(resolvedSrc, dest)
|
|
1638
1638
|
}
|
|
1639
1639
|
|
|
1640
1640
|
let resolvedDest = null;
|
|
1641
1641
|
try {
|
|
1642
|
-
resolvedDest = await fs$
|
|
1642
|
+
resolvedDest = await fs$w.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$w.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$w.unlink(dest);
|
|
1666
|
+
return fs$w.symlink(resolvedSrc, dest)
|
|
1667
1667
|
}
|
|
1668
1668
|
|
|
1669
1669
|
var copy_1 = copy$2;
|
|
1670
1670
|
|
|
1671
|
-
const fs$
|
|
1671
|
+
const fs$v = 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$v.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$v.statSync : fs$v.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$v.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$v.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$v.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$v.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$v.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$v.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$v.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$v.symlinkSync(resolvedSrc, dest)
|
|
1796
1796
|
} else {
|
|
1797
1797
|
let resolvedDest;
|
|
1798
1798
|
try {
|
|
1799
|
-
resolvedDest = fs$
|
|
1799
|
+
resolvedDest = fs$v.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$v.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$v.unlinkSync(dest);
|
|
1826
|
+
return fs$v.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$u = gracefulFs;
|
|
1838
1838
|
const u$b = universalify$1.fromCallback;
|
|
1839
1839
|
|
|
1840
1840
|
function remove$3 (path, callback) {
|
|
1841
|
-
fs$
|
|
1841
|
+
fs$u.rm(path, { recursive: true, force: true }, callback);
|
|
1842
1842
|
}
|
|
1843
1843
|
|
|
1844
1844
|
function removeSync$1 (path) {
|
|
1845
|
-
fs$
|
|
1845
|
+
fs$u.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$t = fs$C;
|
|
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$t.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$t.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$s = fs$C;
|
|
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$s.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$s.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$s.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$s.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$s.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$s.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$s.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$s.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$s.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$r = fs$C;
|
|
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$r.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$r.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$r.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$r.lstatSync(dstpath);
|
|
1996
1996
|
} catch {}
|
|
1997
1997
|
|
|
1998
1998
|
try {
|
|
1999
|
-
const srcStat = fs$
|
|
1999
|
+
const srcStat = fs$r.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$r.existsSync(dir);
|
|
2008
|
+
if (dirExists) return fs$r.linkSync(srcpath, dstpath)
|
|
2009
2009
|
mkdir$2.mkdirsSync(dir);
|
|
2010
2010
|
|
|
2011
|
-
return fs$
|
|
2011
|
+
return fs$r.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$q = fs$C;
|
|
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$q.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$q.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$q.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$q.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$q.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$p = fs$C;
|
|
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$p.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$p.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$o = fs$C;
|
|
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$o.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$o.stat(srcpath),
|
|
2174
|
+
fs$o.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$o.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$o.lstatSync(dstpath);
|
|
2196
2196
|
} catch { }
|
|
2197
2197
|
if (stats && stats.isSymbolicLink()) {
|
|
2198
|
-
const srcStat = fs$
|
|
2199
|
-
const dstStat = fs$
|
|
2198
|
+
const srcStat = fs$o.statSync(srcpath);
|
|
2199
|
+
const dstStat = fs$o.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$o.existsSync(dir);
|
|
2208
|
+
if (exists) return fs$o.symlinkSync(srcpath, dstpath, type)
|
|
2209
2209
|
mkdirsSync(dir);
|
|
2210
|
-
return fs$
|
|
2210
|
+
return fs$o.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$n = fs$C;
|
|
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$n.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$n.existsSync(dir)) {
|
|
2373
2373
|
mkdir$1.mkdirsSync(dir);
|
|
2374
2374
|
}
|
|
2375
2375
|
|
|
2376
|
-
fs$
|
|
2376
|
+
fs$n.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$m = fs$C;
|
|
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$m.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$l = 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$l.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$l.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$C,
|
|
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$k = /*@__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$j = {};
|
|
2594
2594
|
|
|
2595
|
-
Object.defineProperty(fs$
|
|
2596
|
-
fs$
|
|
2595
|
+
Object.defineProperty(fs$j, "__esModule", { value: true });
|
|
2596
|
+
fs$j.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$j.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$i = fs$j;
|
|
7245
|
+
utils$w.fs = fs$i;
|
|
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$h = {};
|
|
7447
7447
|
|
|
7448
7448
|
(function (exports) {
|
|
7449
7449
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -7462,15 +7462,15 @@ var fs$j = {};
|
|
|
7462
7462
|
return Object.assign(Object.assign({}, exports.FILE_SYSTEM_ADAPTER), fsMethods);
|
|
7463
7463
|
}
|
|
7464
7464
|
exports.createFileSystemAdapter = createFileSystemAdapter;
|
|
7465
|
-
} (fs$
|
|
7465
|
+
} (fs$h));
|
|
7466
7466
|
|
|
7467
7467
|
Object.defineProperty(settings$3, "__esModule", { value: true });
|
|
7468
|
-
const fs$
|
|
7468
|
+
const fs$g = fs$h;
|
|
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$g.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$f = {};
|
|
7595
7595
|
|
|
7596
|
-
Object.defineProperty(fs$
|
|
7597
|
-
fs$
|
|
7596
|
+
Object.defineProperty(fs$f, "__esModule", { value: true });
|
|
7597
|
+
fs$f.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$f.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$e = fs$f;
|
|
7618
|
+
utils$l.fs = fs$e;
|
|
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$d = {};
|
|
7798
7798
|
|
|
7799
7799
|
(function (exports) {
|
|
7800
7800
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -7815,17 +7815,17 @@ var fs$f = {};
|
|
|
7815
7815
|
return Object.assign(Object.assign({}, exports.FILE_SYSTEM_ADAPTER), fsMethods);
|
|
7816
7816
|
}
|
|
7817
7817
|
exports.createFileSystemAdapter = createFileSystemAdapter;
|
|
7818
|
-
} (fs$
|
|
7818
|
+
} (fs$d));
|
|
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$c = fs$d;
|
|
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$c.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$D.chmod), ATTEMPTIFY_CHANGE_ERROR_OPTIONS),
|
|
11355
|
+
chown: attemptifyAsync(require$$3$1.promisify(fs$D.chown), ATTEMPTIFY_CHANGE_ERROR_OPTIONS),
|
|
11356
|
+
close: attemptifyAsync(require$$3$1.promisify(fs$D.close), ATTEMPTIFY_NOOP_OPTIONS),
|
|
11357
|
+
fsync: attemptifyAsync(require$$3$1.promisify(fs$D.fsync), ATTEMPTIFY_NOOP_OPTIONS),
|
|
11358
|
+
mkdir: attemptifyAsync(require$$3$1.promisify(fs$D.mkdir), ATTEMPTIFY_NOOP_OPTIONS),
|
|
11359
|
+
realpath: attemptifyAsync(require$$3$1.promisify(fs$D.realpath), ATTEMPTIFY_NOOP_OPTIONS),
|
|
11360
|
+
stat: attemptifyAsync(require$$3$1.promisify(fs$D.stat), ATTEMPTIFY_NOOP_OPTIONS),
|
|
11361
|
+
unlink: attemptifyAsync(require$$3$1.promisify(fs$D.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$D.chmodSync, ATTEMPTIFY_CHANGE_ERROR_OPTIONS),
|
|
11364
|
+
chownSync: attemptifySync(fs$D.chownSync, ATTEMPTIFY_CHANGE_ERROR_OPTIONS),
|
|
11365
|
+
closeSync: attemptifySync(fs$D.closeSync, ATTEMPTIFY_NOOP_OPTIONS),
|
|
11366
|
+
existsSync: attemptifySync(fs$D.existsSync, ATTEMPTIFY_NOOP_OPTIONS),
|
|
11367
|
+
fsyncSync: attemptifySync(fs$D.fsync, ATTEMPTIFY_NOOP_OPTIONS),
|
|
11368
|
+
mkdirSync: attemptifySync(fs$D.mkdirSync, ATTEMPTIFY_NOOP_OPTIONS),
|
|
11369
|
+
realpathSync: attemptifySync(fs$D.realpathSync, ATTEMPTIFY_NOOP_OPTIONS),
|
|
11370
|
+
statSync: attemptifySync(fs$D.statSync, ATTEMPTIFY_NOOP_OPTIONS),
|
|
11371
|
+
unlinkSync: attemptifySync(fs$D.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$D.close), RETRYIFY_OPTIONS),
|
|
11376
|
+
fsync: retryifyAsync(require$$3$1.promisify(fs$D.fsync), RETRYIFY_OPTIONS),
|
|
11377
|
+
open: retryifyAsync(require$$3$1.promisify(fs$D.open), RETRYIFY_OPTIONS),
|
|
11378
|
+
readFile: retryifyAsync(require$$3$1.promisify(fs$D.readFile), RETRYIFY_OPTIONS),
|
|
11379
|
+
rename: retryifyAsync(require$$3$1.promisify(fs$D.rename), RETRYIFY_OPTIONS),
|
|
11380
|
+
stat: retryifyAsync(require$$3$1.promisify(fs$D.stat), RETRYIFY_OPTIONS),
|
|
11381
|
+
write: retryifyAsync(require$$3$1.promisify(fs$D.write), RETRYIFY_OPTIONS),
|
|
11382
|
+
writeFile: retryifyAsync(require$$3$1.promisify(fs$D.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$D.closeSync, RETRYIFY_OPTIONS),
|
|
11385
|
+
fsyncSync: retryifySync(fs$D.fsyncSync, RETRYIFY_OPTIONS),
|
|
11386
|
+
openSync: retryifySync(fs$D.openSync, RETRYIFY_OPTIONS),
|
|
11387
|
+
readFileSync: retryifySync(fs$D.readFileSync, RETRYIFY_OPTIONS),
|
|
11388
|
+
renameSync: retryifySync(fs$D.renameSync, RETRYIFY_OPTIONS),
|
|
11389
|
+
statSync: retryifySync(fs$D.statSync, RETRYIFY_OPTIONS),
|
|
11390
|
+
writeSync: retryifySync(fs$D.writeSync, RETRYIFY_OPTIONS),
|
|
11391
|
+
writeFileSync: retryifySync(fs$D.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$D.createWriteStream(tempPath, { fd, autoClose: false });
|
|
11629
11629
|
const finishPromise = EventEmitter$l.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$k.pathExists(presetsPath)) {
|
|
11748
|
+
const presets = await fs$k.readJSON(presetsPath);
|
|
11749
11749
|
presets.map((preset) => {
|
|
11750
11750
|
preset.config = { ...this.defaultConfig, ...preset.config };
|
|
11751
11751
|
return preset;
|
|
@@ -12169,6 +12169,7 @@ const APP_DEFAULT_CONFIG = {
|
|
|
12169
12169
|
quality: "origin",
|
|
12170
12170
|
formatName: "auto",
|
|
12171
12171
|
cookie: "",
|
|
12172
|
+
cookieMode: "all",
|
|
12172
12173
|
doubleScreen: true,
|
|
12173
12174
|
api: "web",
|
|
12174
12175
|
checkInterval: undefined,
|
|
@@ -12639,6 +12640,7 @@ const defaultRecordConfig = {
|
|
|
12639
12640
|
recorderType: "ffmpeg",
|
|
12640
12641
|
cookie: "",
|
|
12641
12642
|
proxy: "",
|
|
12643
|
+
cookieMode: "all",
|
|
12642
12644
|
doubleScreen: true,
|
|
12643
12645
|
useServerTimestamp: false,
|
|
12644
12646
|
handleTime: [null, null],
|
|
@@ -40048,7 +40050,7 @@ var path$c = require$$0$7;
|
|
|
40048
40050
|
var http$e = require$$1$4;
|
|
40049
40051
|
var https$b = require$$1$5;
|
|
40050
40052
|
var parseUrl$2 = require$$0$9.parse;
|
|
40051
|
-
var fs$
|
|
40053
|
+
var fs$b = require$$0$6;
|
|
40052
40054
|
var Stream$2 = require$$0$4.Stream;
|
|
40053
40055
|
var crypto$c = require$$1$6;
|
|
40054
40056
|
var mime = mimeTypes$3;
|
|
@@ -40175,7 +40177,7 @@ FormData$1.prototype._lengthRetriever = function (value, callback) {
|
|
|
40175
40177
|
// not that fast snoopy
|
|
40176
40178
|
} else {
|
|
40177
40179
|
// still need to fetch file size from fs
|
|
40178
|
-
fs$
|
|
40180
|
+
fs$b.stat(value.path, function (err, stat) {
|
|
40179
40181
|
if (err) {
|
|
40180
40182
|
callback(err);
|
|
40181
40183
|
return;
|
|
@@ -47305,7 +47307,7 @@ const {
|
|
|
47305
47307
|
mergeConfig,
|
|
47306
47308
|
} = axios;
|
|
47307
47309
|
|
|
47308
|
-
const fs$
|
|
47310
|
+
const fs$a = require$$0$6;
|
|
47309
47311
|
const path$b = require$$0$7;
|
|
47310
47312
|
|
|
47311
47313
|
var packageJson$1 = {
|
|
@@ -47341,7 +47343,7 @@ function tryReadJsonAt(...searchPaths) {
|
|
|
47341
47343
|
return undefined;
|
|
47342
47344
|
}
|
|
47343
47345
|
|
|
47344
|
-
const json = JSON.parse(fs$
|
|
47346
|
+
const json = JSON.parse(fs$a.readFileSync(fileName, 'utf8'));
|
|
47345
47347
|
const name = json?.productName || json?.name;
|
|
47346
47348
|
if (!name || name.toLowerCase() === 'electron') {
|
|
47347
47349
|
return undefined;
|
|
@@ -47370,7 +47372,7 @@ function findUp(fileName, cwd) {
|
|
|
47370
47372
|
const root = parsedPath.root;
|
|
47371
47373
|
const dir = parsedPath.dir;
|
|
47372
47374
|
|
|
47373
|
-
if (fs$
|
|
47375
|
+
if (fs$a.existsSync(path$b.join(currentPath, fileName))) {
|
|
47374
47376
|
return path$b.resolve(path$b.join(currentPath, fileName));
|
|
47375
47377
|
}
|
|
47376
47378
|
|
|
@@ -48722,7 +48724,7 @@ function levelToStyle(level) {
|
|
|
48722
48724
|
}
|
|
48723
48725
|
|
|
48724
48726
|
const EventEmitter$k = require$$0$8;
|
|
48725
|
-
const fs$
|
|
48727
|
+
const fs$9 = require$$0$6;
|
|
48726
48728
|
const os$2 = require$$1$2;
|
|
48727
48729
|
|
|
48728
48730
|
let File$3 = class File extends EventEmitter$k {
|
|
@@ -48752,7 +48754,7 @@ let File$3 = class File extends EventEmitter$k {
|
|
|
48752
48754
|
|
|
48753
48755
|
clear() {
|
|
48754
48756
|
try {
|
|
48755
|
-
fs$
|
|
48757
|
+
fs$9.writeFileSync(this.path, '', {
|
|
48756
48758
|
mode: this.writeOptions.mode,
|
|
48757
48759
|
flag: 'w',
|
|
48758
48760
|
});
|
|
@@ -48785,7 +48787,7 @@ let File$3 = class File extends EventEmitter$k {
|
|
|
48785
48787
|
getSize() {
|
|
48786
48788
|
if (this.initialSize === undefined) {
|
|
48787
48789
|
try {
|
|
48788
|
-
const stats = fs$
|
|
48790
|
+
const stats = fs$9.statSync(this.path);
|
|
48789
48791
|
this.initialSize = stats.size;
|
|
48790
48792
|
} catch (e) {
|
|
48791
48793
|
this.initialSize = 0;
|
|
@@ -48814,7 +48816,7 @@ let File$3 = class File extends EventEmitter$k {
|
|
|
48814
48816
|
this.asyncWriteQueue = [];
|
|
48815
48817
|
this.hasActiveAsyncWriting = true;
|
|
48816
48818
|
|
|
48817
|
-
fs$
|
|
48819
|
+
fs$9.writeFile(this.path, text, this.writeOptions, (e) => {
|
|
48818
48820
|
file.hasActiveAsyncWriting = false;
|
|
48819
48821
|
|
|
48820
48822
|
if (e) {
|
|
@@ -48850,7 +48852,7 @@ let File$3 = class File extends EventEmitter$k {
|
|
|
48850
48852
|
}
|
|
48851
48853
|
|
|
48852
48854
|
try {
|
|
48853
|
-
fs$
|
|
48855
|
+
fs$9.writeFileSync(this.path, text, this.writeOptions);
|
|
48854
48856
|
this.increaseBytesWrittenCounter(text);
|
|
48855
48857
|
} catch (e) {
|
|
48856
48858
|
this.emit(
|
|
@@ -48866,14 +48868,14 @@ var File_1 = File$3;
|
|
|
48866
48868
|
|
|
48867
48869
|
function readFileSyncFromEnd(filePath, bytesCount) {
|
|
48868
48870
|
const buffer = Buffer.alloc(bytesCount);
|
|
48869
|
-
const stats = fs$
|
|
48871
|
+
const stats = fs$9.statSync(filePath);
|
|
48870
48872
|
|
|
48871
48873
|
const readLength = Math.min(stats.size, bytesCount);
|
|
48872
48874
|
const offset = Math.max(0, stats.size - bytesCount);
|
|
48873
48875
|
|
|
48874
|
-
const fd = fs$
|
|
48875
|
-
const totalBytes = fs$
|
|
48876
|
-
fs$
|
|
48876
|
+
const fd = fs$9.openSync(filePath, 'r');
|
|
48877
|
+
const totalBytes = fs$9.readSync(fd, buffer, 0, readLength, offset);
|
|
48878
|
+
fs$9.closeSync(fd);
|
|
48877
48879
|
|
|
48878
48880
|
return buffer.toString('utf8', 0, totalBytes);
|
|
48879
48881
|
}
|
|
@@ -48905,7 +48907,7 @@ let NullFile$1 = class NullFile extends File$2 {
|
|
|
48905
48907
|
var NullFile_1 = NullFile$1;
|
|
48906
48908
|
|
|
48907
48909
|
const EventEmitter$j = require$$0$8;
|
|
48908
|
-
const fs$
|
|
48910
|
+
const fs$8 = require$$0$6;
|
|
48909
48911
|
const path$9 = require$$0$7;
|
|
48910
48912
|
const File$1 = File_1;
|
|
48911
48913
|
const NullFile = NullFile_1;
|
|
@@ -48972,14 +48974,14 @@ let FileRegistry$1 = class FileRegistry extends EventEmitter$j {
|
|
|
48972
48974
|
* @private
|
|
48973
48975
|
*/
|
|
48974
48976
|
testFileWriting({ filePath, writeOptions }) {
|
|
48975
|
-
fs$
|
|
48976
|
-
fs$
|
|
48977
|
+
fs$8.mkdirSync(path$9.dirname(filePath), { recursive: true });
|
|
48978
|
+
fs$8.writeFileSync(filePath, '', { flag: 'a', mode: writeOptions.mode });
|
|
48977
48979
|
}
|
|
48978
48980
|
};
|
|
48979
48981
|
|
|
48980
48982
|
var FileRegistry_1 = FileRegistry$1;
|
|
48981
48983
|
|
|
48982
|
-
const fs$
|
|
48984
|
+
const fs$7 = require$$0$6;
|
|
48983
48985
|
const os$1 = require$$1$2;
|
|
48984
48986
|
const path$8 = require$$0$7;
|
|
48985
48987
|
const FileRegistry = FileRegistry_1;
|
|
@@ -49025,7 +49027,7 @@ function fileTransportFactory(
|
|
|
49025
49027
|
const oldPath = file.toString();
|
|
49026
49028
|
const inf = path$8.parse(oldPath);
|
|
49027
49029
|
try {
|
|
49028
|
-
fs$
|
|
49030
|
+
fs$7.renameSync(oldPath, path$8.join(inf.dir, `${inf.name}.old${inf.ext}`));
|
|
49029
49031
|
} catch (e) {
|
|
49030
49032
|
logConsole('Could not rotate log', e);
|
|
49031
49033
|
const quarterOfMaxSize = Math.round(transport.maxSize / 4);
|
|
@@ -49114,18 +49116,18 @@ function fileTransportFactory(
|
|
|
49114
49116
|
initializeOnFirstAccess();
|
|
49115
49117
|
const logsPath = path$8.dirname(transport.resolvePathFn(pathVariables));
|
|
49116
49118
|
|
|
49117
|
-
if (!fs$
|
|
49119
|
+
if (!fs$7.existsSync(logsPath)) {
|
|
49118
49120
|
return [];
|
|
49119
49121
|
}
|
|
49120
49122
|
|
|
49121
|
-
return fs$
|
|
49123
|
+
return fs$7.readdirSync(logsPath)
|
|
49122
49124
|
.map((fileName) => path$8.join(logsPath, fileName))
|
|
49123
49125
|
.filter(fileFilter)
|
|
49124
49126
|
.map((logPath) => {
|
|
49125
49127
|
try {
|
|
49126
49128
|
return {
|
|
49127
49129
|
path: logPath,
|
|
49128
|
-
lines: fs$
|
|
49130
|
+
lines: fs$7.readFileSync(logPath, 'utf8').split(os$1.EOL),
|
|
49129
49131
|
};
|
|
49130
49132
|
} catch {
|
|
49131
49133
|
return null;
|
|
@@ -49584,6 +49586,14 @@ class RecordHistoryModel extends BaseModel {
|
|
|
49584
49586
|
});
|
|
49585
49587
|
return resultMap;
|
|
49586
49588
|
}
|
|
49589
|
+
getRecordStartTimes(streamerId, startTime, endTime) {
|
|
49590
|
+
const rows = this.db
|
|
49591
|
+
.prepare(`SELECT record_start_time FROM ${this.tableName}
|
|
49592
|
+
WHERE streamer_id = ? AND record_start_time >= ? AND record_start_time < ?
|
|
49593
|
+
ORDER BY record_start_time`)
|
|
49594
|
+
.all(streamerId, startTime, endTime);
|
|
49595
|
+
return rows.map((row) => row.record_start_time);
|
|
49596
|
+
}
|
|
49587
49597
|
/**
|
|
49588
49598
|
* 分页查询记录历史,支持时间范围过滤和排序
|
|
49589
49599
|
* @param options 查询参数
|
|
@@ -50035,6 +50045,9 @@ class RecordHistoryService {
|
|
|
50035
50045
|
getLastRecordTimes(streamerIds) {
|
|
50036
50046
|
return this.recordHistoryModel.getLastRecordTimes(streamerIds);
|
|
50037
50047
|
}
|
|
50048
|
+
getRecordStartTimes(streamerId, startTime, endTime) {
|
|
50049
|
+
return this.recordHistoryModel.getRecordStartTimes(streamerId, startTime, endTime);
|
|
50050
|
+
}
|
|
50038
50051
|
/**
|
|
50039
50052
|
* 查询总视频时长,默认查询最近一个月
|
|
50040
50053
|
* @param options 查询参数
|
|
@@ -50746,7 +50759,7 @@ var old$1 = {};
|
|
|
50746
50759
|
|
|
50747
50760
|
var pathModule = require$$0$7;
|
|
50748
50761
|
var isWindows$2 = process.platform === 'win32';
|
|
50749
|
-
var fs$
|
|
50762
|
+
var fs$6 = require$$0$6;
|
|
50750
50763
|
|
|
50751
50764
|
// JavaScript implementation of realpath, ported from node pre-v6
|
|
50752
50765
|
|
|
@@ -50841,7 +50854,7 @@ old$1.realpathSync = function realpathSync(p, cache) {
|
|
|
50841
50854
|
|
|
50842
50855
|
// On windows, check that the root exists. On unix there is no need.
|
|
50843
50856
|
if (isWindows$2 && !knownHard[base]) {
|
|
50844
|
-
fs$
|
|
50857
|
+
fs$6.lstatSync(base);
|
|
50845
50858
|
knownHard[base] = true;
|
|
50846
50859
|
}
|
|
50847
50860
|
}
|
|
@@ -50868,7 +50881,7 @@ old$1.realpathSync = function realpathSync(p, cache) {
|
|
|
50868
50881
|
// some known symbolic link. no need to stat again.
|
|
50869
50882
|
resolvedLink = cache[base];
|
|
50870
50883
|
} else {
|
|
50871
|
-
var stat = fs$
|
|
50884
|
+
var stat = fs$6.lstatSync(base);
|
|
50872
50885
|
if (!stat.isSymbolicLink()) {
|
|
50873
50886
|
knownHard[base] = true;
|
|
50874
50887
|
if (cache) cache[base] = base;
|
|
@@ -50885,8 +50898,8 @@ old$1.realpathSync = function realpathSync(p, cache) {
|
|
|
50885
50898
|
}
|
|
50886
50899
|
}
|
|
50887
50900
|
if (linkTarget === null) {
|
|
50888
|
-
fs$
|
|
50889
|
-
linkTarget = fs$
|
|
50901
|
+
fs$6.statSync(base);
|
|
50902
|
+
linkTarget = fs$6.readlinkSync(base);
|
|
50890
50903
|
}
|
|
50891
50904
|
resolvedLink = pathModule.resolve(previous, linkTarget);
|
|
50892
50905
|
// track this, if given a cache.
|
|
@@ -50943,7 +50956,7 @@ old$1.realpath = function realpath(p, cache, cb) {
|
|
|
50943
50956
|
|
|
50944
50957
|
// On windows, check that the root exists. On unix there is no need.
|
|
50945
50958
|
if (isWindows$2 && !knownHard[base]) {
|
|
50946
|
-
fs$
|
|
50959
|
+
fs$6.lstat(base, function(err) {
|
|
50947
50960
|
if (err) return cb(err);
|
|
50948
50961
|
knownHard[base] = true;
|
|
50949
50962
|
LOOP();
|
|
@@ -50980,7 +50993,7 @@ old$1.realpath = function realpath(p, cache, cb) {
|
|
|
50980
50993
|
return gotResolvedLink(cache[base]);
|
|
50981
50994
|
}
|
|
50982
50995
|
|
|
50983
|
-
return fs$
|
|
50996
|
+
return fs$6.lstat(base, gotStat);
|
|
50984
50997
|
}
|
|
50985
50998
|
|
|
50986
50999
|
function gotStat(err, stat) {
|
|
@@ -51002,10 +51015,10 @@ old$1.realpath = function realpath(p, cache, cb) {
|
|
|
51002
51015
|
return gotTarget(null, seenLinks[id], base);
|
|
51003
51016
|
}
|
|
51004
51017
|
}
|
|
51005
|
-
fs$
|
|
51018
|
+
fs$6.stat(base, function(err) {
|
|
51006
51019
|
if (err) return cb(err);
|
|
51007
51020
|
|
|
51008
|
-
fs$
|
|
51021
|
+
fs$6.readlink(base, function(err, target) {
|
|
51009
51022
|
if (!isWindows$2) seenLinks[id] = target;
|
|
51010
51023
|
gotTarget(err, target);
|
|
51011
51024
|
});
|
|
@@ -51034,9 +51047,9 @@ realpath.realpathSync = realpathSync;
|
|
|
51034
51047
|
realpath.monkeypatch = monkeypatch;
|
|
51035
51048
|
realpath.unmonkeypatch = unmonkeypatch;
|
|
51036
51049
|
|
|
51037
|
-
var fs$
|
|
51038
|
-
var origRealpath = fs$
|
|
51039
|
-
var origRealpathSync = fs$
|
|
51050
|
+
var fs$5 = require$$0$6;
|
|
51051
|
+
var origRealpath = fs$5.realpath;
|
|
51052
|
+
var origRealpathSync = fs$5.realpathSync;
|
|
51040
51053
|
|
|
51041
51054
|
var version$2 = process.version;
|
|
51042
51055
|
var ok = /^v[0-5]\./.test(version$2);
|
|
@@ -51085,13 +51098,13 @@ function realpathSync (p, cache) {
|
|
|
51085
51098
|
}
|
|
51086
51099
|
|
|
51087
51100
|
function monkeypatch () {
|
|
51088
|
-
fs$
|
|
51089
|
-
fs$
|
|
51101
|
+
fs$5.realpath = realpath;
|
|
51102
|
+
fs$5.realpathSync = realpathSync;
|
|
51090
51103
|
}
|
|
51091
51104
|
|
|
51092
51105
|
function unmonkeypatch () {
|
|
51093
|
-
fs$
|
|
51094
|
-
fs$
|
|
51106
|
+
fs$5.realpath = origRealpath;
|
|
51107
|
+
fs$5.realpathSync = origRealpathSync;
|
|
51095
51108
|
}
|
|
51096
51109
|
|
|
51097
51110
|
var concatMap$1 = function (xs, fn) {
|
|
@@ -52403,7 +52416,7 @@ function ownProp (obj, field) {
|
|
|
52403
52416
|
return Object.prototype.hasOwnProperty.call(obj, field)
|
|
52404
52417
|
}
|
|
52405
52418
|
|
|
52406
|
-
var fs$
|
|
52419
|
+
var fs$4 = require$$0$6;
|
|
52407
52420
|
var path$6 = require$$0$7;
|
|
52408
52421
|
var minimatch = minimatch_1;
|
|
52409
52422
|
var isAbsolute = pathIsAbsoluteExports;
|
|
@@ -52469,7 +52482,7 @@ function setopts (self, pattern, options) {
|
|
|
52469
52482
|
self.stat = !!options.stat;
|
|
52470
52483
|
self.noprocess = !!options.noprocess;
|
|
52471
52484
|
self.absolute = !!options.absolute;
|
|
52472
|
-
self.fs = options.fs || fs$
|
|
52485
|
+
self.fs = options.fs || fs$4;
|
|
52473
52486
|
|
|
52474
52487
|
self.maxLength = options.maxLength || Infinity;
|
|
52475
52488
|
self.cache = options.cache || Object.create(null);
|
|
@@ -54138,7 +54151,7 @@ var dirGlob$1 = {exports: {}};
|
|
|
54138
54151
|
|
|
54139
54152
|
var pathType$1 = {};
|
|
54140
54153
|
|
|
54141
|
-
const fs$
|
|
54154
|
+
const fs$3 = require$$0$6;
|
|
54142
54155
|
const pify$2 = pify$3;
|
|
54143
54156
|
|
|
54144
54157
|
function type$1(fn, fn2, fp) {
|
|
@@ -54146,7 +54159,7 @@ function type$1(fn, fn2, fp) {
|
|
|
54146
54159
|
return Promise.reject(new TypeError(`Expected a string, got ${typeof fp}`));
|
|
54147
54160
|
}
|
|
54148
54161
|
|
|
54149
|
-
return pify$2(fs$
|
|
54162
|
+
return pify$2(fs$3[fn])(fp)
|
|
54150
54163
|
.then(stats => stats[fn2]())
|
|
54151
54164
|
.catch(err => {
|
|
54152
54165
|
if (err.code === 'ENOENT') {
|
|
@@ -54163,7 +54176,7 @@ function typeSync(fn, fn2, fp) {
|
|
|
54163
54176
|
}
|
|
54164
54177
|
|
|
54165
54178
|
try {
|
|
54166
|
-
return fs$
|
|
54179
|
+
return fs$3[fn](fp)[fn2]();
|
|
54167
54180
|
} catch (err) {
|
|
54168
54181
|
if (err.code === 'ENOENT') {
|
|
54169
54182
|
return false;
|
|
@@ -54684,7 +54697,7 @@ var slash$1 = function (str) {
|
|
|
54684
54697
|
return str.replace(/\\/g, '/');
|
|
54685
54698
|
};
|
|
54686
54699
|
|
|
54687
|
-
const fs$
|
|
54700
|
+
const fs$2 = require$$0$6;
|
|
54688
54701
|
const path$4 = require$$0$7;
|
|
54689
54702
|
const glob$1 = requireGlob();
|
|
54690
54703
|
const gitIgnore = ignore;
|
|
@@ -54692,7 +54705,7 @@ const pify$1 = pify$3;
|
|
|
54692
54705
|
const slash = slash$1;
|
|
54693
54706
|
|
|
54694
54707
|
const globP$1 = pify$1(glob$1);
|
|
54695
|
-
const readFileP = pify$1(fs$
|
|
54708
|
+
const readFileP = pify$1(fs$2.readFile);
|
|
54696
54709
|
|
|
54697
54710
|
const mapGitIgnorePatternTo = base => ignore => {
|
|
54698
54711
|
if (ignore.startsWith('!')) {
|
|
@@ -54738,7 +54751,7 @@ const getFile = (file, cwd) => {
|
|
|
54738
54751
|
|
|
54739
54752
|
const getFileSync = (file, cwd) => {
|
|
54740
54753
|
const filePath = path$4.join(cwd, file);
|
|
54741
|
-
const content = fs$
|
|
54754
|
+
const content = fs$2.readFileSync(filePath, 'utf8');
|
|
54742
54755
|
|
|
54743
54756
|
return {
|
|
54744
54757
|
content,
|
|
@@ -54945,7 +54958,7 @@ async function trash(paths, options) {
|
|
|
54945
54958
|
}
|
|
54946
54959
|
|
|
54947
54960
|
try {
|
|
54948
|
-
await fs$
|
|
54961
|
+
await fs$D.promises.lstat(filePath);
|
|
54949
54962
|
} catch (error) {
|
|
54950
54963
|
if (error.code === 'ENOENT') {
|
|
54951
54964
|
return;
|
|
@@ -54969,7 +54982,7 @@ async function trash(paths, options) {
|
|
|
54969
54982
|
} else if (process$2.platform === 'win32') {
|
|
54970
54983
|
module = await Promise.resolve().then(function () { return require('./windows-C30k1cv-.cjs'); });
|
|
54971
54984
|
} else {
|
|
54972
|
-
module = await Promise.resolve().then(function () { return require('./linux-
|
|
54985
|
+
module = await Promise.resolve().then(function () { return require('./linux-BInfI0l8.cjs'); });
|
|
54973
54986
|
}
|
|
54974
54987
|
|
|
54975
54988
|
return module.default(paths);
|
|
@@ -60232,14 +60245,14 @@ class Config extends TypedEmitter {
|
|
|
60232
60245
|
}
|
|
60233
60246
|
save() {
|
|
60234
60247
|
// 保存文件
|
|
60235
|
-
fs$
|
|
60248
|
+
fs$D.writeFileSync(this.filepath, JSON.stringify(this.data));
|
|
60236
60249
|
}
|
|
60237
60250
|
load(filepath) {
|
|
60238
60251
|
this.filepath = filepath;
|
|
60239
60252
|
}
|
|
60240
60253
|
init(filepath, initData = {}) {
|
|
60241
60254
|
this.filepath = filepath;
|
|
60242
|
-
if (!fs$
|
|
60255
|
+
if (!fs$D.existsSync(this.filepath)) {
|
|
60243
60256
|
this.data = initData;
|
|
60244
60257
|
}
|
|
60245
60258
|
else {
|
|
@@ -60262,7 +60275,7 @@ class Config extends TypedEmitter {
|
|
|
60262
60275
|
}
|
|
60263
60276
|
read() {
|
|
60264
60277
|
// 读取文件
|
|
60265
|
-
this.data = JSON.parse(fs$
|
|
60278
|
+
this.data = JSON.parse(fs$D.readFileSync(this.filepath, "utf-8"));
|
|
60266
60279
|
return this.data;
|
|
60267
60280
|
}
|
|
60268
60281
|
}
|
|
@@ -61948,11 +61961,11 @@ const uuid$4 = () => {
|
|
|
61948
61961
|
return crypto$d.randomUUID();
|
|
61949
61962
|
};
|
|
61950
61963
|
const pathExists = async (path) => {
|
|
61951
|
-
return await fs$
|
|
61964
|
+
return await fs$k.pathExists(path);
|
|
61952
61965
|
};
|
|
61953
61966
|
const deleteFile = async (path) => {
|
|
61954
61967
|
try {
|
|
61955
|
-
await fs$
|
|
61968
|
+
await fs$k.unlink(path);
|
|
61956
61969
|
}
|
|
61957
61970
|
catch (error) {
|
|
61958
61971
|
console.error(error);
|
|
@@ -61972,7 +61985,7 @@ const trashItem = async (path) => {
|
|
|
61972
61985
|
};
|
|
61973
61986
|
const isWin32 = process.platform === "win32";
|
|
61974
61987
|
async function getFileSize$1(filePath) {
|
|
61975
|
-
const stats = await fs$
|
|
61988
|
+
const stats = await fs$k.promises.stat(filePath);
|
|
61976
61989
|
const fileSizeInBytes = stats.size;
|
|
61977
61990
|
return fileSizeInBytes;
|
|
61978
61991
|
}
|
|
@@ -62013,18 +62026,18 @@ function getTempPath() {
|
|
|
62013
62026
|
}
|
|
62014
62027
|
if (cacheFolder) {
|
|
62015
62028
|
try {
|
|
62016
|
-
fs$
|
|
62029
|
+
fs$k.ensureDirSync(cacheFolder);
|
|
62017
62030
|
return cacheFolder;
|
|
62018
62031
|
}
|
|
62019
62032
|
catch (e) {
|
|
62020
62033
|
console.error("缓存文件夹创建失败,使用系统临时文件夹", e);
|
|
62021
62034
|
}
|
|
62022
62035
|
}
|
|
62023
|
-
fs$
|
|
62036
|
+
fs$k.ensureDirSync(cacheFolder);
|
|
62024
62037
|
return cacheFolder;
|
|
62025
62038
|
}
|
|
62026
62039
|
async function readLines(filePath, startLine, endLine) {
|
|
62027
|
-
const fileStream = fs$
|
|
62040
|
+
const fileStream = fs$k.createReadStream(filePath);
|
|
62028
62041
|
const rl = readline.createInterface({
|
|
62029
62042
|
input: fileStream,
|
|
62030
62043
|
crlfDelay: Infinity,
|
|
@@ -62102,7 +62115,7 @@ const parseSavePath = async (input, options, createDir = true) => {
|
|
|
62102
62115
|
throw new Error("没有找到保存路径");
|
|
62103
62116
|
}
|
|
62104
62117
|
if (createDir && !(await pathExists(savePath))) {
|
|
62105
|
-
await fs$
|
|
62118
|
+
await fs$k.ensureDir(savePath);
|
|
62106
62119
|
}
|
|
62107
62120
|
return savePath;
|
|
62108
62121
|
};
|
|
@@ -62145,7 +62158,7 @@ async function getUnusedFileName(filePath) {
|
|
|
62145
62158
|
const baseName = path$z.basename(filePath, ext);
|
|
62146
62159
|
let newFilePath = filePath;
|
|
62147
62160
|
let counter = 1;
|
|
62148
|
-
while (await fs$
|
|
62161
|
+
while (await fs$k.pathExists(newFilePath)) {
|
|
62149
62162
|
newFilePath = path$z.join(dir, `${baseName}(${counter})${ext}`);
|
|
62150
62163
|
counter++;
|
|
62151
62164
|
if (counter > 100) {
|
|
@@ -62169,7 +62182,7 @@ async function calculateFileQuickHash(filePath, headSize = 1 * 1024 * 1024, tail
|
|
|
62169
62182
|
// 如果文件小于等于头部大小,直接读取整个文件
|
|
62170
62183
|
if (fileSize <= headSize) {
|
|
62171
62184
|
return new Promise((resolve, reject) => {
|
|
62172
|
-
const stream = fs$
|
|
62185
|
+
const stream = fs$D.createReadStream(filePath);
|
|
62173
62186
|
stream.on("data", (chunk) => {
|
|
62174
62187
|
hash.update(chunk);
|
|
62175
62188
|
});
|
|
@@ -62181,7 +62194,7 @@ async function calculateFileQuickHash(filePath, headSize = 1 * 1024 * 1024, tail
|
|
|
62181
62194
|
}
|
|
62182
62195
|
// 读取头部
|
|
62183
62196
|
await new Promise((resolve, reject) => {
|
|
62184
|
-
const headStream = fs$
|
|
62197
|
+
const headStream = fs$D.createReadStream(filePath, {
|
|
62185
62198
|
start: 0,
|
|
62186
62199
|
end: headSize - 1,
|
|
62187
62200
|
highWaterMark: 64 * 1024,
|
|
@@ -62197,7 +62210,7 @@ async function calculateFileQuickHash(filePath, headSize = 1 * 1024 * 1024, tail
|
|
|
62197
62210
|
// 读取尾部
|
|
62198
62211
|
await new Promise((resolve, reject) => {
|
|
62199
62212
|
const tailStart = Math.max(headSize, fileSize - tailSize);
|
|
62200
|
-
const tailStream = fs$
|
|
62213
|
+
const tailStream = fs$D.createReadStream(filePath, {
|
|
62201
62214
|
start: tailStart,
|
|
62202
62215
|
end: fileSize - 1,
|
|
62203
62216
|
highWaterMark: 64 * 1024,
|
|
@@ -62296,7 +62309,7 @@ function RGB2BGR(color, reverseAlpha = true) {
|
|
|
62296
62309
|
|
|
62297
62310
|
async function getFileSize(filePath) {
|
|
62298
62311
|
try {
|
|
62299
|
-
const stats = await fs$
|
|
62312
|
+
const stats = await fs$D.promises.stat(filePath);
|
|
62300
62313
|
const fileSizeInBytes = stats.size;
|
|
62301
62314
|
return fileSizeInBytes;
|
|
62302
62315
|
}
|
|
@@ -62307,11 +62320,11 @@ async function getFileSize(filePath) {
|
|
|
62307
62320
|
let isString$1 = (value) => typeof value === "string";
|
|
62308
62321
|
function createReadStream(filePath, start, numBytes, totalBytes) {
|
|
62309
62322
|
const endByte = Math.min(start + numBytes - 1, totalBytes - 1);
|
|
62310
|
-
const readStream = fs$
|
|
62323
|
+
const readStream = fs$D.createReadStream(filePath, { start, end: endByte });
|
|
62311
62324
|
return [readStream, endByte - start + 1];
|
|
62312
62325
|
}
|
|
62313
62326
|
async function readFileAsBase64(filePath) {
|
|
62314
|
-
return fs$
|
|
62327
|
+
return fs$D.promises
|
|
62315
62328
|
.readFile(filePath)
|
|
62316
62329
|
.then(data => {
|
|
62317
62330
|
// 获取文件扩展名
|
|
@@ -63034,7 +63047,7 @@ class Auth {
|
|
|
63034
63047
|
* @param path cookie文件路径
|
|
63035
63048
|
*/
|
|
63036
63049
|
async loadCookieFile(path) {
|
|
63037
|
-
const cookie = await fs$
|
|
63050
|
+
const cookie = await fs$D.promises.readFile(path, "utf-8");
|
|
63038
63051
|
const cookieObj = JSON.parse(cookie);
|
|
63039
63052
|
const cookieStr = cookieObj.cookie_info.cookies
|
|
63040
63053
|
.map((item) => `${item.name}=${item.value}`)
|
|
@@ -65357,7 +65370,7 @@ class WebVideoUploader extends BaseRequest {
|
|
|
65357
65370
|
}
|
|
65358
65371
|
}
|
|
65359
65372
|
getFileSizeSync(filePath) {
|
|
65360
|
-
const stats = fs$
|
|
65373
|
+
const stats = fs$D.statSync(filePath);
|
|
65361
65374
|
const fileSizeInBytes = stats.size;
|
|
65362
65375
|
return fileSizeInBytes;
|
|
65363
65376
|
}
|
|
@@ -67099,7 +67112,7 @@ class RangeDownloader {
|
|
|
67099
67112
|
return;
|
|
67100
67113
|
if (this.status === "pending") {
|
|
67101
67114
|
try {
|
|
67102
|
-
await fs$
|
|
67115
|
+
await fs$D.promises.unlink(this.filePath);
|
|
67103
67116
|
}
|
|
67104
67117
|
catch (error) { }
|
|
67105
67118
|
}
|
|
@@ -67153,7 +67166,7 @@ class RangeDownloader {
|
|
|
67153
67166
|
_self.totalSize = isNaN(_self.totalSize)
|
|
67154
67167
|
? parseInt(response.headers["content-length"] || "0", 10)
|
|
67155
67168
|
: _self.totalSize;
|
|
67156
|
-
const writableStream = fs$
|
|
67169
|
+
const writableStream = fs$D.createWriteStream(this.filePath, {
|
|
67157
67170
|
flags: "a",
|
|
67158
67171
|
});
|
|
67159
67172
|
response.data.pipe(writableStream);
|
|
@@ -67564,7 +67577,7 @@ class Video extends BaseRequest {
|
|
|
67564
67577
|
});
|
|
67565
67578
|
const jsonData = (await res.json());
|
|
67566
67579
|
const srtData = subtitleJsonToSrt(jsonData);
|
|
67567
|
-
fs$
|
|
67580
|
+
fs$D.writeFileSync(options.output, srtData);
|
|
67568
67581
|
return options.output;
|
|
67569
67582
|
}
|
|
67570
67583
|
authAid() {
|
|
@@ -67748,8 +67761,8 @@ class Video extends BaseRequest {
|
|
|
67748
67761
|
}
|
|
67749
67762
|
const clean = () => {
|
|
67750
67763
|
try {
|
|
67751
|
-
fs$
|
|
67752
|
-
fs$
|
|
67764
|
+
fs$D.promises.unlink(videoDownloader.filePath);
|
|
67765
|
+
fs$D.promises.unlink(audioDownloader.filePath);
|
|
67753
67766
|
}
|
|
67754
67767
|
catch (error) {
|
|
67755
67768
|
console.warn(error);
|
|
@@ -67863,7 +67876,7 @@ class Video extends BaseRequest {
|
|
|
67863
67876
|
});
|
|
67864
67877
|
const clean = () => {
|
|
67865
67878
|
try {
|
|
67866
|
-
fs$
|
|
67879
|
+
fs$D.promises.unlink(videoDownloader.filePath);
|
|
67867
67880
|
}
|
|
67868
67881
|
catch (error) {
|
|
67869
67882
|
console.warn(error);
|
|
@@ -75977,7 +75990,7 @@ class BcutASR {
|
|
|
75977
75990
|
* 从文件设置数据
|
|
75978
75991
|
*/
|
|
75979
75992
|
setDataFromFile(file) {
|
|
75980
|
-
this.soundBin = fs$
|
|
75993
|
+
this.soundBin = fs$D.readFileSync(file);
|
|
75981
75994
|
const suffix = file.split(".").pop()?.toLowerCase();
|
|
75982
75995
|
if (!this.isSupportFormat(suffix)) {
|
|
75983
75996
|
throw new TypeError(`Format ${suffix} is not supported`);
|
|
@@ -78374,7 +78387,7 @@ class M3U8Downloader extends TypedEmitter {
|
|
|
78374
78387
|
this.totalSegments = 0;
|
|
78375
78388
|
this.downloadedSegments = 0;
|
|
78376
78389
|
this.downloadedFiles = [];
|
|
78377
|
-
fs$
|
|
78390
|
+
fs$k.ensureDirSync(this.segmentsDir);
|
|
78378
78391
|
console.log("Temporary segments directory:", this.segmentsDir);
|
|
78379
78392
|
// axios 统一实例化,方便增加axios功能,比如拦截器
|
|
78380
78393
|
this.http = axios.create({
|
|
@@ -78405,10 +78418,10 @@ class M3U8Downloader extends TypedEmitter {
|
|
|
78405
78418
|
try {
|
|
78406
78419
|
this.emit("start");
|
|
78407
78420
|
this.status = "running";
|
|
78408
|
-
if (!(await fs$
|
|
78409
|
-
await fs$
|
|
78421
|
+
if (!(await fs$k.pathExists(this.segmentsDir))) {
|
|
78422
|
+
await fs$k.mkdir(this.segmentsDir, { recursive: true });
|
|
78410
78423
|
}
|
|
78411
|
-
if (!(await fs$
|
|
78424
|
+
if (!(await fs$k.pathExists(path$z.dirname(this.output)))) {
|
|
78412
78425
|
throw new Error("Output directory does not exist");
|
|
78413
78426
|
}
|
|
78414
78427
|
const m3u8Content = await this.getM3U8();
|
|
@@ -78528,7 +78541,7 @@ class M3U8Downloader extends TypedEmitter {
|
|
|
78528
78541
|
return;
|
|
78529
78542
|
const formattedIndex = String(index).padStart(5, "0");
|
|
78530
78543
|
const segmentPath = path$z.resolve(this.segmentsDir, `segment${formattedIndex}.${this.options.suffix}`);
|
|
78531
|
-
if (this.options.skipExistSegments && (await fs$
|
|
78544
|
+
if (this.options.skipExistSegments && (await fs$k.pathExists(segmentPath))) {
|
|
78532
78545
|
this.downloadedSegments++;
|
|
78533
78546
|
const progress = {
|
|
78534
78547
|
downloadedFile: segmentPath,
|
|
@@ -78541,7 +78554,7 @@ class M3U8Downloader extends TypedEmitter {
|
|
|
78541
78554
|
const response = await this.http.get(tsUrl, {
|
|
78542
78555
|
responseType: "arraybuffer",
|
|
78543
78556
|
});
|
|
78544
|
-
await fs$
|
|
78557
|
+
await fs$k.writeFile(segmentPath, response.data);
|
|
78545
78558
|
this.downloadedFiles.push(segmentPath);
|
|
78546
78559
|
this.downloadedSegments++;
|
|
78547
78560
|
const progress = {
|
|
@@ -78577,7 +78590,7 @@ class M3U8Downloader extends TypedEmitter {
|
|
|
78577
78590
|
if (!this.options.convert2Mp4) {
|
|
78578
78591
|
mergedFilePath = this.output;
|
|
78579
78592
|
}
|
|
78580
|
-
const writeStream = fs$
|
|
78593
|
+
const writeStream = fs$k.createWriteStream(mergedFilePath, {
|
|
78581
78594
|
highWaterMark: 1024 * 1024,
|
|
78582
78595
|
});
|
|
78583
78596
|
writeStream.on("error", error => {
|
|
@@ -78608,10 +78621,10 @@ class M3U8Downloader extends TypedEmitter {
|
|
|
78608
78621
|
const formattedIndex = String(index).padStart(5, "0");
|
|
78609
78622
|
const segmentPath = path$z.resolve(this.segmentsDir, `segment${formattedIndex}.${this.options.suffix}`);
|
|
78610
78623
|
// 读取并安全写入
|
|
78611
|
-
const segmentData = await fs$
|
|
78624
|
+
const segmentData = await fs$k.promises.readFile(segmentPath);
|
|
78612
78625
|
await safeWrite(segmentData);
|
|
78613
78626
|
if (deleteSource)
|
|
78614
|
-
await fs$
|
|
78627
|
+
await fs$k.promises.unlink(segmentPath);
|
|
78615
78628
|
}
|
|
78616
78629
|
// 关键:等待流完全关闭
|
|
78617
78630
|
await new Promise((resolve, reject) => {
|
|
@@ -78631,14 +78644,14 @@ class M3U8Downloader extends TypedEmitter {
|
|
|
78631
78644
|
return;
|
|
78632
78645
|
await Promise.all(this.downloadedFiles.map(async (file) => {
|
|
78633
78646
|
try {
|
|
78634
|
-
await fs$
|
|
78647
|
+
await fs$k.unlink(file);
|
|
78635
78648
|
}
|
|
78636
78649
|
catch (error) { }
|
|
78637
78650
|
}));
|
|
78638
78651
|
if (this.options.convert2Mp4) {
|
|
78639
78652
|
let mergedFilePath = path$z.resolve(this.segmentsDir, `output.${this.options.suffix}`);
|
|
78640
|
-
if (await fs$
|
|
78641
|
-
await fs$
|
|
78653
|
+
if (await fs$k.pathExists(mergedFilePath)) {
|
|
78654
|
+
await fs$k.unlink(mergedFilePath);
|
|
78642
78655
|
}
|
|
78643
78656
|
}
|
|
78644
78657
|
}
|
|
@@ -78672,7 +78685,7 @@ class M3U8Downloader extends TypedEmitter {
|
|
|
78672
78685
|
}
|
|
78673
78686
|
// remove merged TS file with retry
|
|
78674
78687
|
try {
|
|
78675
|
-
await retry$2(() => fs$
|
|
78688
|
+
await retry$2(() => fs$k.unlink(inputFilePath), 5, 1000);
|
|
78676
78689
|
}
|
|
78677
78690
|
catch (error) {
|
|
78678
78691
|
console.error(`Failed to delete temporary TS file: ${error}`);
|
|
@@ -78691,7 +78704,7 @@ var nodemailer = {};
|
|
|
78691
78704
|
|
|
78692
78705
|
var shared$c = {exports: {}};
|
|
78693
78706
|
|
|
78694
|
-
var fetch$
|
|
78707
|
+
var fetch$2 = {exports: {}};
|
|
78695
78708
|
|
|
78696
78709
|
// module to handle cookies
|
|
78697
78710
|
|
|
@@ -79041,11 +79054,11 @@ const net$b = require$$4;
|
|
|
79041
79054
|
|
|
79042
79055
|
const MAX_REDIRECTS = 5;
|
|
79043
79056
|
|
|
79044
|
-
fetch$
|
|
79057
|
+
fetch$2.exports = function (url, options) {
|
|
79045
79058
|
return nmfetch$3(url, options);
|
|
79046
79059
|
};
|
|
79047
79060
|
|
|
79048
|
-
fetch$
|
|
79061
|
+
fetch$2.exports.Cookies = Cookies;
|
|
79049
79062
|
|
|
79050
79063
|
function nmfetch$3(url, options) {
|
|
79051
79064
|
options = options || {};
|
|
@@ -79303,7 +79316,7 @@ function nmfetch$3(url, options) {
|
|
|
79303
79316
|
return fetchRes;
|
|
79304
79317
|
}
|
|
79305
79318
|
|
|
79306
|
-
var fetchExports = fetch$
|
|
79319
|
+
var fetchExports = fetch$2.exports;
|
|
79307
79320
|
|
|
79308
79321
|
/* eslint no-console: 0 */
|
|
79309
79322
|
|
|
@@ -83993,7 +84006,7 @@ var leUnix = LeWindows$2;
|
|
|
83993
84006
|
/* eslint no-undefined: 0, prefer-spread: 0, no-control-regex: 0 */
|
|
83994
84007
|
|
|
83995
84008
|
const crypto$b = require$$1$6;
|
|
83996
|
-
const fs$
|
|
84009
|
+
const fs$1 = require$$0$6;
|
|
83997
84010
|
const punycode$2 = punycode_1;
|
|
83998
84011
|
const PassThrough$4 = require$$0$4.PassThrough;
|
|
83999
84012
|
const shared$b = sharedExports;
|
|
@@ -84969,7 +84982,7 @@ let MimeNode$2 = class MimeNode {
|
|
|
84969
84982
|
return contentStream;
|
|
84970
84983
|
}
|
|
84971
84984
|
// read file
|
|
84972
|
-
return fs$
|
|
84985
|
+
return fs$1.createReadStream(content.path);
|
|
84973
84986
|
} else if (content && typeof content.href === 'string') {
|
|
84974
84987
|
if (this.disableUrlAccess) {
|
|
84975
84988
|
contentStream = new PassThrough$4();
|
|
@@ -86297,7 +86310,7 @@ const MessageParser = messageParser;
|
|
|
86297
86310
|
const RelaxedBody = relaxedBody;
|
|
86298
86311
|
const sign$2 = signExports;
|
|
86299
86312
|
const PassThrough$3 = require$$0$4.PassThrough;
|
|
86300
|
-
const fs
|
|
86313
|
+
const fs = require$$0$6;
|
|
86301
86314
|
const path$2 = require$$0$7;
|
|
86302
86315
|
const crypto$8 = require$$1$6;
|
|
86303
86316
|
|
|
@@ -86357,12 +86370,12 @@ class DKIMSigner {
|
|
|
86357
86370
|
if (!this.cache || !this.cachePath) {
|
|
86358
86371
|
return;
|
|
86359
86372
|
}
|
|
86360
|
-
fs
|
|
86373
|
+
fs.unlink(this.cachePath, () => false);
|
|
86361
86374
|
}
|
|
86362
86375
|
|
|
86363
86376
|
createReadCache() {
|
|
86364
86377
|
// pipe remainings to cache file
|
|
86365
|
-
this.cache = fs
|
|
86378
|
+
this.cache = fs.createReadStream(this.cachePath);
|
|
86366
86379
|
this.cache.once('error', err => {
|
|
86367
86380
|
this.cleanup();
|
|
86368
86381
|
this.output.emit('error', err);
|
|
@@ -86425,7 +86438,7 @@ class DKIMSigner {
|
|
|
86425
86438
|
createWriteCache() {
|
|
86426
86439
|
this.output.usingCache = true;
|
|
86427
86440
|
// pipe remainings to cache file
|
|
86428
|
-
this.cache = fs
|
|
86441
|
+
this.cache = fs.createWriteStream(this.cachePath);
|
|
86429
86442
|
this.cache.once('error', err => {
|
|
86430
86443
|
this.cleanup();
|
|
86431
86444
|
// drain input
|
|
@@ -173627,17 +173640,17 @@ const isSameProtocol = function isSameProtocol(destination, original) {
|
|
|
173627
173640
|
* @param Object opts Fetch options
|
|
173628
173641
|
* @return Promise
|
|
173629
173642
|
*/
|
|
173630
|
-
function fetch$
|
|
173643
|
+
function fetch$1(url, opts) {
|
|
173631
173644
|
|
|
173632
173645
|
// allow custom promise
|
|
173633
|
-
if (!fetch$
|
|
173646
|
+
if (!fetch$1.Promise) {
|
|
173634
173647
|
throw new Error('native promise missing, set fetch.Promise to your favorite alternative');
|
|
173635
173648
|
}
|
|
173636
173649
|
|
|
173637
|
-
Body.Promise = fetch$
|
|
173650
|
+
Body.Promise = fetch$1.Promise;
|
|
173638
173651
|
|
|
173639
173652
|
// wrap http.request into fetch
|
|
173640
|
-
return new fetch$
|
|
173653
|
+
return new fetch$1.Promise(function (resolve, reject) {
|
|
173641
173654
|
// build request object
|
|
173642
173655
|
const request = new Request$4(url, opts);
|
|
173643
173656
|
const options = getNodeRequestOptions(request);
|
|
@@ -173735,7 +173748,7 @@ function fetch$2(url, opts) {
|
|
|
173735
173748
|
const headers = createHeadersLenient(res.headers);
|
|
173736
173749
|
|
|
173737
173750
|
// HTTP fetch step 5
|
|
173738
|
-
if (fetch$
|
|
173751
|
+
if (fetch$1.isRedirect(res.statusCode)) {
|
|
173739
173752
|
// HTTP fetch step 5.2
|
|
173740
173753
|
const location = headers.get('Location');
|
|
173741
173754
|
|
|
@@ -173821,7 +173834,7 @@ function fetch$2(url, opts) {
|
|
|
173821
173834
|
}
|
|
173822
173835
|
|
|
173823
173836
|
// HTTP-redirect fetch step 15
|
|
173824
|
-
resolve(fetch$
|
|
173837
|
+
resolve(fetch$1(new Request$4(locationURL, requestOpts)));
|
|
173825
173838
|
finalize();
|
|
173826
173839
|
return;
|
|
173827
173840
|
}
|
|
@@ -173963,12 +173976,12 @@ function destroyStream(stream, err) {
|
|
|
173963
173976
|
* @param Number code Status code
|
|
173964
173977
|
* @return Boolean
|
|
173965
173978
|
*/
|
|
173966
|
-
fetch$
|
|
173979
|
+
fetch$1.isRedirect = function (code) {
|
|
173967
173980
|
return code === 301 || code === 302 || code === 303 || code === 307 || code === 308;
|
|
173968
173981
|
};
|
|
173969
173982
|
|
|
173970
173983
|
// expose Promise
|
|
173971
|
-
fetch$
|
|
173984
|
+
fetch$1.Promise = global.Promise;
|
|
173972
173985
|
|
|
173973
173986
|
var lib = /*#__PURE__*/Object.freeze({
|
|
173974
173987
|
__proto__: null,
|
|
@@ -173977,7 +173990,7 @@ var lib = /*#__PURE__*/Object.freeze({
|
|
|
173977
173990
|
Headers: Headers$1,
|
|
173978
173991
|
Request: Request$4,
|
|
173979
173992
|
Response: Response$2,
|
|
173980
|
-
default: fetch$
|
|
173993
|
+
default: fetch$1
|
|
173981
173994
|
});
|
|
173982
173995
|
|
|
173983
173996
|
var require$$0 = /*@__PURE__*/getAugmentedNamespace(lib);
|
|
@@ -179783,7 +179796,7 @@ class DanmakuFactory {
|
|
|
179783
179796
|
return params.filter((item) => item !== "");
|
|
179784
179797
|
};
|
|
179785
179798
|
convertXml2Ass = async (input, output, argsObj) => {
|
|
179786
|
-
if (!(await fs$
|
|
179799
|
+
if (!(await fs$k.pathExists(input))) {
|
|
179787
179800
|
throw new Error("input not exists");
|
|
179788
179801
|
}
|
|
179789
179802
|
const requiredArgs = [`-i "${input}"`, `-o "${output}"`, "--ignore-warnings", "--force"];
|
|
@@ -187103,7 +187116,7 @@ const traversalObject = (obj, callback) => {
|
|
|
187103
187116
|
}
|
|
187104
187117
|
};
|
|
187105
187118
|
async function processRawStream(inputFilePath) {
|
|
187106
|
-
const readStream = fs$
|
|
187119
|
+
const readStream = fs$k.createReadStream(inputFilePath, { encoding: "utf8" });
|
|
187107
187120
|
const rl = readline.createInterface({
|
|
187108
187121
|
input: readStream,
|
|
187109
187122
|
crlfDelay: Infinity,
|
|
@@ -187120,13 +187133,13 @@ async function processRawStream(inputFilePath) {
|
|
|
187120
187133
|
*/
|
|
187121
187134
|
const parseXmlFile = async (input, parseRaw = false) => {
|
|
187122
187135
|
let XMLdata;
|
|
187123
|
-
const stat = await fs$
|
|
187136
|
+
const stat = await fs$k.stat(input);
|
|
187124
187137
|
// 如果文件大于400M,且未开启parseRaw,使用processRawStream
|
|
187125
187138
|
if (stat.size > 400 * 1024 * 1024 && !parseRaw) {
|
|
187126
187139
|
XMLdata = await processRawStream(input);
|
|
187127
187140
|
}
|
|
187128
187141
|
else {
|
|
187129
|
-
XMLdata = await fs$
|
|
187142
|
+
XMLdata = await fs$k.promises.readFile(input, "utf8");
|
|
187130
187143
|
if (!parseRaw) {
|
|
187131
187144
|
XMLdata = XMLdata.replace(/raw=".*?"/g, "");
|
|
187132
187145
|
}
|
|
@@ -187354,7 +187367,7 @@ const genTimeData = async (input) => {
|
|
|
187354
187367
|
});
|
|
187355
187368
|
}
|
|
187356
187369
|
else if (ext === ".ass") {
|
|
187357
|
-
const content = await fs$
|
|
187370
|
+
const content = await fs$k.readFile(input, "utf-8");
|
|
187358
187371
|
const assData = compile(content, {});
|
|
187359
187372
|
return assData["dialogues"].map((item) => Math.floor(item.start));
|
|
187360
187373
|
}
|
|
@@ -187383,7 +187396,7 @@ const generateDanmakuImage = async (input, output, iOptions) => {
|
|
|
187383
187396
|
};
|
|
187384
187397
|
const options = Object.assign(defaultOptins, iOptions);
|
|
187385
187398
|
const data = await generateDanmakuData(input, options);
|
|
187386
|
-
await fs$
|
|
187399
|
+
await fs$k.ensureDir(output);
|
|
187387
187400
|
const canvas$1 = canvas.createCanvas(options.width, options.height);
|
|
187388
187401
|
const ctx = canvas$1.getContext("2d");
|
|
187389
187402
|
const points = createChartPoints(data, options.width, options.height);
|
|
@@ -187394,7 +187407,7 @@ const generateDanmakuImage = async (input, output, iOptions) => {
|
|
|
187394
187407
|
drawSmoothCurve(ctx, points);
|
|
187395
187408
|
const outputPath = path$z.join(output, `${String(i).padStart(4, "0")}.png`);
|
|
187396
187409
|
const png = await canvas$1.encode("png");
|
|
187397
|
-
await fs$
|
|
187410
|
+
await fs$k.promises.writeFile(outputPath, png);
|
|
187398
187411
|
}
|
|
187399
187412
|
return data;
|
|
187400
187413
|
};
|
|
@@ -187566,7 +187579,7 @@ const genProcessedXml = async (input, output, filterFunction) => {
|
|
|
187566
187579
|
];
|
|
187567
187580
|
const processedBuckets = processXmlItems(events, filterFunction);
|
|
187568
187581
|
const xmlData = generateMergedXmlContent(processedBuckets.danmu, processedBuckets.gift, processedBuckets.sc, processedBuckets.guard, metadata);
|
|
187569
|
-
await fs$
|
|
187582
|
+
await fs$k.writeFile(output, xmlData);
|
|
187570
187583
|
return output;
|
|
187571
187584
|
};
|
|
187572
187585
|
/**
|
|
@@ -187604,7 +187617,7 @@ const addConvertDanmu2AssTask = async (originInput, output, danmuOptions, option
|
|
|
187604
187617
|
.split(",")
|
|
187605
187618
|
.filter((value) => value)
|
|
187606
187619
|
.join("\n");
|
|
187607
|
-
await fs$
|
|
187620
|
+
await fs$k.writeFile(fileTxtPath, fileTxtContent);
|
|
187608
187621
|
opts.blacklist = fileTxtPath;
|
|
187609
187622
|
}
|
|
187610
187623
|
const input = filteredOutput || originInput;
|
|
@@ -187619,10 +187632,10 @@ const addConvertDanmu2AssTask = async (originInput, output, danmuOptions, option
|
|
|
187619
187632
|
await trashItem(originInput);
|
|
187620
187633
|
}
|
|
187621
187634
|
if (opts.blacklist) {
|
|
187622
|
-
fs$
|
|
187635
|
+
fs$k.unlink(opts.blacklist);
|
|
187623
187636
|
}
|
|
187624
187637
|
if (filteredOutput) {
|
|
187625
|
-
fs$
|
|
187638
|
+
fs$k.unlink(filteredOutput);
|
|
187626
187639
|
}
|
|
187627
187640
|
},
|
|
187628
187641
|
onError: async (error) => {
|
|
@@ -187633,10 +187646,10 @@ const addConvertDanmu2AssTask = async (originInput, output, danmuOptions, option
|
|
|
187633
187646
|
output: output,
|
|
187634
187647
|
});
|
|
187635
187648
|
if (opts.blacklist) {
|
|
187636
|
-
fs$
|
|
187649
|
+
fs$k.unlink(opts.blacklist);
|
|
187637
187650
|
}
|
|
187638
187651
|
if (filteredOutput) {
|
|
187639
|
-
fs$
|
|
187652
|
+
fs$k.unlink(filteredOutput);
|
|
187640
187653
|
}
|
|
187641
187654
|
},
|
|
187642
187655
|
});
|
|
@@ -187674,7 +187687,7 @@ const convertXml2Ass = async (file, danmuOptions, options) => {
|
|
|
187674
187687
|
*
|
|
187675
187688
|
*/
|
|
187676
187689
|
const isEmptyDanmu = async (filepath) => {
|
|
187677
|
-
const readStream = fs$
|
|
187690
|
+
const readStream = fs$k.createReadStream(filepath, { encoding: "utf8" });
|
|
187678
187691
|
const rl = readline.createInterface({
|
|
187679
187692
|
input: readStream,
|
|
187680
187693
|
crlfDelay: Infinity,
|
|
@@ -187852,7 +187865,7 @@ const mergeXml = async (inputFiles, options = {}) => {
|
|
|
187852
187865
|
// 生成XML内容
|
|
187853
187866
|
const xmlContent = generateMergedXmlContent(mergedDanmuku, mergedGift, mergedSc, mergedGuard, metadata);
|
|
187854
187867
|
// 写入合并后的XML文件
|
|
187855
|
-
await fs$
|
|
187868
|
+
await fs$k.writeFile(outputPath, xmlContent);
|
|
187856
187869
|
logObj.info("mergeXml", {
|
|
187857
187870
|
status: "success",
|
|
187858
187871
|
text: `合并完成,共处理了${inputFiles.length}个文件`,
|
|
@@ -187979,7 +187992,7 @@ const convertImage2Video = async (inputDir, output, options) => {
|
|
|
187979
187992
|
onEnd: async () => {
|
|
187980
187993
|
if ((await pathExists(inputDir))) {
|
|
187981
187994
|
logObj.info("convertImage2Video, remove origin file", inputDir);
|
|
187982
|
-
fs$
|
|
187995
|
+
fs$k.rm(inputDir, { recursive: true, force: true });
|
|
187983
187996
|
}
|
|
187984
187997
|
},
|
|
187985
187998
|
});
|
|
@@ -188413,10 +188426,10 @@ async function parseMeta(files) {
|
|
|
188413
188426
|
duration: 0,
|
|
188414
188427
|
};
|
|
188415
188428
|
let content = "";
|
|
188416
|
-
if (files.danmaFilePath && (await fs$
|
|
188429
|
+
if (files.danmaFilePath && (await fs$k.pathExists(files.danmaFilePath))) {
|
|
188417
188430
|
content += (await readLines(files.danmaFilePath, 0, 30)).join("\n");
|
|
188418
188431
|
}
|
|
188419
|
-
if (files.videoFilePath && (await fs$
|
|
188432
|
+
if (files.videoFilePath && (await fs$k.pathExists(files.videoFilePath))) {
|
|
188420
188433
|
try {
|
|
188421
188434
|
const meta = await readVideoMeta(files.videoFilePath, {
|
|
188422
188435
|
json: true,
|
|
@@ -188703,17 +188716,17 @@ const mergeAssMp4 = async (files, options = {
|
|
|
188703
188716
|
}
|
|
188704
188717
|
if (files.hotProgressFilePath) {
|
|
188705
188718
|
logObj.info("mergrAssMp4, remove hot progress origin file", assFile);
|
|
188706
|
-
await fs$
|
|
188719
|
+
await fs$k.unlink(files.hotProgressFilePath);
|
|
188707
188720
|
}
|
|
188708
188721
|
if (files.subtitlePath && options.removeSubtitle) {
|
|
188709
188722
|
logObj.info("mergrAssMp4, remove subtitle origin file", files.subtitlePath);
|
|
188710
|
-
await fs$
|
|
188723
|
+
await fs$k.unlink(files.subtitlePath);
|
|
188711
188724
|
}
|
|
188712
188725
|
},
|
|
188713
188726
|
onError: async () => {
|
|
188714
188727
|
if (files.hotProgressFilePath) {
|
|
188715
188728
|
logObj.info("mergrAssMp4, remove hot progress origin file", assFile);
|
|
188716
|
-
await fs$
|
|
188729
|
+
await fs$k.unlink(files.hotProgressFilePath);
|
|
188717
188730
|
}
|
|
188718
188731
|
},
|
|
188719
188732
|
});
|
|
@@ -188851,7 +188864,7 @@ const mergeVideos = async (inputFiles, options = {
|
|
|
188851
188864
|
await setFfmpegPath();
|
|
188852
188865
|
const fileTxtPath = path$z.join(getTempPath(), `${uuid$4()}.txt`);
|
|
188853
188866
|
const fileTxtContent = inputFiles.map((videoFile) => `file '${videoFile}'`).join("\n");
|
|
188854
|
-
await fs$
|
|
188867
|
+
await fs$k.writeFile(fileTxtPath, fileTxtContent);
|
|
188855
188868
|
const command = ffmpeg(fileTxtPath).inputOptions("-f concat").inputOptions("-safe 0");
|
|
188856
188869
|
if (options.keepFirstVideoMeta) {
|
|
188857
188870
|
command.input(inputFiles[0]).outputOptions("-map 0").outputOptions(`-map_metadata 1`);
|
|
@@ -188880,13 +188893,13 @@ const mergeVideos = async (inputFiles, options = {
|
|
|
188880
188893
|
return { ...progress, percentage: Math.round((currentTime / duration) * 100) };
|
|
188881
188894
|
},
|
|
188882
188895
|
onEnd: async () => {
|
|
188883
|
-
fs$
|
|
188896
|
+
fs$k.remove(fileTxtPath);
|
|
188884
188897
|
if (options.removeOrigin) {
|
|
188885
188898
|
await Promise.all(inputFiles.map((videoInput) => trashItem(videoInput)));
|
|
188886
188899
|
}
|
|
188887
188900
|
},
|
|
188888
188901
|
onError: async () => {
|
|
188889
|
-
fs$
|
|
188902
|
+
fs$k.remove(fileTxtPath);
|
|
188890
188903
|
},
|
|
188891
188904
|
});
|
|
188892
188905
|
taskQueue.addTask(task, false);
|
|
@@ -189145,7 +189158,7 @@ async function getPlayUrl(bvid, cid, uid) {
|
|
|
189145
189158
|
* 直播回放下载
|
|
189146
189159
|
*/
|
|
189147
189160
|
async function sliceDownload(output, url, options) {
|
|
189148
|
-
if ((await fs$
|
|
189161
|
+
if ((await fs$k.pathExists(output)) && !options.override)
|
|
189149
189162
|
throw new Error(`${output}已存在`);
|
|
189150
189163
|
const { ffmpegPath } = getBinPath();
|
|
189151
189164
|
const downloader = new M3U8Downloader(url, output, {
|
|
@@ -189163,7 +189176,7 @@ async function sliceDownload(output, url, options) {
|
|
|
189163
189176
|
}
|
|
189164
189177
|
// 下载视频
|
|
189165
189178
|
async function download$2(options, uid) {
|
|
189166
|
-
if ((await fs$
|
|
189179
|
+
if ((await fs$k.pathExists(options.output)) && !options.override)
|
|
189167
189180
|
throw new Error(`${options.output}已存在`);
|
|
189168
189181
|
const client = createClient(uid);
|
|
189169
189182
|
const { ffmpegPath } = getBinPath();
|
|
@@ -189179,7 +189192,7 @@ async function download$2(options, uid) {
|
|
|
189179
189192
|
if (options.danmu !== "none") {
|
|
189180
189193
|
const data = await client.video.getAllDm({ bvid: options.bvid, cid: options.cid });
|
|
189181
189194
|
const xmlContent = await utils$8.protoBufToXml(data);
|
|
189182
|
-
fs$
|
|
189195
|
+
fs$k.writeFile(path$z.join(path$z.dirname(options.output), `${path$z.parse(options.output).name}.xml`), xmlContent);
|
|
189183
189196
|
}
|
|
189184
189197
|
},
|
|
189185
189198
|
});
|
|
@@ -189245,7 +189258,7 @@ function formatOptions(options, coverDir = undefined) {
|
|
|
189245
189258
|
else {
|
|
189246
189259
|
cover = undefined;
|
|
189247
189260
|
}
|
|
189248
|
-
if (cover && !fs$
|
|
189261
|
+
if (cover && !fs$k.pathExistsSync(cover)) {
|
|
189249
189262
|
console.warn("封面不存在", cover);
|
|
189250
189263
|
cover = undefined;
|
|
189251
189264
|
}
|
|
@@ -190369,7 +190382,7 @@ async function post(url, data, config) {
|
|
|
190369
190382
|
function md5File(path) {
|
|
190370
190383
|
return new Promise((resolve, reject) => {
|
|
190371
190384
|
const output = crypto$d.createHash("md5");
|
|
190372
|
-
const input = fs$
|
|
190385
|
+
const input = fs$D.createReadStream(path);
|
|
190373
190386
|
input.on("error", err => {
|
|
190374
190387
|
reject(err);
|
|
190375
190388
|
});
|
|
@@ -190469,7 +190482,7 @@ class Uploader {
|
|
|
190469
190482
|
* @returns 文件大小(字节)
|
|
190470
190483
|
*/
|
|
190471
190484
|
getFileSizeSync(filePath) {
|
|
190472
|
-
const stats = fs$
|
|
190485
|
+
const stats = fs$D.statSync(filePath);
|
|
190473
190486
|
return stats.size;
|
|
190474
190487
|
}
|
|
190475
190488
|
/**
|
|
@@ -190725,7 +190738,7 @@ class Uploader {
|
|
|
190725
190738
|
*/
|
|
190726
190739
|
createChunkStream(filePath, start, chunkSize) {
|
|
190727
190740
|
const endByte = start + chunkSize - 1;
|
|
190728
|
-
return fs$
|
|
190741
|
+
return fs$D.createReadStream(filePath, {
|
|
190729
190742
|
start,
|
|
190730
190743
|
end: endByte,
|
|
190731
190744
|
highWaterMark: 64 * 1024, // 64KB 块大小
|
|
@@ -191219,7 +191232,7 @@ class Pan123 extends TypedEmitter {
|
|
|
191219
191232
|
* @returns Promise<void> 上传成功时resolve,失败时reject
|
|
191220
191233
|
*/
|
|
191221
191234
|
async uploadFile(localFilePath, remoteDir = "", options) {
|
|
191222
|
-
if (!(await fs$
|
|
191235
|
+
if (!(await fs$k.pathExists(localFilePath))) {
|
|
191223
191236
|
const error = new Error(`文件不存在: ${localFilePath}`);
|
|
191224
191237
|
this.logger.error(error.message);
|
|
191225
191238
|
console.log(remoteDir);
|
|
@@ -191227,7 +191240,7 @@ class Pan123 extends TypedEmitter {
|
|
|
191227
191240
|
throw error;
|
|
191228
191241
|
}
|
|
191229
191242
|
// 检查文件大小是否超过10GB
|
|
191230
|
-
const stats = await fs$
|
|
191243
|
+
const stats = await fs$k.stat(localFilePath);
|
|
191231
191244
|
const fileSize = stats.size;
|
|
191232
191245
|
const maxSize = 10 * 1024 * 1024 * 1024; // 10GB
|
|
191233
191246
|
if (fileSize > maxSize) {
|
|
@@ -191964,7 +191977,7 @@ const handleRestartTask = (taskId) => {
|
|
|
191964
191977
|
|
|
191965
191978
|
let ntsuspend;
|
|
191966
191979
|
function getNtSuspend() {
|
|
191967
|
-
ntsuspend ??= node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index-
|
|
191980
|
+
ntsuspend ??= node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index-CyQ_VJuq.cjs', document.baseURI).href)))("ntsuspend");
|
|
191968
191981
|
return ntsuspend;
|
|
191969
191982
|
}
|
|
191970
191983
|
class DanmuTask extends AbstractTask {
|
|
@@ -192231,7 +192244,7 @@ class BiliPartVideoTask extends AbstractTask {
|
|
|
192231
192244
|
if (this.useUploadPartPersistence) {
|
|
192232
192245
|
try {
|
|
192233
192246
|
const fileHash = await calculateFileQuickHash(command.filePath);
|
|
192234
|
-
const fileSize = await fs$
|
|
192247
|
+
const fileSize = await fs$k.stat(command.filePath).then((stat) => stat.size);
|
|
192235
192248
|
uploadPartService.addOrUpdate({
|
|
192236
192249
|
file_hash: fileHash,
|
|
192237
192250
|
file_size: fileSize,
|
|
@@ -192297,7 +192310,7 @@ class BiliPartVideoTask extends AbstractTask {
|
|
|
192297
192310
|
if (this.useUploadPartPersistence) {
|
|
192298
192311
|
try {
|
|
192299
192312
|
const fileHash = await calculateFileQuickHash(command.filePath);
|
|
192300
|
-
const fileSize = await fs$
|
|
192313
|
+
const fileSize = await fs$k.stat(command.filePath).then((stat) => stat.size);
|
|
192301
192314
|
const part = uploadPartService.findValidPartByHash(fileHash, fileSize, String(this.uid));
|
|
192302
192315
|
if (part) {
|
|
192303
192316
|
this.status = "completed";
|
|
@@ -192327,7 +192340,7 @@ class BiliPartVideoTask extends AbstractTask {
|
|
|
192327
192340
|
this.scheduleStalledProgressTimer();
|
|
192328
192341
|
command.upload();
|
|
192329
192342
|
try {
|
|
192330
|
-
const fileSize = await fs$
|
|
192343
|
+
const fileSize = await fs$k.stat(command.filePath).then((stat) => stat.size);
|
|
192331
192344
|
this.extra = { ...this.extra, fileSize };
|
|
192332
192345
|
}
|
|
192333
192346
|
catch (error) {
|
|
@@ -194139,8 +194152,8 @@ function getValuesFromArrayLikeFlexSpaceBetween(array, columnCount) {
|
|
|
194139
194152
|
}
|
|
194140
194153
|
function ensureFolderExist(fileOrFolderPath) {
|
|
194141
194154
|
const folder = path$z.dirname(fileOrFolderPath);
|
|
194142
|
-
if (!fs$
|
|
194143
|
-
fs$
|
|
194155
|
+
if (!fs$D.existsSync(folder)) {
|
|
194156
|
+
fs$D.mkdirSync(folder, { recursive: true });
|
|
194144
194157
|
}
|
|
194145
194158
|
}
|
|
194146
194159
|
function assert$p(assertion, msg) {
|
|
@@ -194294,7 +194307,7 @@ async function downloadImage(imageUrl, savePath) {
|
|
|
194294
194307
|
if (!res.body) {
|
|
194295
194308
|
throw new Error("No body in response");
|
|
194296
194309
|
}
|
|
194297
|
-
const fileStream = fs$
|
|
194310
|
+
const fileStream = fs$D.createWriteStream(savePath, { flags: "wx" });
|
|
194298
194311
|
// @ts-ignore
|
|
194299
194312
|
await promises.finished(require$$0$b.Readable.fromWeb(res.body).pipe(fileStream));
|
|
194300
194313
|
}
|
|
@@ -194783,7 +194796,7 @@ function createRecordExtraDataController(savePath) {
|
|
|
194783
194796
|
const initializeFile = async (content) => {
|
|
194784
194797
|
// 这里有个假设,那就是第一次保存必然存在metatdata信息
|
|
194785
194798
|
const initialContent = data.header.replace(METADATA_PLACEHOLDER, generateMetadataXml(data.meta));
|
|
194786
|
-
await fs$
|
|
194799
|
+
await fs$D.promises.writeFile(savePath, initialContent + content);
|
|
194787
194800
|
hasPersistedHeader = true;
|
|
194788
194801
|
};
|
|
194789
194802
|
const writeToFile = async (force = false) => {
|
|
@@ -194961,7 +194974,7 @@ function generateXmlContent(metadata, messages) {
|
|
|
194961
194974
|
async function appendToXmlFile(filePath, content) {
|
|
194962
194975
|
try {
|
|
194963
194976
|
// 直接追加内容
|
|
194964
|
-
await fs$
|
|
194977
|
+
await fs$D.promises.appendFile(filePath, content);
|
|
194965
194978
|
}
|
|
194966
194979
|
catch (error) {
|
|
194967
194980
|
console.error(`写入XML文件失败: ${filePath}`, error);
|
|
@@ -195025,7 +195038,7 @@ class Segment extends EventEmitter$l {
|
|
|
195025
195038
|
text: `Renaming segment file: ${this.rawRecordingVideoPath} -> ${this.outputFilePath}`,
|
|
195026
195039
|
});
|
|
195027
195040
|
await Promise.all([
|
|
195028
|
-
retry$1(() => fs$
|
|
195041
|
+
retry$1(() => fs$E.rename(this.rawRecordingVideoPath, this.outputFilePath), 20, 1000),
|
|
195029
195042
|
this.extraDataController?.flush(),
|
|
195030
195043
|
]);
|
|
195031
195044
|
this.emit("videoFileCompleted", data);
|
|
@@ -224778,11 +224791,11 @@ function requireSubresourceIntegrity () {
|
|
|
224778
224791
|
}
|
|
224779
224792
|
|
|
224780
224793
|
var fetch_1$1;
|
|
224781
|
-
var hasRequiredFetch;
|
|
224794
|
+
var hasRequiredFetch$1;
|
|
224782
224795
|
|
|
224783
|
-
function requireFetch () {
|
|
224784
|
-
if (hasRequiredFetch) return fetch_1$1;
|
|
224785
|
-
hasRequiredFetch = 1;
|
|
224796
|
+
function requireFetch$1 () {
|
|
224797
|
+
if (hasRequiredFetch$1) return fetch_1$1;
|
|
224798
|
+
hasRequiredFetch$1 = 1;
|
|
224786
224799
|
|
|
224787
224800
|
const {
|
|
224788
224801
|
makeNetworkError,
|
|
@@ -227212,7 +227225,7 @@ function requireCache () {
|
|
|
227212
227225
|
const { webidl } = requireWebidl();
|
|
227213
227226
|
const { cloneResponse, fromInnerResponse, getResponseState } = requireResponse();
|
|
227214
227227
|
const { Request, fromInnerRequest, getRequestState } = requireRequest();
|
|
227215
|
-
const { fetching } = requireFetch();
|
|
227228
|
+
const { fetching } = requireFetch$1();
|
|
227216
227229
|
const { urlIsHttpHttpsScheme, readAllBytes } = requireUtil$5();
|
|
227217
227230
|
/**
|
|
227218
227231
|
* @see https://w3c.github.io/ServiceWorker/#dfn-cache-batch-operation
|
|
@@ -230039,7 +230052,7 @@ function requireConnection () {
|
|
|
230039
230052
|
const { uid, states, sentCloseFrameState, emptyBuffer, opcodes } = requireConstants();
|
|
230040
230053
|
const { parseExtensions, isClosed, isClosing, isEstablished, isConnecting, validateCloseCodeAndReason } = requireUtil$2();
|
|
230041
230054
|
const { makeRequest } = requireRequest();
|
|
230042
|
-
const { fetching } = requireFetch();
|
|
230055
|
+
const { fetching } = requireFetch$1();
|
|
230043
230056
|
const { Headers, getHeadersList } = requireHeaders();
|
|
230044
230057
|
const { getDecodeSplit } = requireUtil$5();
|
|
230045
230058
|
const { WebsocketFrameSend } = requireFrame();
|
|
@@ -233066,7 +233079,7 @@ function requireEventsource () {
|
|
|
233066
233079
|
hasRequiredEventsource = 1;
|
|
233067
233080
|
|
|
233068
233081
|
const { pipeline } = require$$0$b;
|
|
233069
|
-
const { fetching } = requireFetch();
|
|
233082
|
+
const { fetching } = requireFetch$1();
|
|
233070
233083
|
const { webidl } = requireWebidl();
|
|
233071
233084
|
const { EventSourceStream } = requireEventsourceStream();
|
|
233072
233085
|
const { parseMIMEType } = requireDataUrl();
|
|
@@ -233683,7 +233696,7 @@ undici.exports;
|
|
|
233683
233696
|
module.exports.setGlobalDispatcher = setGlobalDispatcher;
|
|
233684
233697
|
module.exports.getGlobalDispatcher = getGlobalDispatcher;
|
|
233685
233698
|
|
|
233686
|
-
const fetchImpl = requireFetch().fetch;
|
|
233699
|
+
const fetchImpl = requireFetch$1().fetch;
|
|
233687
233700
|
|
|
233688
233701
|
// Capture __filename at module load time for stack trace augmentation.
|
|
233689
233702
|
// This may be undefined when bundled in environments like Node.js internals.
|
|
@@ -245994,13 +246007,13 @@ const getStream$6 = async (data, resoltion) => {
|
|
|
245994
246007
|
*/
|
|
245995
246008
|
async function download$1(output, decodeData, options) {
|
|
245996
246009
|
const mp4Output = replaceExtName$1(output, ".mp4");
|
|
245997
|
-
if ((await fs$
|
|
246010
|
+
if ((await fs$k.pathExists(mp4Output)) && !options.override)
|
|
245998
246011
|
throw new Error(`${mp4Output}已存在`);
|
|
245999
246012
|
if (options.danmu !== "none" && !options.vid)
|
|
246000
246013
|
throw new Error("下载弹幕时vid不能为空");
|
|
246001
246014
|
const { dir, name } = path$z.parse(output);
|
|
246002
246015
|
const tsOutput = path$z.join(dir, `${name}.ts`);
|
|
246003
|
-
if (await fs$
|
|
246016
|
+
if (await fs$k.pathExists(tsOutput)) {
|
|
246004
246017
|
throw new Error(`${tsOutput}已存在,您可以直接执行转封装命令,或者删除后重新下载`);
|
|
246005
246018
|
}
|
|
246006
246019
|
let m3u8Url = await getStream$6(decodeData, options.resoltion);
|
|
@@ -246023,7 +246036,7 @@ async function download$1(output, decodeData, options) {
|
|
|
246023
246036
|
if (options.danmu !== "none" && options.vid) {
|
|
246024
246037
|
const danmu = await getVideoDanmu(options.vid);
|
|
246025
246038
|
const xml = convert2Xml(danmu, options.danmuMeta || {});
|
|
246026
|
-
fs$
|
|
246039
|
+
fs$k.writeFile(path$z.join(path$z.dirname(output), `${path$z.parse(output).name}.xml`), xml);
|
|
246027
246040
|
}
|
|
246028
246041
|
const outputName = `${name}.mp4`;
|
|
246029
246042
|
await sleep$1(2000);
|
|
@@ -246063,11 +246076,11 @@ const parseVideo$1 = async (url) => {
|
|
|
246063
246076
|
return videoList;
|
|
246064
246077
|
};
|
|
246065
246078
|
const downloadDanmu = async (vid, output, override, meta) => {
|
|
246066
|
-
if ((await fs$
|
|
246079
|
+
if ((await fs$k.pathExists(output)) && !override)
|
|
246067
246080
|
throw new Error(`${output}已存在`);
|
|
246068
246081
|
const danmu = await getVideoDanmu(vid);
|
|
246069
246082
|
const xml = convert2Xml(danmu, meta || {});
|
|
246070
|
-
await fs$
|
|
246083
|
+
await fs$k.writeFile(output, xml);
|
|
246071
246084
|
return output;
|
|
246072
246085
|
};
|
|
246073
246086
|
async function getReplayList(subId, opts) {
|
|
@@ -246082,11 +246095,11 @@ var douyu = { download: download$1, parseVideo: parseVideo$1, getAvailableStream
|
|
|
246082
246095
|
|
|
246083
246096
|
async function download(output, url, options) {
|
|
246084
246097
|
const mp4Output = replaceExtName$1(output, ".mp4");
|
|
246085
|
-
if ((await fs$
|
|
246098
|
+
if ((await fs$k.pathExists(mp4Output)) && !options.override)
|
|
246086
246099
|
throw new Error(`${mp4Output}已存在`);
|
|
246087
246100
|
const { dir, name } = path$z.parse(output);
|
|
246088
246101
|
const tsOutput = path$z.join(dir, `${name}.ts`);
|
|
246089
|
-
if (await fs$
|
|
246102
|
+
if (await fs$k.pathExists(tsOutput)) {
|
|
246090
246103
|
throw new Error(`${tsOutput}已存在,您可以直接执行转封装命令,或者删除后重新下载`);
|
|
246091
246104
|
}
|
|
246092
246105
|
const { ffmpegPath } = getBinPath();
|
|
@@ -246462,7 +246475,7 @@ async function checkAll() {
|
|
|
246462
246475
|
if (!savePath) {
|
|
246463
246476
|
throw new Error("请先设置下载路径");
|
|
246464
246477
|
}
|
|
246465
|
-
await fs$
|
|
246478
|
+
await fs$k.ensureDir(savePath);
|
|
246466
246479
|
}
|
|
246467
246480
|
for (const item of needCheckItems) {
|
|
246468
246481
|
try {
|
|
@@ -246558,13 +246571,13 @@ const extractStartTimeFromFilename = (filename, startTimeAutoMatch, fileBirthtim
|
|
|
246558
246571
|
*/
|
|
246559
246572
|
const getMatchingFiles = async (config, folderPath, startTime) => {
|
|
246560
246573
|
// 检查监听文件夹是否存在
|
|
246561
|
-
const exists = await fs$
|
|
246574
|
+
const exists = await fs$k.pathExists(folderPath);
|
|
246562
246575
|
if (!exists) {
|
|
246563
246576
|
logObj.warn(`文件夹不存在: ${folderPath}`);
|
|
246564
246577
|
return [];
|
|
246565
246578
|
}
|
|
246566
246579
|
// 筛选出符合条件的文件
|
|
246567
|
-
const files = await fs$
|
|
246580
|
+
const files = await fs$k.readdir(folderPath);
|
|
246568
246581
|
const videoFiles = files
|
|
246569
246582
|
.filter((file) => {
|
|
246570
246583
|
// 使用配置的文件匹配规则,如果未配置则使用默认规则
|
|
@@ -246608,7 +246621,7 @@ const getMatchingFiles = async (config, folderPath, startTime) => {
|
|
|
246608
246621
|
if (unprocessedFiles.length === 0) {
|
|
246609
246622
|
return [];
|
|
246610
246623
|
}
|
|
246611
|
-
const stats = await Promise.allSettled(unprocessedFiles.map((file) => fs$
|
|
246624
|
+
const stats = await Promise.allSettled(unprocessedFiles.map((file) => fs$k.stat(file)));
|
|
246612
246625
|
const newRecords = stats
|
|
246613
246626
|
.map((item, index) => {
|
|
246614
246627
|
return {
|
|
@@ -265677,7 +265690,7 @@ var indexMinimal$1 = {};
|
|
|
265677
265690
|
|
|
265678
265691
|
var minimal$2 = {};
|
|
265679
265692
|
|
|
265680
|
-
var aspromise$1 = asPromise$
|
|
265693
|
+
var aspromise$1 = asPromise$2;
|
|
265681
265694
|
|
|
265682
265695
|
/**
|
|
265683
265696
|
* Callback as used by {@link util.asPromise}.
|
|
@@ -265696,7 +265709,7 @@ var aspromise$1 = asPromise$3;
|
|
|
265696
265709
|
* @param {...*} params Function arguments
|
|
265697
265710
|
* @returns {Promise<*>} Promisified function
|
|
265698
265711
|
*/
|
|
265699
|
-
function asPromise$
|
|
265712
|
+
function asPromise$2(fn, ctx/*, varargs */) {
|
|
265700
265713
|
var params = new Array(arguments.length - 1),
|
|
265701
265714
|
offset = 0,
|
|
265702
265715
|
index = 2,
|
|
@@ -270085,328 +270098,367 @@ var types$1 = {};
|
|
|
270085
270098
|
|
|
270086
270099
|
var util$7 = {exports: {}};
|
|
270087
270100
|
|
|
270088
|
-
var patterns
|
|
270089
|
-
|
|
270090
|
-
(function (exports) {
|
|
270091
|
-
|
|
270092
|
-
var patterns = exports;
|
|
270093
|
-
|
|
270094
|
-
patterns.numberRe = /^(?![eE])[0-9]*(?:\.[0-9]*)?(?:[eE][+-]?[0-9]+)?$/;
|
|
270095
|
-
patterns.typeRefRe = /^(?:\.?[a-zA-Z_][a-zA-Z_0-9]*)(?:\.[a-zA-Z_][a-zA-Z_0-9]*)*$/;
|
|
270096
|
-
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)$/;
|
|
270097
|
-
patterns.unsafePropertyRe = /^(?:__proto__|prototype|constructor)$/;
|
|
270098
|
-
} (patterns$1));
|
|
270101
|
+
var patterns = {};
|
|
270099
270102
|
|
|
270100
|
-
var
|
|
270103
|
+
var hasRequiredPatterns;
|
|
270101
270104
|
|
|
270102
|
-
|
|
270103
|
-
|
|
270104
|
-
|
|
270105
|
-
|
|
270106
|
-
* Begins generating a function.
|
|
270107
|
-
* @memberof util
|
|
270108
|
-
* @param {string[]} functionParams Function parameter names
|
|
270109
|
-
* @param {string} [functionName] Function name if not anonymous
|
|
270110
|
-
* @returns {Codegen} Appender that appends code to the function's body
|
|
270111
|
-
*/
|
|
270112
|
-
function codegen(functionParams, functionName) {
|
|
270113
|
-
|
|
270114
|
-
/* istanbul ignore if */
|
|
270115
|
-
if (typeof functionParams === "string") {
|
|
270116
|
-
functionName = functionParams;
|
|
270117
|
-
functionParams = undefined;
|
|
270118
|
-
}
|
|
270105
|
+
function requirePatterns () {
|
|
270106
|
+
if (hasRequiredPatterns) return patterns;
|
|
270107
|
+
hasRequiredPatterns = 1;
|
|
270108
|
+
(function (exports) {
|
|
270119
270109
|
|
|
270120
|
-
|
|
270110
|
+
var patterns = exports;
|
|
270121
270111
|
|
|
270122
|
-
|
|
270123
|
-
|
|
270124
|
-
|
|
270125
|
-
|
|
270126
|
-
|
|
270127
|
-
|
|
270128
|
-
|
|
270129
|
-
* @throws {Error} If format parameter counts do not match
|
|
270130
|
-
*/
|
|
270112
|
+
patterns.numberRe = /^(?![eE])[0-9]*(?:\.[0-9]*)?(?:[eE][+-]?[0-9]+)?$/;
|
|
270113
|
+
patterns.typeRefRe = /^(?:\.?[a-zA-Z_][a-zA-Z_0-9]*)(?:\.[a-zA-Z_][a-zA-Z_0-9]*)*$/;
|
|
270114
|
+
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)$/;
|
|
270115
|
+
patterns.unsafePropertyRe = /^(?:__proto__|prototype|constructor)$/;
|
|
270116
|
+
} (patterns));
|
|
270117
|
+
return patterns;
|
|
270118
|
+
}
|
|
270131
270119
|
|
|
270132
|
-
|
|
270133
|
-
|
|
270134
|
-
|
|
270135
|
-
// finish the function
|
|
270136
|
-
if (typeof formatStringOrScope !== "string") {
|
|
270137
|
-
var source = toString();
|
|
270138
|
-
if (codegen.verbose)
|
|
270139
|
-
console.log("codegen: " + source); // eslint-disable-line no-console
|
|
270140
|
-
source = "return " + source;
|
|
270141
|
-
if (formatStringOrScope) {
|
|
270142
|
-
var scopeKeys = Object.keys(formatStringOrScope),
|
|
270143
|
-
scopeParams = new Array(scopeKeys.length + 1),
|
|
270144
|
-
scopeValues = new Array(scopeKeys.length),
|
|
270145
|
-
scopeOffset = 0;
|
|
270146
|
-
while (scopeOffset < scopeKeys.length) {
|
|
270147
|
-
scopeParams[scopeOffset] = scopeKeys[scopeOffset];
|
|
270148
|
-
scopeValues[scopeOffset] = formatStringOrScope[scopeKeys[scopeOffset++]];
|
|
270149
|
-
}
|
|
270150
|
-
scopeParams[scopeOffset] = source;
|
|
270151
|
-
return Function.apply(null, scopeParams).apply(null, scopeValues); // eslint-disable-line no-new-func
|
|
270152
|
-
}
|
|
270153
|
-
return Function(source)(); // eslint-disable-line no-new-func
|
|
270154
|
-
}
|
|
270155
|
-
|
|
270156
|
-
// otherwise append to body
|
|
270157
|
-
var formatParams = new Array(arguments.length - 1),
|
|
270158
|
-
formatOffset = 0;
|
|
270159
|
-
while (formatOffset < formatParams.length)
|
|
270160
|
-
formatParams[formatOffset] = arguments[++formatOffset];
|
|
270161
|
-
formatOffset = 0;
|
|
270162
|
-
formatStringOrScope = formatStringOrScope.replace(/%([%dfijs])/g, function replace($0, $1) {
|
|
270163
|
-
var value = formatParams[formatOffset++];
|
|
270164
|
-
switch ($1) {
|
|
270165
|
-
case "d": case "f": return String(Number(value));
|
|
270166
|
-
case "i": return String(Math.floor(value));
|
|
270167
|
-
case "j": return JSON.stringify(value);
|
|
270168
|
-
case "s": return String(value);
|
|
270169
|
-
}
|
|
270170
|
-
return "%";
|
|
270171
|
-
});
|
|
270172
|
-
if (formatOffset !== formatParams.length)
|
|
270173
|
-
throw Error("parameter count mismatch");
|
|
270174
|
-
body.push(formatStringOrScope);
|
|
270175
|
-
return Codegen;
|
|
270176
|
-
}
|
|
270120
|
+
var codegen_1;
|
|
270121
|
+
var hasRequiredCodegen;
|
|
270177
270122
|
|
|
270178
|
-
|
|
270179
|
-
|
|
270180
|
-
|
|
270123
|
+
function requireCodegen () {
|
|
270124
|
+
if (hasRequiredCodegen) return codegen_1;
|
|
270125
|
+
hasRequiredCodegen = 1;
|
|
270126
|
+
codegen_1 = codegen;
|
|
270181
270127
|
|
|
270182
|
-
|
|
270183
|
-
|
|
270184
|
-
}
|
|
270128
|
+
var patterns = requirePatterns();
|
|
270129
|
+
var reservedRe = patterns.reservedRe;
|
|
270185
270130
|
|
|
270186
|
-
/**
|
|
270187
|
-
|
|
270188
|
-
|
|
270189
|
-
|
|
270190
|
-
|
|
270191
|
-
|
|
270192
|
-
|
|
270193
|
-
|
|
270131
|
+
/**
|
|
270132
|
+
* Begins generating a function.
|
|
270133
|
+
* @memberof util
|
|
270134
|
+
* @param {string[]} functionParams Function parameter names
|
|
270135
|
+
* @param {string} [functionName] Function name if not anonymous
|
|
270136
|
+
* @returns {Codegen} Appender that appends code to the function's body
|
|
270137
|
+
*/
|
|
270138
|
+
function codegen(functionParams, functionName) {
|
|
270194
270139
|
|
|
270195
|
-
|
|
270196
|
-
|
|
270197
|
-
|
|
270198
|
-
|
|
270199
|
-
|
|
270200
|
-
codegen.verbose = false;
|
|
270140
|
+
/* istanbul ignore if */
|
|
270141
|
+
if (typeof functionParams === "string") {
|
|
270142
|
+
functionName = functionParams;
|
|
270143
|
+
functionParams = undefined;
|
|
270144
|
+
}
|
|
270201
270145
|
|
|
270202
|
-
|
|
270203
|
-
if (!name)
|
|
270204
|
-
return "";
|
|
270205
|
-
name = String(name).replace(/[^\w$]/g, "");
|
|
270206
|
-
if (!name)
|
|
270207
|
-
return "";
|
|
270208
|
-
if (/^\d/.test(name))
|
|
270209
|
-
name = "_" + name;
|
|
270210
|
-
return reservedRe.test(name) ? name + "_" : name;
|
|
270211
|
-
}
|
|
270146
|
+
var body = [];
|
|
270212
270147
|
|
|
270213
|
-
|
|
270214
|
-
|
|
270215
|
-
|
|
270216
|
-
|
|
270217
|
-
|
|
270218
|
-
}
|
|
270219
|
-
|
|
270220
|
-
}
|
|
270221
|
-
|
|
270148
|
+
/**
|
|
270149
|
+
* Appends code to the function's body or finishes generation.
|
|
270150
|
+
* @typedef Codegen
|
|
270151
|
+
* @type {function}
|
|
270152
|
+
* @param {string|Object.<string,*>} [formatStringOrScope] Format string or, to finish the function, an object of additional scope variables, if any
|
|
270153
|
+
* @param {...*} [formatParams] Format parameters
|
|
270154
|
+
* @returns {Codegen|Function} Itself or the generated function if finished
|
|
270155
|
+
* @throws {Error} If format parameter counts do not match
|
|
270156
|
+
*/
|
|
270222
270157
|
|
|
270223
|
-
|
|
270158
|
+
function Codegen(formatStringOrScope) {
|
|
270159
|
+
// note that explicit array handling below makes this ~50% faster
|
|
270160
|
+
|
|
270161
|
+
// finish the function
|
|
270162
|
+
if (typeof formatStringOrScope !== "string") {
|
|
270163
|
+
var source = toString();
|
|
270164
|
+
if (codegen.verbose)
|
|
270165
|
+
console.log("codegen: " + source); // eslint-disable-line no-console
|
|
270166
|
+
source = "return " + source;
|
|
270167
|
+
if (formatStringOrScope) {
|
|
270168
|
+
var scopeKeys = Object.keys(formatStringOrScope),
|
|
270169
|
+
scopeParams = new Array(scopeKeys.length + 1),
|
|
270170
|
+
scopeValues = new Array(scopeKeys.length),
|
|
270171
|
+
scopeOffset = 0;
|
|
270172
|
+
while (scopeOffset < scopeKeys.length) {
|
|
270173
|
+
scopeParams[scopeOffset] = scopeKeys[scopeOffset];
|
|
270174
|
+
scopeValues[scopeOffset] = formatStringOrScope[scopeKeys[scopeOffset++]];
|
|
270175
|
+
}
|
|
270176
|
+
scopeParams[scopeOffset] = source;
|
|
270177
|
+
return Function.apply(null, scopeParams).apply(null, scopeValues); // eslint-disable-line no-new-func
|
|
270178
|
+
}
|
|
270179
|
+
return Function(source)(); // eslint-disable-line no-new-func
|
|
270180
|
+
}
|
|
270224
270181
|
|
|
270225
|
-
|
|
270226
|
-
|
|
270182
|
+
// otherwise append to body
|
|
270183
|
+
var formatParams = new Array(arguments.length - 1),
|
|
270184
|
+
formatOffset = 0;
|
|
270185
|
+
while (formatOffset < formatParams.length)
|
|
270186
|
+
formatParams[formatOffset] = arguments[++formatOffset];
|
|
270187
|
+
formatOffset = 0;
|
|
270188
|
+
formatStringOrScope = formatStringOrScope.replace(/%([%dfijs])/g, function replace($0, $1) {
|
|
270189
|
+
var value = formatParams[formatOffset++];
|
|
270190
|
+
switch ($1) {
|
|
270191
|
+
case "d": case "f": return String(Number(value));
|
|
270192
|
+
case "i": return String(Math.floor(value));
|
|
270193
|
+
case "j": return JSON.stringify(value);
|
|
270194
|
+
case "s": return String(value);
|
|
270195
|
+
}
|
|
270196
|
+
return "%";
|
|
270197
|
+
});
|
|
270198
|
+
if (formatOffset !== formatParams.length)
|
|
270199
|
+
throw Error("parameter count mismatch");
|
|
270200
|
+
body.push(formatStringOrScope);
|
|
270201
|
+
return Codegen;
|
|
270202
|
+
}
|
|
270227
270203
|
|
|
270228
|
-
|
|
270229
|
-
|
|
270230
|
-
|
|
270231
|
-
* @type {function}
|
|
270232
|
-
* @param {?Error} error Error, if any, otherwise `null`
|
|
270233
|
-
* @param {string} [contents] File contents, if there hasn't been an error
|
|
270234
|
-
* @returns {undefined}
|
|
270235
|
-
*/
|
|
270204
|
+
function toString(functionNameOverride) {
|
|
270205
|
+
return "function " + safeFunctionName(functionNameOverride || functionName) + "(" + (functionParams && functionParams.join(",") || "") + "){\n " + body.join("\n ") + "\n}";
|
|
270206
|
+
}
|
|
270236
270207
|
|
|
270237
|
-
|
|
270238
|
-
|
|
270239
|
-
|
|
270240
|
-
* @property {boolean} [binary=false] Whether expecting a binary response
|
|
270241
|
-
* @property {boolean} [xhr=false] If `true`, forces the use of XMLHttpRequest
|
|
270242
|
-
*/
|
|
270208
|
+
Codegen.toString = toString;
|
|
270209
|
+
return Codegen;
|
|
270210
|
+
}
|
|
270243
270211
|
|
|
270244
|
-
/**
|
|
270245
|
-
|
|
270246
|
-
|
|
270247
|
-
|
|
270248
|
-
|
|
270249
|
-
|
|
270250
|
-
|
|
270251
|
-
|
|
270252
|
-
function fetch$1(filename, options, callback) {
|
|
270253
|
-
if (typeof options === "function") {
|
|
270254
|
-
callback = options;
|
|
270255
|
-
options = {};
|
|
270256
|
-
} else if (!options)
|
|
270257
|
-
options = {};
|
|
270212
|
+
/**
|
|
270213
|
+
* Begins generating a function.
|
|
270214
|
+
* @memberof util
|
|
270215
|
+
* @function codegen
|
|
270216
|
+
* @param {string} [functionName] Function name if not anonymous
|
|
270217
|
+
* @returns {Codegen} Appender that appends code to the function's body
|
|
270218
|
+
* @variation 2
|
|
270219
|
+
*/
|
|
270258
270220
|
|
|
270259
|
-
|
|
270260
|
-
|
|
270261
|
-
|
|
270262
|
-
|
|
270263
|
-
|
|
270264
|
-
|
|
270265
|
-
return err && typeof XMLHttpRequest !== "undefined"
|
|
270266
|
-
? fetch$1.xhr(filename, options, callback)
|
|
270267
|
-
: err
|
|
270268
|
-
? callback(err)
|
|
270269
|
-
: callback(null, options.binary ? contents : contents.toString("utf8"));
|
|
270270
|
-
});
|
|
270221
|
+
/**
|
|
270222
|
+
* When set to `true`, codegen will log generated code to console. Useful for debugging.
|
|
270223
|
+
* @name util.codegen.verbose
|
|
270224
|
+
* @type {boolean}
|
|
270225
|
+
*/
|
|
270226
|
+
codegen.verbose = false;
|
|
270271
270227
|
|
|
270272
|
-
|
|
270273
|
-
|
|
270228
|
+
function safeFunctionName(name) {
|
|
270229
|
+
if (!name)
|
|
270230
|
+
return "";
|
|
270231
|
+
name = String(name).replace(/[^\w$]/g, "");
|
|
270232
|
+
if (!name)
|
|
270233
|
+
return "";
|
|
270234
|
+
if (/^\d/.test(name))
|
|
270235
|
+
name = "_" + name;
|
|
270236
|
+
return reservedRe.test(name) ? name + "_" : name;
|
|
270237
|
+
}
|
|
270238
|
+
return codegen_1;
|
|
270274
270239
|
}
|
|
270275
270240
|
|
|
270276
|
-
|
|
270277
|
-
|
|
270278
|
-
* @name util.fetch
|
|
270279
|
-
* @function
|
|
270280
|
-
* @param {string} path File path or url
|
|
270281
|
-
* @param {FetchCallback} callback Callback function
|
|
270282
|
-
* @returns {undefined}
|
|
270283
|
-
* @variation 2
|
|
270284
|
-
*/
|
|
270285
|
-
|
|
270286
|
-
/**
|
|
270287
|
-
* Fetches the contents of a file.
|
|
270288
|
-
* @name util.fetch
|
|
270289
|
-
* @function
|
|
270290
|
-
* @param {string} path File path or url
|
|
270291
|
-
* @param {IFetchOptions} [options] Fetch options
|
|
270292
|
-
* @returns {Promise<string|Uint8Array>} Promise
|
|
270293
|
-
* @variation 3
|
|
270294
|
-
*/
|
|
270295
|
-
|
|
270296
|
-
/**/
|
|
270297
|
-
fetch$1.xhr = function fetch_xhr(filename, options, callback) {
|
|
270298
|
-
var xhr = new XMLHttpRequest();
|
|
270299
|
-
xhr.onreadystatechange /* works everywhere */ = function fetchOnReadyStateChange() {
|
|
270241
|
+
var fs_1;
|
|
270242
|
+
var hasRequiredFs;
|
|
270300
270243
|
|
|
270301
|
-
|
|
270302
|
-
|
|
270244
|
+
function requireFs () {
|
|
270245
|
+
if (hasRequiredFs) return fs_1;
|
|
270246
|
+
hasRequiredFs = 1;
|
|
270303
270247
|
|
|
270304
|
-
|
|
270305
|
-
|
|
270306
|
-
|
|
270307
|
-
|
|
270308
|
-
|
|
270248
|
+
var fs = null;
|
|
270249
|
+
try {
|
|
270250
|
+
fs = require(/* webpackIgnore: true */ "fs");
|
|
270251
|
+
if (!fs || !fs.readFile || !fs.readFileSync)
|
|
270252
|
+
fs = null;
|
|
270253
|
+
} catch (e) {
|
|
270254
|
+
// `fs` is unavailable in browsers and browser-like bundles.
|
|
270255
|
+
}
|
|
270256
|
+
fs_1 = fs;
|
|
270257
|
+
return fs_1;
|
|
270258
|
+
}
|
|
270309
270259
|
|
|
270310
|
-
|
|
270311
|
-
|
|
270312
|
-
if (options.binary) {
|
|
270313
|
-
var buffer = xhr.response;
|
|
270314
|
-
if (!buffer) {
|
|
270315
|
-
buffer = [];
|
|
270316
|
-
for (var i = 0; i < xhr.responseText.length; ++i)
|
|
270317
|
-
buffer.push(xhr.responseText.charCodeAt(i) & 255);
|
|
270318
|
-
}
|
|
270319
|
-
return callback(null, typeof Uint8Array !== "undefined" ? new Uint8Array(buffer) : buffer);
|
|
270320
|
-
}
|
|
270321
|
-
return callback(null, xhr.responseText);
|
|
270322
|
-
};
|
|
270260
|
+
var fetch_1;
|
|
270261
|
+
var hasRequiredFetch;
|
|
270323
270262
|
|
|
270324
|
-
|
|
270325
|
-
|
|
270326
|
-
|
|
270327
|
-
|
|
270328
|
-
xhr.responseType = "arraybuffer";
|
|
270329
|
-
}
|
|
270263
|
+
function requireFetch () {
|
|
270264
|
+
if (hasRequiredFetch) return fetch_1;
|
|
270265
|
+
hasRequiredFetch = 1;
|
|
270266
|
+
fetch_1 = fetch;
|
|
270330
270267
|
|
|
270331
|
-
|
|
270332
|
-
|
|
270333
|
-
};
|
|
270268
|
+
var asPromise = aspromise$1,
|
|
270269
|
+
fs = requireFs();
|
|
270334
270270
|
|
|
270335
|
-
|
|
270271
|
+
/**
|
|
270272
|
+
* Node-style callback as used by {@link util.fetch}.
|
|
270273
|
+
* @typedef FetchCallback
|
|
270274
|
+
* @type {function}
|
|
270275
|
+
* @param {?Error} error Error, if any, otherwise `null`
|
|
270276
|
+
* @param {string} [contents] File contents, if there hasn't been an error
|
|
270277
|
+
* @returns {undefined}
|
|
270278
|
+
*/
|
|
270336
270279
|
|
|
270337
|
-
|
|
270280
|
+
/**
|
|
270281
|
+
* Options as used by {@link util.fetch}.
|
|
270282
|
+
* @interface IFetchOptions
|
|
270283
|
+
* @property {boolean} [binary=false] Whether expecting a binary response
|
|
270284
|
+
* @property {boolean} [xhr=false] If `true`, forces the use of XMLHttpRequest
|
|
270285
|
+
*/
|
|
270338
270286
|
|
|
270339
270287
|
/**
|
|
270340
|
-
*
|
|
270288
|
+
* Fetches the contents of a file.
|
|
270341
270289
|
* @memberof util
|
|
270342
|
-
* @
|
|
270290
|
+
* @param {string} filename File path or url
|
|
270291
|
+
* @param {IFetchOptions} options Fetch options
|
|
270292
|
+
* @param {FetchCallback} callback Callback function
|
|
270293
|
+
* @returns {undefined}
|
|
270343
270294
|
*/
|
|
270344
|
-
|
|
270295
|
+
function fetch(filename, options, callback) {
|
|
270296
|
+
if (typeof options === "function") {
|
|
270297
|
+
callback = options;
|
|
270298
|
+
options = {};
|
|
270299
|
+
} else if (!options)
|
|
270300
|
+
options = {};
|
|
270301
|
+
|
|
270302
|
+
if (!callback)
|
|
270303
|
+
return asPromise(fetch, this, filename, options); // eslint-disable-line no-invalid-this
|
|
270304
|
+
|
|
270305
|
+
// if a node-like filesystem is present, try it first but fall back to XHR if nothing is found.
|
|
270306
|
+
if (!options.xhr && fs && fs.readFile)
|
|
270307
|
+
return fs.readFile(filename, function fetchReadFileCallback(err, contents) {
|
|
270308
|
+
return err && typeof XMLHttpRequest !== "undefined"
|
|
270309
|
+
? fetch.xhr(filename, options, callback)
|
|
270310
|
+
: err
|
|
270311
|
+
? callback(err)
|
|
270312
|
+
: callback(null, options.binary ? contents : contents.toString("utf8"));
|
|
270313
|
+
});
|
|
270314
|
+
|
|
270315
|
+
// use the XHR version otherwise.
|
|
270316
|
+
return fetch.xhr(filename, options, callback);
|
|
270317
|
+
}
|
|
270345
270318
|
|
|
270346
|
-
var isAbsolute =
|
|
270347
270319
|
/**
|
|
270348
|
-
*
|
|
270349
|
-
* @
|
|
270350
|
-
* @
|
|
270320
|
+
* Fetches the contents of a file.
|
|
270321
|
+
* @name util.fetch
|
|
270322
|
+
* @function
|
|
270323
|
+
* @param {string} path File path or url
|
|
270324
|
+
* @param {FetchCallback} callback Callback function
|
|
270325
|
+
* @returns {undefined}
|
|
270326
|
+
* @variation 2
|
|
270351
270327
|
*/
|
|
270352
|
-
path.isAbsolute = function isAbsolute(path) {
|
|
270353
|
-
return /^(?:\/|\w+:|\\\\\w+)/.test(path);
|
|
270354
|
-
};
|
|
270355
270328
|
|
|
270356
|
-
var normalize =
|
|
270357
270329
|
/**
|
|
270358
|
-
*
|
|
270359
|
-
* @
|
|
270360
|
-
* @
|
|
270330
|
+
* Fetches the contents of a file.
|
|
270331
|
+
* @name util.fetch
|
|
270332
|
+
* @function
|
|
270333
|
+
* @param {string} path File path or url
|
|
270334
|
+
* @param {IFetchOptions} [options] Fetch options
|
|
270335
|
+
* @returns {Promise<string|Uint8Array>} Promise
|
|
270336
|
+
* @variation 3
|
|
270361
270337
|
*/
|
|
270362
|
-
path.normalize = function normalize(path) {
|
|
270363
|
-
var firstTwoCharacters = path.substring(0,2);
|
|
270364
|
-
var uncPrefix = "";
|
|
270365
|
-
if (firstTwoCharacters === "\\\\") {
|
|
270366
|
-
uncPrefix = firstTwoCharacters;
|
|
270367
|
-
path = path.substring(2);
|
|
270368
|
-
}
|
|
270369
270338
|
|
|
270370
|
-
|
|
270371
|
-
|
|
270372
|
-
var
|
|
270373
|
-
|
|
270374
|
-
|
|
270375
|
-
|
|
270376
|
-
|
|
270377
|
-
|
|
270378
|
-
|
|
270379
|
-
|
|
270380
|
-
|
|
270381
|
-
|
|
270382
|
-
|
|
270383
|
-
|
|
270384
|
-
|
|
270385
|
-
|
|
270386
|
-
|
|
270387
|
-
|
|
270388
|
-
|
|
270339
|
+
/**/
|
|
270340
|
+
fetch.xhr = function fetch_xhr(filename, options, callback) {
|
|
270341
|
+
var xhr = new XMLHttpRequest();
|
|
270342
|
+
xhr.onreadystatechange /* works everywhere */ = function fetchOnReadyStateChange() {
|
|
270343
|
+
|
|
270344
|
+
if (xhr.readyState !== 4)
|
|
270345
|
+
return undefined;
|
|
270346
|
+
|
|
270347
|
+
// local cors security errors return status 0 / empty string, too. afaik this cannot be
|
|
270348
|
+
// reliably distinguished from an actually empty file for security reasons. feel free
|
|
270349
|
+
// to send a pull request if you are aware of a solution.
|
|
270350
|
+
if (xhr.status !== 0 && xhr.status !== 200)
|
|
270351
|
+
return callback(Error("status " + xhr.status));
|
|
270352
|
+
|
|
270353
|
+
// if binary data is expected, make sure that some sort of array is returned, even if
|
|
270354
|
+
// ArrayBuffers are not supported. the binary string fallback, however, is unsafe.
|
|
270355
|
+
if (options.binary) {
|
|
270356
|
+
var buffer = xhr.response;
|
|
270357
|
+
if (!buffer) {
|
|
270358
|
+
buffer = [];
|
|
270359
|
+
for (var i = 0; i < xhr.responseText.length; ++i)
|
|
270360
|
+
buffer.push(xhr.responseText.charCodeAt(i) & 255);
|
|
270361
|
+
}
|
|
270362
|
+
return callback(null, typeof Uint8Array !== "undefined" ? new Uint8Array(buffer) : buffer);
|
|
270363
|
+
}
|
|
270364
|
+
return callback(null, xhr.responseText);
|
|
270365
|
+
};
|
|
270366
|
+
|
|
270367
|
+
if (options.binary) {
|
|
270368
|
+
// ref: https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/Sending_and_Receiving_Binary_Data#Receiving_binary_data_in_older_browsers
|
|
270369
|
+
if ("overrideMimeType" in xhr)
|
|
270370
|
+
xhr.overrideMimeType("text/plain; charset=x-user-defined");
|
|
270371
|
+
xhr.responseType = "arraybuffer";
|
|
270389
270372
|
}
|
|
270390
|
-
|
|
270373
|
+
|
|
270374
|
+
xhr.open("GET", filename);
|
|
270375
|
+
xhr.send();
|
|
270391
270376
|
};
|
|
270377
|
+
return fetch_1;
|
|
270378
|
+
}
|
|
270392
270379
|
|
|
270393
|
-
|
|
270394
|
-
|
|
270395
|
-
|
|
270396
|
-
|
|
270397
|
-
|
|
270398
|
-
|
|
270399
|
-
|
|
270400
|
-
|
|
270401
|
-
|
|
270402
|
-
|
|
270403
|
-
|
|
270404
|
-
|
|
270405
|
-
|
|
270406
|
-
|
|
270407
|
-
|
|
270408
|
-
|
|
270409
|
-
|
|
270380
|
+
var path = {};
|
|
270381
|
+
|
|
270382
|
+
var hasRequiredPath;
|
|
270383
|
+
|
|
270384
|
+
function requirePath () {
|
|
270385
|
+
if (hasRequiredPath) return path;
|
|
270386
|
+
hasRequiredPath = 1;
|
|
270387
|
+
(function (exports) {
|
|
270388
|
+
|
|
270389
|
+
/**
|
|
270390
|
+
* A minimal path module to resolve Unix, Windows and URL paths alike.
|
|
270391
|
+
* @memberof util
|
|
270392
|
+
* @namespace
|
|
270393
|
+
*/
|
|
270394
|
+
var path = exports;
|
|
270395
|
+
|
|
270396
|
+
var isAbsolute =
|
|
270397
|
+
/**
|
|
270398
|
+
* Tests if the specified path is absolute.
|
|
270399
|
+
* @param {string} path Path to test
|
|
270400
|
+
* @returns {boolean} `true` if path is absolute
|
|
270401
|
+
*/
|
|
270402
|
+
path.isAbsolute = function isAbsolute(path) {
|
|
270403
|
+
return /^(?:\/|\w+:|\\\\\w+)/.test(path);
|
|
270404
|
+
};
|
|
270405
|
+
|
|
270406
|
+
var normalize =
|
|
270407
|
+
/**
|
|
270408
|
+
* Normalizes the specified path.
|
|
270409
|
+
* @param {string} path Path to normalize
|
|
270410
|
+
* @returns {string} Normalized path
|
|
270411
|
+
*/
|
|
270412
|
+
path.normalize = function normalize(path) {
|
|
270413
|
+
var firstTwoCharacters = path.substring(0,2);
|
|
270414
|
+
var uncPrefix = "";
|
|
270415
|
+
if (firstTwoCharacters === "\\\\") {
|
|
270416
|
+
uncPrefix = firstTwoCharacters;
|
|
270417
|
+
path = path.substring(2);
|
|
270418
|
+
}
|
|
270419
|
+
|
|
270420
|
+
path = path.replace(/\\/g, "/")
|
|
270421
|
+
.replace(/\/{2,}/g, "/");
|
|
270422
|
+
var parts = path.split("/"),
|
|
270423
|
+
absolute = isAbsolute(path),
|
|
270424
|
+
prefix = "";
|
|
270425
|
+
if (absolute)
|
|
270426
|
+
prefix = parts.shift() + "/";
|
|
270427
|
+
for (var i = 0; i < parts.length;) {
|
|
270428
|
+
if (parts[i] === "..") {
|
|
270429
|
+
if (i > 0 && parts[i - 1] !== "..")
|
|
270430
|
+
parts.splice(--i, 2);
|
|
270431
|
+
else if (absolute)
|
|
270432
|
+
parts.splice(i, 1);
|
|
270433
|
+
else
|
|
270434
|
+
++i;
|
|
270435
|
+
} else if (parts[i] === ".")
|
|
270436
|
+
parts.splice(i, 1);
|
|
270437
|
+
else
|
|
270438
|
+
++i;
|
|
270439
|
+
}
|
|
270440
|
+
return uncPrefix + prefix + parts.join("/");
|
|
270441
|
+
};
|
|
270442
|
+
|
|
270443
|
+
/**
|
|
270444
|
+
* Resolves the specified include path against the specified origin path.
|
|
270445
|
+
* @param {string} originPath Path to the origin file
|
|
270446
|
+
* @param {string} includePath Include path relative to origin path
|
|
270447
|
+
* @param {boolean} [alreadyNormalized=false] `true` if both paths are already known to be normalized
|
|
270448
|
+
* @returns {string} Path to the include file
|
|
270449
|
+
*/
|
|
270450
|
+
path.resolve = function resolve(originPath, includePath, alreadyNormalized) {
|
|
270451
|
+
if (!alreadyNormalized)
|
|
270452
|
+
includePath = normalize(includePath);
|
|
270453
|
+
if (isAbsolute(includePath))
|
|
270454
|
+
return includePath;
|
|
270455
|
+
if (!alreadyNormalized)
|
|
270456
|
+
originPath = normalize(originPath);
|
|
270457
|
+
return (originPath = originPath.replace(/(?:\/|^)[^/]+$/, "")).length ? normalize(originPath + "/" + includePath) : includePath;
|
|
270458
|
+
};
|
|
270459
|
+
} (path));
|
|
270460
|
+
return path;
|
|
270461
|
+
}
|
|
270410
270462
|
|
|
270411
270463
|
var namespace;
|
|
270412
270464
|
var hasRequiredNamespace;
|
|
@@ -273574,10 +273626,10 @@ function requireUtil () {
|
|
|
273574
273626
|
var Type, // cyclic
|
|
273575
273627
|
Enum;
|
|
273576
273628
|
|
|
273577
|
-
util.codegen =
|
|
273578
|
-
util.fetch =
|
|
273579
|
-
util.path =
|
|
273580
|
-
util.patterns =
|
|
273629
|
+
util.codegen = requireCodegen();
|
|
273630
|
+
util.fetch = requireFetch();
|
|
273631
|
+
util.path = requirePath();
|
|
273632
|
+
util.patterns = requirePatterns();
|
|
273581
273633
|
|
|
273582
273634
|
var reservedRe = util.patterns.reservedRe,
|
|
273583
273635
|
unsafePropertyRe = util.patterns.unsafePropertyRe;
|
|
@@ -273586,7 +273638,7 @@ function requireUtil () {
|
|
|
273586
273638
|
* Node's fs module if available.
|
|
273587
273639
|
* @type {Object.<string,*>}
|
|
273588
273640
|
*/
|
|
273589
|
-
util.fs =
|
|
273641
|
+
util.fs = requireFs();
|
|
273590
273642
|
|
|
273591
273643
|
/**
|
|
273592
273644
|
* Converts an object's values to an array.
|
|
@@ -283299,10 +283351,32 @@ class DanmaClient extends EventEmitter$l.EventEmitter {
|
|
|
283299
283351
|
};
|
|
283300
283352
|
this.emit("Message", gift);
|
|
283301
283353
|
},
|
|
283354
|
+
raw: {
|
|
283355
|
+
SEND_GIFT_V2: (data) => {
|
|
283356
|
+
const msg = data.data;
|
|
283357
|
+
const timestamp = this.useServerTimestamp ? msg.timestamp * 1000 : Date.now();
|
|
283358
|
+
const gift = {
|
|
283359
|
+
type: "give_gift",
|
|
283360
|
+
timestamp: timestamp,
|
|
283361
|
+
name: msg.gift_name,
|
|
283362
|
+
count: msg.num,
|
|
283363
|
+
price: msg.coin_type === "silver" ? 0 : msg.price / 1000,
|
|
283364
|
+
sender: {
|
|
283365
|
+
uid: String(msg.uid),
|
|
283366
|
+
name: msg.uname,
|
|
283367
|
+
avatar: msg.face,
|
|
283368
|
+
},
|
|
283369
|
+
};
|
|
283370
|
+
this.emit("Message", gift);
|
|
283371
|
+
},
|
|
283372
|
+
},
|
|
283302
283373
|
onGift: (msg) => {
|
|
283374
|
+
// 由于兼容性0.5.6-beta.1,与上游存在冲突
|
|
283375
|
+
if (msg.type === "SEND_GIFT_V2")
|
|
283376
|
+
return;
|
|
283303
283377
|
let timestamp = this.useServerTimestamp ? msg?.raw?.data?.timestamp * 1000 : Date.now();
|
|
283304
283378
|
if (msg.type === "SEND_GIFT_V2") {
|
|
283305
|
-
timestamp = this.useServerTimestamp ? msg.timestamp : Date.now();
|
|
283379
|
+
timestamp = this.useServerTimestamp ? msg.timestamp * 1000 : Date.now();
|
|
283306
283380
|
}
|
|
283307
283381
|
const gift = {
|
|
283308
283382
|
type: "give_gift",
|
|
@@ -285857,12 +285931,12 @@ const qualityList$1 = [
|
|
|
285857
285931
|
desc: "真原画",
|
|
285858
285932
|
},
|
|
285859
285933
|
];
|
|
285860
|
-
let cookieCache;
|
|
285934
|
+
let cookieCache$1;
|
|
285861
285935
|
const getCookie$1 = async () => {
|
|
285862
285936
|
const now = new Date().getTime();
|
|
285863
285937
|
// 缓存6小时
|
|
285864
|
-
if (cookieCache?.startTimestamp && now - cookieCache.startTimestamp < 6 * 60 * 60 * 1000) {
|
|
285865
|
-
return cookieCache.cookies;
|
|
285938
|
+
if (cookieCache$1?.startTimestamp && now - cookieCache$1.startTimestamp < 6 * 60 * 60 * 1000) {
|
|
285939
|
+
return cookieCache$1.cookies;
|
|
285866
285940
|
}
|
|
285867
285941
|
const res = await requester.get("https://live.douyin.com/");
|
|
285868
285942
|
if (!res.headers["set-cookie"]) {
|
|
@@ -285875,12 +285949,12 @@ const getCookie$1 = async () => {
|
|
|
285875
285949
|
.join("; ");
|
|
285876
285950
|
if (!cookies.includes("ttwid")) {
|
|
285877
285951
|
// 如果不含ttwid,且已经存在含ttwid的cookie,将缓存时间直接增加1小时,复用之前的参数
|
|
285878
|
-
if (cookieCache?.cookies) {
|
|
285879
|
-
cookieCache.startTimestamp += 60 * 60 * 1000; // 增加1小时
|
|
285880
|
-
return cookieCache.cookies;
|
|
285952
|
+
if (cookieCache$1?.cookies) {
|
|
285953
|
+
cookieCache$1.startTimestamp += 60 * 60 * 1000; // 增加1小时
|
|
285954
|
+
return cookieCache$1.cookies;
|
|
285881
285955
|
}
|
|
285882
285956
|
}
|
|
285883
|
-
cookieCache = {
|
|
285957
|
+
cookieCache$1 = {
|
|
285884
285958
|
startTimestamp: now,
|
|
285885
285959
|
cookies,
|
|
285886
285960
|
};
|
|
@@ -317841,7 +317915,14 @@ const $root = minimal.roots["default"] || (minimal.roots["default"] = {});
|
|
|
317841
317915
|
return douyin;
|
|
317842
317916
|
})());
|
|
317843
317917
|
|
|
317918
|
+
let cookieCache;
|
|
317844
317919
|
const getCookie = async () => {
|
|
317920
|
+
const now = new Date().getTime();
|
|
317921
|
+
// 缓存1小时:重连时优先复用,避免每次连接都依赖实时网络抓取,
|
|
317922
|
+
// 瞬时网络抖动时不会导致 connect() 失败、重试链断裂
|
|
317923
|
+
if (cookieCache?.startTimestamp && now - cookieCache.startTimestamp < 60 * 60 * 1000) {
|
|
317924
|
+
return cookieCache.cookies;
|
|
317925
|
+
}
|
|
317845
317926
|
const res = await fetch("https://live.douyin.com/", {
|
|
317846
317927
|
method: "GET",
|
|
317847
317928
|
});
|
|
@@ -317854,6 +317935,17 @@ const getCookie = async () => {
|
|
|
317854
317935
|
return cookie.split(";")[0];
|
|
317855
317936
|
})
|
|
317856
317937
|
.join("; ");
|
|
317938
|
+
if (!cookies.includes("ttwid")) {
|
|
317939
|
+
// 新cookie不含ttwid,且缓存中有含ttwid的旧cookie时,延长旧缓存继续复用
|
|
317940
|
+
if (cookieCache?.cookies) {
|
|
317941
|
+
cookieCache.startTimestamp += 60 * 60 * 1000;
|
|
317942
|
+
return cookieCache.cookies;
|
|
317943
|
+
}
|
|
317944
|
+
}
|
|
317945
|
+
cookieCache = {
|
|
317946
|
+
startTimestamp: now,
|
|
317947
|
+
cookies,
|
|
317948
|
+
};
|
|
317857
317949
|
return cookies;
|
|
317858
317950
|
};
|
|
317859
317951
|
|
|
@@ -317891,39 +317983,46 @@ class DouYinDanmaClient extends TypedEmitter {
|
|
|
317891
317983
|
}
|
|
317892
317984
|
}
|
|
317893
317985
|
async connect() {
|
|
317894
|
-
|
|
317895
|
-
|
|
317896
|
-
|
|
317897
|
-
|
|
317986
|
+
try {
|
|
317987
|
+
const url = await this.getWsInfo(this.roomId);
|
|
317988
|
+
if (!url) {
|
|
317989
|
+
throw new Error("获取抖音弹幕签名失败");
|
|
317990
|
+
}
|
|
317991
|
+
this.emit("init", url);
|
|
317992
|
+
const cookies = this.cookie || (await getCookie());
|
|
317993
|
+
this.ws = new WebSocket$7(url, {
|
|
317994
|
+
headers: {
|
|
317995
|
+
Cookie: cookies,
|
|
317996
|
+
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36",
|
|
317997
|
+
Origin: "https://live.douyin.com",
|
|
317998
|
+
Referer: "https://live.douyin.com/",
|
|
317999
|
+
},
|
|
318000
|
+
});
|
|
318001
|
+
this.ws.on("open", () => {
|
|
318002
|
+
this.emit("open");
|
|
318003
|
+
this.startHeartbeat();
|
|
318004
|
+
this.startTimeoutCheck();
|
|
318005
|
+
});
|
|
318006
|
+
this.ws.on("message", (data) => {
|
|
318007
|
+
this.lastMessageTime = Date.now();
|
|
318008
|
+
this.decode(data);
|
|
318009
|
+
});
|
|
318010
|
+
this.ws.on("close", () => {
|
|
318011
|
+
this.emit("close");
|
|
318012
|
+
this.reconnect();
|
|
318013
|
+
});
|
|
318014
|
+
this.ws.on("error", (error) => {
|
|
318015
|
+
this.emit("error", error);
|
|
318016
|
+
this.reconnect();
|
|
318017
|
+
});
|
|
317898
318018
|
}
|
|
317899
|
-
|
|
317900
|
-
|
|
317901
|
-
|
|
317902
|
-
|
|
317903
|
-
|
|
317904
|
-
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36",
|
|
317905
|
-
Origin: "https://live.douyin.com",
|
|
317906
|
-
Referer: "https://live.douyin.com/",
|
|
317907
|
-
},
|
|
317908
|
-
});
|
|
317909
|
-
this.ws.on("open", () => {
|
|
317910
|
-
this.reconnectAttempts = 0;
|
|
317911
|
-
this.emit("open");
|
|
317912
|
-
this.startHeartbeat();
|
|
317913
|
-
this.startTimeoutCheck();
|
|
317914
|
-
});
|
|
317915
|
-
this.ws.on("message", (data) => {
|
|
317916
|
-
this.lastMessageTime = Date.now();
|
|
317917
|
-
this.decode(data);
|
|
317918
|
-
});
|
|
317919
|
-
this.ws.on("close", () => {
|
|
317920
|
-
this.emit("close");
|
|
317921
|
-
this.reconnect();
|
|
317922
|
-
});
|
|
317923
|
-
this.ws.on("error", (error) => {
|
|
317924
|
-
this.emit("error", error);
|
|
318019
|
+
catch (err) {
|
|
318020
|
+
// getWsInfo/getCookie 等前置步骤失败时,必须让错误可见并继续重试:
|
|
318021
|
+
// 否则 WebSocket 不会创建,没有任何事件能触发下一次 reconnect,
|
|
318022
|
+
// 弹幕客户端将静默死亡直到录制结束
|
|
318023
|
+
this.emit("error", err);
|
|
317925
318024
|
this.reconnect();
|
|
317926
|
-
}
|
|
318025
|
+
}
|
|
317927
318026
|
}
|
|
317928
318027
|
send(data) {
|
|
317929
318028
|
if (!this.ws) {
|
|
@@ -318263,6 +318362,7 @@ function createRecorder$2(opts) {
|
|
|
318263
318362
|
availableSources: [],
|
|
318264
318363
|
qualityRetry: opts.qualityRetry ?? 0,
|
|
318265
318364
|
useServerTimestamp: opts.useServerTimestamp ?? true,
|
|
318365
|
+
cookieMode: opts.cookieMode ?? "all",
|
|
318266
318366
|
state: "idle",
|
|
318267
318367
|
cache: null,
|
|
318268
318368
|
appendTimeline: null,
|
|
@@ -318276,7 +318376,7 @@ function createRecorder$2(opts) {
|
|
|
318276
318376
|
async getLiveInfo() {
|
|
318277
318377
|
const channelId = this.channelId;
|
|
318278
318378
|
const info = await getInfo$2(channelId, {
|
|
318279
|
-
auth: this.auth,
|
|
318379
|
+
auth: this.cookieMode === "danma" ? undefined : this.auth,
|
|
318280
318380
|
uid: this.uid,
|
|
318281
318381
|
});
|
|
318282
318382
|
return {
|
|
@@ -318291,7 +318391,7 @@ function createRecorder$2(opts) {
|
|
|
318291
318391
|
streamPriorities: this.streamPriorities,
|
|
318292
318392
|
sourcePriorities: this.sourcePriorities,
|
|
318293
318393
|
strictQuality: false,
|
|
318294
|
-
auth: this.auth,
|
|
318394
|
+
auth: this.cookieMode === "danma" ? undefined : this.auth,
|
|
318295
318395
|
formatPriorities: this.formatPriorities,
|
|
318296
318396
|
doubleScreen: this.doubleScreen,
|
|
318297
318397
|
api: this.api,
|
|
@@ -318317,7 +318417,7 @@ const checkLiveStatusAndRecord$2 = async function ({ getSavePath, banLiveId, isM
|
|
|
318317
318417
|
// 如果已经在录制中,只在需要检查标题关键词时才获取最新信息
|
|
318318
318418
|
if (this.recordHandle != null) {
|
|
318319
318419
|
const shouldStop = await utils$3.checkTitleKeywordsWhileRecording(this, isManualStart, (channelId) => getInfo$2(channelId, {
|
|
318320
|
-
auth: this.auth,
|
|
318420
|
+
auth: this.cookieMode === "danma" ? undefined : this.auth,
|
|
318321
318421
|
api: this.api,
|
|
318322
318422
|
uid: this.uid,
|
|
318323
318423
|
}));
|
|
@@ -318331,7 +318431,7 @@ const checkLiveStatusAndRecord$2 = async function ({ getSavePath, banLiveId, isM
|
|
|
318331
318431
|
let isLiveRadio = false;
|
|
318332
318432
|
try {
|
|
318333
318433
|
const liveInfo = await getInfo$2(this.channelId, {
|
|
318334
|
-
auth: this.auth,
|
|
318434
|
+
auth: this.cookieMode === "danma" ? undefined : this.auth,
|
|
318335
318435
|
api: this.api,
|
|
318336
318436
|
uid: this.uid,
|
|
318337
318437
|
});
|
|
@@ -318369,7 +318469,7 @@ const checkLiveStatusAndRecord$2 = async function ({ getSavePath, banLiveId, isM
|
|
|
318369
318469
|
streamPriorities: this.streamPriorities,
|
|
318370
318470
|
sourcePriorities: this.sourcePriorities,
|
|
318371
318471
|
strictQuality: strictQuality,
|
|
318372
|
-
auth: this.auth,
|
|
318472
|
+
auth: this.cookieMode === "danma" ? undefined : this.auth,
|
|
318373
318473
|
formatPriorities: this.formatPriorities,
|
|
318374
318474
|
doubleScreen: this.doubleScreen,
|
|
318375
318475
|
api: this.api,
|
|
@@ -318440,7 +318540,7 @@ const checkLiveStatusAndRecord$2 = async function ({ getSavePath, banLiveId, isM
|
|
|
318440
318540
|
proxy: this.proxy,
|
|
318441
318541
|
}, onEnd, async () => {
|
|
318442
318542
|
const info = await getInfo$2(this.channelId, {
|
|
318443
|
-
auth: this.auth,
|
|
318543
|
+
auth: this.cookieMode === "danma" ? undefined : this.auth,
|
|
318444
318544
|
});
|
|
318445
318545
|
return info;
|
|
318446
318546
|
});
|
|
@@ -318480,8 +318580,9 @@ const checkLiveStatusAndRecord$2 = async function ({ getSavePath, banLiveId, isM
|
|
|
318480
318580
|
// 礼物延迟处理时间(毫秒),可根据实际情况调整
|
|
318481
318581
|
const GIFT_DELAY = 5000;
|
|
318482
318582
|
const client = new DouYinDanmaClient(this?.liveInfo?.liveId, {
|
|
318483
|
-
cookie: this.auth,
|
|
318583
|
+
cookie: this.cookieMode === "stream" ? undefined : this.auth,
|
|
318484
318584
|
});
|
|
318585
|
+
console.log("DouYinDanmaClient", this?.liveInfo?.liveId, this.cookieMode, this.auth);
|
|
318485
318586
|
client.on("chat", (msg) => {
|
|
318486
318587
|
const extraDataController = downloader.getExtraDataController();
|
|
318487
318588
|
if (!extraDataController)
|
|
@@ -382118,6 +382219,11 @@ class RecorderConfig {
|
|
|
382118
382219
|
return get$1(globalConfig, "tiktok.cookie");
|
|
382119
382220
|
}
|
|
382120
382221
|
}
|
|
382222
|
+
else if (key === "cookieMode") {
|
|
382223
|
+
if (setting.providerId === "DouYin") {
|
|
382224
|
+
return get$1(globalConfig, "douyin.cookieMode");
|
|
382225
|
+
}
|
|
382226
|
+
}
|
|
382121
382227
|
else if (key === "doubleScreen") {
|
|
382122
382228
|
if (setting.providerId === "DouYin") {
|
|
382123
382229
|
return get$1(globalConfig, "douyin.doubleScreen");
|
|
@@ -382265,6 +382371,7 @@ class RecorderConfig {
|
|
|
382265
382371
|
debugLevel: getValue("debugLevel") ?? "none",
|
|
382266
382372
|
recorderType: getValue("recorderType") ?? "ffmpeg",
|
|
382267
382373
|
auth: auth,
|
|
382374
|
+
cookieMode: getValue("cookieMode") ?? "all",
|
|
382268
382375
|
useM3U8Proxy: getValue("useM3U8Proxy") ?? false,
|
|
382269
382376
|
customHost: getValue("customHost"),
|
|
382270
382377
|
segmentOnTitleChange: getValue("segmentOnTitleChange") ?? false,
|
|
@@ -382433,7 +382540,7 @@ async function sendEndLiveNotification(appConfig, recorder, config) {
|
|
|
382433
382540
|
}
|
|
382434
382541
|
async function convert2Mp4(videoFile) {
|
|
382435
382542
|
const output = replaceExtName$1(videoFile, ".mp4");
|
|
382436
|
-
if (await fs$
|
|
382543
|
+
if (await fs$k.pathExists(output)) {
|
|
382437
382544
|
throw new Error(`目标文件已存在: ${output}`);
|
|
382438
382545
|
}
|
|
382439
382546
|
const name = path$z.basename(output);
|
|
@@ -382587,7 +382694,7 @@ async function createRecorderManager(appConfig) {
|
|
|
382587
382694
|
return;
|
|
382588
382695
|
if (recorder.recordHandle) {
|
|
382589
382696
|
const logFilePath = utils$3.replaceExtName(`${recorder.recordHandle.savePath}_${recorder.id}`, ".recorder.log");
|
|
382590
|
-
fs$
|
|
382697
|
+
fs$k.appendFile(logFilePath, log.text + "\n").catch(() => { });
|
|
382591
382698
|
return;
|
|
382592
382699
|
}
|
|
382593
382700
|
else {
|
|
@@ -382737,7 +382844,7 @@ async function createRecorderManager(appConfig) {
|
|
|
382737
382844
|
danma_stats_json: JSON.stringify(stats.danmaStats),
|
|
382738
382845
|
});
|
|
382739
382846
|
}
|
|
382740
|
-
else if (xmlFile && (await fs$
|
|
382847
|
+
else if (xmlFile && (await fs$k.pathExists(xmlFile))) {
|
|
382741
382848
|
const { uniqMember, danmaNum } = await danmaReport(xmlFile);
|
|
382742
382849
|
recordHistory.upadteLive({
|
|
382743
382850
|
video_file: filename,
|
|
@@ -382750,7 +382857,7 @@ async function createRecorderManager(appConfig) {
|
|
|
382750
382857
|
if (data?.convert2Mp4) {
|
|
382751
382858
|
try {
|
|
382752
382859
|
await convert2Mp4(filename);
|
|
382753
|
-
await fs$
|
|
382860
|
+
await fs$k.unlink(filename);
|
|
382754
382861
|
logObj.info("转换 mp4 成功,已删除原文件", { filename });
|
|
382755
382862
|
}
|
|
382756
382863
|
catch (error) {
|
|
@@ -382822,7 +382929,7 @@ async function createRecorderManager(appConfig) {
|
|
|
382822
382929
|
}
|
|
382823
382930
|
}
|
|
382824
382931
|
const xmlFile = replaceExtName$1(filename, ".xml");
|
|
382825
|
-
if (config.recorder.saveDanma2DB && xmlFile && (await fs$
|
|
382932
|
+
if (config.recorder.saveDanma2DB && xmlFile && (await fs$k.pathExists(xmlFile))) {
|
|
382826
382933
|
const history = recordHistory.getRecord({
|
|
382827
382934
|
file: filename,
|
|
382828
382935
|
live_id: liveId,
|
|
@@ -383035,7 +383142,7 @@ const checkDiskSpaceLoop = async () => {
|
|
|
383035
383142
|
const threshold = config?.notification?.task?.diskSpaceCheck?.threshold ?? 10;
|
|
383036
383143
|
if (config?.notification?.task?.diskSpaceCheck?.values?.includes("bilirecorder")) {
|
|
383037
383144
|
if (config?.webhook?.recoderFolder &&
|
|
383038
|
-
(await fs$
|
|
383145
|
+
(await fs$k.pathExists(config?.webhook?.recoderFolder))) {
|
|
383039
383146
|
// @ts-ignore
|
|
383040
383147
|
const diskInfo = await checkDiskSpace(config?.webhook?.recoderFolder);
|
|
383041
383148
|
if (diskInfo.free < threshold * 1024 * 1024 * 1024) {
|
|
@@ -383054,7 +383161,7 @@ const checkDiskSpaceLoop = async () => {
|
|
|
383054
383161
|
}
|
|
383055
383162
|
}
|
|
383056
383163
|
if (config?.notification?.task?.diskSpaceCheck?.values?.includes("bililiveTools")) {
|
|
383057
|
-
if (config?.recorder?.savePath && (await fs$
|
|
383164
|
+
if (config?.recorder?.savePath && (await fs$k.pathExists(config?.recorder?.savePath))) {
|
|
383058
383165
|
// @ts-ignore
|
|
383059
383166
|
const diskInfo = await checkDiskSpace(config?.recorder?.savePath);
|
|
383060
383167
|
if (diskInfo.free < threshold * 1024 * 1024 * 1024) {
|
|
@@ -383139,12 +383246,12 @@ exports.esDefineProperty = esDefineProperty;
|
|
|
383139
383246
|
exports.escaped = escaped;
|
|
383140
383247
|
exports.executeVirtualRecordConfig = executeVirtualRecordConfig;
|
|
383141
383248
|
exports.extension = extension$4;
|
|
383142
|
-
exports.fetch = fetch$
|
|
383249
|
+
exports.fetch = fetch$1;
|
|
383143
383250
|
exports.formatDesc = formatDesc;
|
|
383144
383251
|
exports.formatPartTitle = formatPartTitle;
|
|
383145
383252
|
exports.formatSeasonTitle = formatSeasonTitle;
|
|
383146
383253
|
exports.formatTitle = formatTitle;
|
|
383147
|
-
exports.fs = fs$
|
|
383254
|
+
exports.fs = fs$k;
|
|
383148
383255
|
exports.functionBind = functionBind;
|
|
383149
383256
|
exports.genTimeData = genTimeData;
|
|
383150
383257
|
exports.getBinPath = getBinPath;
|