bililive-cli 3.15.0 → 3.16.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/fileFromPath-C9aolqJz.cjs +171 -0
- package/lib/{index-EjlRQsb6.cjs → index-BUEtH4Dz.cjs} +809 -209
- package/lib/{index-Czq88XrK.cjs → index-Bn38UlXg.cjs} +12829 -16584
- package/lib/index.cjs +3 -3
- package/lib/{linux-r1Tjy8Ff.cjs → linux-9g8WByl9.cjs} +3 -3
- package/package.json +4 -4
- package/lib/index-Dkt7D2TB.cjs +0 -47
|
@@ -16,29 +16,29 @@ var os$5 = require('node:os');
|
|
|
16
16
|
var path$z = require('node:path');
|
|
17
17
|
var process$2 = require('node:process');
|
|
18
18
|
var require$$3$1 = require('node:util');
|
|
19
|
+
var EventEmitter$k = require('node:events');
|
|
20
|
+
var fs$F = require('node:fs');
|
|
21
|
+
var require$$0$b = require('node:stream');
|
|
19
22
|
var Database = require('better-sqlite3');
|
|
20
23
|
var require$$3$2 = require('http');
|
|
21
24
|
var require$$1$4 = require('https');
|
|
22
25
|
var require$$1$5 = require('crypto');
|
|
23
26
|
var http2$1 = require('http2');
|
|
24
|
-
var require$$0$
|
|
27
|
+
var require$$0$c = require('tty');
|
|
25
28
|
var zlib$3 = require('zlib');
|
|
26
|
-
var require$$0$
|
|
27
|
-
var EventEmitter$k = require('node:events');
|
|
29
|
+
var require$$0$d = require('child_process');
|
|
28
30
|
var ntsuspend = require('ntsuspend');
|
|
29
31
|
var readline = require('node:readline');
|
|
30
32
|
var crypto$c = require('node:crypto');
|
|
31
|
-
var fs$F = require('node:fs');
|
|
32
33
|
var a$1 = require('node:https');
|
|
33
34
|
var require$$1$6 = require('node:url');
|
|
34
|
-
var require$$0$
|
|
35
|
+
var require$$0$e = require('net');
|
|
35
36
|
var require$$2 = require('node:http');
|
|
36
37
|
var require$$4 = require('dns');
|
|
37
38
|
var require$$1$7 = require('tls');
|
|
38
|
-
var require$$0$
|
|
39
|
+
var require$$0$f = require('punycode');
|
|
39
40
|
var canvas = require('@napi-rs/canvas');
|
|
40
|
-
var require$$0$
|
|
41
|
-
var require$$0$g = require('node:stream');
|
|
41
|
+
var require$$0$g = require('vm');
|
|
42
42
|
var promises = require('node:stream/promises');
|
|
43
43
|
var fs$G = require('fs/promises');
|
|
44
44
|
var require$$0$h = require('node:assert');
|
|
@@ -2319,7 +2319,7 @@ async function _writeFile (file, obj, options = {}) {
|
|
|
2319
2319
|
await universalify.fromCallback(fs.writeFile)(file, str, options);
|
|
2320
2320
|
}
|
|
2321
2321
|
|
|
2322
|
-
const writeFile$
|
|
2322
|
+
const writeFile$2 = universalify.fromPromise(_writeFile);
|
|
2323
2323
|
|
|
2324
2324
|
function writeFileSync (file, obj, options = {}) {
|
|
2325
2325
|
const fs = options.fs || _fs;
|
|
@@ -2332,7 +2332,7 @@ function writeFileSync (file, obj, options = {}) {
|
|
|
2332
2332
|
const jsonfile$1 = {
|
|
2333
2333
|
readFile: readFile$1,
|
|
2334
2334
|
readFileSync,
|
|
2335
|
-
writeFile: writeFile$
|
|
2335
|
+
writeFile: writeFile$2,
|
|
2336
2336
|
writeFileSync
|
|
2337
2337
|
};
|
|
2338
2338
|
|
|
@@ -7223,10 +7223,10 @@ var string$2 = {};
|
|
|
7223
7223
|
|
|
7224
7224
|
Object.defineProperty(string$2, "__esModule", { value: true });
|
|
7225
7225
|
string$2.isEmpty = string$2.isString = void 0;
|
|
7226
|
-
function isString$
|
|
7226
|
+
function isString$4(input) {
|
|
7227
7227
|
return typeof input === 'string';
|
|
7228
7228
|
}
|
|
7229
|
-
string$2.isString = isString$
|
|
7229
|
+
string$2.isString = isString$4;
|
|
7230
7230
|
function isEmpty$1(input) {
|
|
7231
7231
|
return input === '';
|
|
7232
7232
|
}
|
|
@@ -11219,6 +11219,462 @@ function checkDiskSpace(directoryPath, dependencies = {
|
|
|
11219
11219
|
return checkUnix(directoryPath);
|
|
11220
11220
|
}
|
|
11221
11221
|
|
|
11222
|
+
/* IMPORT */
|
|
11223
|
+
/* MAIN */
|
|
11224
|
+
const attemptifyAsync = (fn, options) => {
|
|
11225
|
+
const { onError } = options;
|
|
11226
|
+
return function attemptified(...args) {
|
|
11227
|
+
return fn.apply(undefined, args).catch(onError);
|
|
11228
|
+
}; //TSC
|
|
11229
|
+
};
|
|
11230
|
+
|
|
11231
|
+
/* IMPORT */
|
|
11232
|
+
/* MAIN */
|
|
11233
|
+
const attemptifySync = (fn, options) => {
|
|
11234
|
+
const { onError } = options;
|
|
11235
|
+
return function attemptified(...args) {
|
|
11236
|
+
try {
|
|
11237
|
+
return fn.apply(undefined, args);
|
|
11238
|
+
}
|
|
11239
|
+
catch (error) {
|
|
11240
|
+
return onError(error);
|
|
11241
|
+
}
|
|
11242
|
+
}; //TSC
|
|
11243
|
+
};
|
|
11244
|
+
|
|
11245
|
+
/* MAIN */
|
|
11246
|
+
const RETRY_INTERVAL = 250;
|
|
11247
|
+
|
|
11248
|
+
/* IMPORT */
|
|
11249
|
+
/* MAIN */
|
|
11250
|
+
const retryifyAsync = (fn, options) => {
|
|
11251
|
+
const { isRetriable } = options;
|
|
11252
|
+
return function retryified(options) {
|
|
11253
|
+
const { timeout } = options;
|
|
11254
|
+
const interval = options.interval ?? RETRY_INTERVAL;
|
|
11255
|
+
const timestamp = Date.now() + timeout;
|
|
11256
|
+
return function attempt(...args) {
|
|
11257
|
+
return fn.apply(undefined, args).catch((error) => {
|
|
11258
|
+
if (!isRetriable(error))
|
|
11259
|
+
throw error;
|
|
11260
|
+
if (Date.now() >= timestamp)
|
|
11261
|
+
throw error;
|
|
11262
|
+
const delay = Math.round(interval * Math.random());
|
|
11263
|
+
if (delay > 0) {
|
|
11264
|
+
const delayPromise = new Promise(resolve => setTimeout(resolve, delay));
|
|
11265
|
+
return delayPromise.then(() => attempt.apply(undefined, args));
|
|
11266
|
+
}
|
|
11267
|
+
else {
|
|
11268
|
+
return attempt.apply(undefined, args);
|
|
11269
|
+
}
|
|
11270
|
+
});
|
|
11271
|
+
}; //TSC
|
|
11272
|
+
};
|
|
11273
|
+
};
|
|
11274
|
+
|
|
11275
|
+
/* IMPORT */
|
|
11276
|
+
/* MAIN */
|
|
11277
|
+
const retryifySync = (fn, options) => {
|
|
11278
|
+
const { isRetriable } = options;
|
|
11279
|
+
return function retryified(options) {
|
|
11280
|
+
const { timeout } = options;
|
|
11281
|
+
const timestamp = Date.now() + timeout;
|
|
11282
|
+
return function attempt(...args) {
|
|
11283
|
+
while (true) {
|
|
11284
|
+
try {
|
|
11285
|
+
return fn.apply(undefined, args);
|
|
11286
|
+
}
|
|
11287
|
+
catch (error) {
|
|
11288
|
+
if (!isRetriable(error))
|
|
11289
|
+
throw error;
|
|
11290
|
+
if (Date.now() >= timestamp)
|
|
11291
|
+
throw error;
|
|
11292
|
+
continue;
|
|
11293
|
+
}
|
|
11294
|
+
}
|
|
11295
|
+
}; //TSC
|
|
11296
|
+
};
|
|
11297
|
+
};
|
|
11298
|
+
|
|
11299
|
+
/* IMPORT */
|
|
11300
|
+
/* MAIN */
|
|
11301
|
+
const Handlers = {
|
|
11302
|
+
/* API */
|
|
11303
|
+
isChangeErrorOk: (error) => {
|
|
11304
|
+
if (!Handlers.isNodeError(error))
|
|
11305
|
+
return false;
|
|
11306
|
+
const { code } = error;
|
|
11307
|
+
if (code === 'ENOSYS')
|
|
11308
|
+
return true;
|
|
11309
|
+
if (!IS_USER_ROOT && (code === 'EINVAL' || code === 'EPERM'))
|
|
11310
|
+
return true;
|
|
11311
|
+
return false;
|
|
11312
|
+
},
|
|
11313
|
+
isNodeError: (error) => {
|
|
11314
|
+
return (error instanceof Error);
|
|
11315
|
+
},
|
|
11316
|
+
isRetriableError: (error) => {
|
|
11317
|
+
if (!Handlers.isNodeError(error))
|
|
11318
|
+
return false;
|
|
11319
|
+
const { code } = error;
|
|
11320
|
+
if (code === 'EMFILE' || code === 'ENFILE' || code === 'EAGAIN' || code === 'EBUSY' || code === 'EACCESS' || code === 'EACCES' || code === 'EACCS' || code === 'EPERM')
|
|
11321
|
+
return true;
|
|
11322
|
+
return false;
|
|
11323
|
+
},
|
|
11324
|
+
onChangeError: (error) => {
|
|
11325
|
+
if (!Handlers.isNodeError(error))
|
|
11326
|
+
throw error;
|
|
11327
|
+
if (Handlers.isChangeErrorOk(error))
|
|
11328
|
+
return;
|
|
11329
|
+
throw error;
|
|
11330
|
+
}
|
|
11331
|
+
};
|
|
11332
|
+
|
|
11333
|
+
/* IMPORT */
|
|
11334
|
+
/* MAIN */
|
|
11335
|
+
const ATTEMPTIFY_CHANGE_ERROR_OPTIONS = {
|
|
11336
|
+
onError: Handlers.onChangeError
|
|
11337
|
+
};
|
|
11338
|
+
const ATTEMPTIFY_NOOP_OPTIONS = {
|
|
11339
|
+
onError: () => undefined
|
|
11340
|
+
};
|
|
11341
|
+
const IS_USER_ROOT = (process$2.getuid ? !process$2.getuid() : false);
|
|
11342
|
+
const RETRYIFY_OPTIONS = {
|
|
11343
|
+
isRetriable: Handlers.isRetriableError
|
|
11344
|
+
};
|
|
11345
|
+
|
|
11346
|
+
/* IMPORT */
|
|
11347
|
+
/* MAIN */
|
|
11348
|
+
const FS = {
|
|
11349
|
+
attempt: {
|
|
11350
|
+
/* ASYNC */
|
|
11351
|
+
chmod: attemptifyAsync(require$$3$1.promisify(fs$F.chmod), ATTEMPTIFY_CHANGE_ERROR_OPTIONS),
|
|
11352
|
+
chown: attemptifyAsync(require$$3$1.promisify(fs$F.chown), ATTEMPTIFY_CHANGE_ERROR_OPTIONS),
|
|
11353
|
+
close: attemptifyAsync(require$$3$1.promisify(fs$F.close), ATTEMPTIFY_NOOP_OPTIONS),
|
|
11354
|
+
fsync: attemptifyAsync(require$$3$1.promisify(fs$F.fsync), ATTEMPTIFY_NOOP_OPTIONS),
|
|
11355
|
+
mkdir: attemptifyAsync(require$$3$1.promisify(fs$F.mkdir), ATTEMPTIFY_NOOP_OPTIONS),
|
|
11356
|
+
realpath: attemptifyAsync(require$$3$1.promisify(fs$F.realpath), ATTEMPTIFY_NOOP_OPTIONS),
|
|
11357
|
+
stat: attemptifyAsync(require$$3$1.promisify(fs$F.stat), ATTEMPTIFY_NOOP_OPTIONS),
|
|
11358
|
+
unlink: attemptifyAsync(require$$3$1.promisify(fs$F.unlink), ATTEMPTIFY_NOOP_OPTIONS),
|
|
11359
|
+
/* SYNC */
|
|
11360
|
+
chmodSync: attemptifySync(fs$F.chmodSync, ATTEMPTIFY_CHANGE_ERROR_OPTIONS),
|
|
11361
|
+
chownSync: attemptifySync(fs$F.chownSync, ATTEMPTIFY_CHANGE_ERROR_OPTIONS),
|
|
11362
|
+
closeSync: attemptifySync(fs$F.closeSync, ATTEMPTIFY_NOOP_OPTIONS),
|
|
11363
|
+
existsSync: attemptifySync(fs$F.existsSync, ATTEMPTIFY_NOOP_OPTIONS),
|
|
11364
|
+
fsyncSync: attemptifySync(fs$F.fsync, ATTEMPTIFY_NOOP_OPTIONS),
|
|
11365
|
+
mkdirSync: attemptifySync(fs$F.mkdirSync, ATTEMPTIFY_NOOP_OPTIONS),
|
|
11366
|
+
realpathSync: attemptifySync(fs$F.realpathSync, ATTEMPTIFY_NOOP_OPTIONS),
|
|
11367
|
+
statSync: attemptifySync(fs$F.statSync, ATTEMPTIFY_NOOP_OPTIONS),
|
|
11368
|
+
unlinkSync: attemptifySync(fs$F.unlinkSync, ATTEMPTIFY_NOOP_OPTIONS)
|
|
11369
|
+
},
|
|
11370
|
+
retry: {
|
|
11371
|
+
/* ASYNC */
|
|
11372
|
+
close: retryifyAsync(require$$3$1.promisify(fs$F.close), RETRYIFY_OPTIONS),
|
|
11373
|
+
fsync: retryifyAsync(require$$3$1.promisify(fs$F.fsync), RETRYIFY_OPTIONS),
|
|
11374
|
+
open: retryifyAsync(require$$3$1.promisify(fs$F.open), RETRYIFY_OPTIONS),
|
|
11375
|
+
readFile: retryifyAsync(require$$3$1.promisify(fs$F.readFile), RETRYIFY_OPTIONS),
|
|
11376
|
+
rename: retryifyAsync(require$$3$1.promisify(fs$F.rename), RETRYIFY_OPTIONS),
|
|
11377
|
+
stat: retryifyAsync(require$$3$1.promisify(fs$F.stat), RETRYIFY_OPTIONS),
|
|
11378
|
+
write: retryifyAsync(require$$3$1.promisify(fs$F.write), RETRYIFY_OPTIONS),
|
|
11379
|
+
writeFile: retryifyAsync(require$$3$1.promisify(fs$F.writeFile), RETRYIFY_OPTIONS),
|
|
11380
|
+
/* SYNC */
|
|
11381
|
+
closeSync: retryifySync(fs$F.closeSync, RETRYIFY_OPTIONS),
|
|
11382
|
+
fsyncSync: retryifySync(fs$F.fsyncSync, RETRYIFY_OPTIONS),
|
|
11383
|
+
openSync: retryifySync(fs$F.openSync, RETRYIFY_OPTIONS),
|
|
11384
|
+
readFileSync: retryifySync(fs$F.readFileSync, RETRYIFY_OPTIONS),
|
|
11385
|
+
renameSync: retryifySync(fs$F.renameSync, RETRYIFY_OPTIONS),
|
|
11386
|
+
statSync: retryifySync(fs$F.statSync, RETRYIFY_OPTIONS),
|
|
11387
|
+
writeSync: retryifySync(fs$F.writeSync, RETRYIFY_OPTIONS),
|
|
11388
|
+
writeFileSync: retryifySync(fs$F.writeFileSync, RETRYIFY_OPTIONS)
|
|
11389
|
+
}
|
|
11390
|
+
};
|
|
11391
|
+
|
|
11392
|
+
/* IMPORT */
|
|
11393
|
+
/* MAIN */
|
|
11394
|
+
const DEFAULT_ENCODING = 'utf8';
|
|
11395
|
+
const DEFAULT_FILE_MODE = 0o666;
|
|
11396
|
+
const DEFAULT_FOLDER_MODE = 0o777;
|
|
11397
|
+
const DEFAULT_WRITE_OPTIONS = {};
|
|
11398
|
+
const DEFAULT_USER_UID = process$2.geteuid ? process$2.geteuid() : -1;
|
|
11399
|
+
const DEFAULT_USER_GID = process$2.getegid ? process$2.getegid() : -1;
|
|
11400
|
+
const DEFAULT_INTERVAL_ASYNC = 200;
|
|
11401
|
+
const DEFAULT_TIMEOUT_ASYNC = 7500;
|
|
11402
|
+
const IS_POSIX = !!process$2.getuid;
|
|
11403
|
+
process$2.getuid ? !process$2.getuid() : false;
|
|
11404
|
+
const LIMIT_BASENAME_LENGTH = 128; //TODO: Fetch the real limit from the filesystem //TODO: Fetch the whole-path length limit too
|
|
11405
|
+
|
|
11406
|
+
/* IMPORT */
|
|
11407
|
+
/* MAIN */
|
|
11408
|
+
const isException = (value) => {
|
|
11409
|
+
return (value instanceof Error) && ('code' in value);
|
|
11410
|
+
};
|
|
11411
|
+
const isString$3 = (value) => {
|
|
11412
|
+
return (typeof value === 'string');
|
|
11413
|
+
};
|
|
11414
|
+
const isUndefined$1 = (value) => {
|
|
11415
|
+
return (value === undefined);
|
|
11416
|
+
};
|
|
11417
|
+
|
|
11418
|
+
/* IMPORT */
|
|
11419
|
+
/* HELPERS */
|
|
11420
|
+
const Queues = {};
|
|
11421
|
+
/* MAIN */
|
|
11422
|
+
//TODO: Maybe publish this as a standalone package
|
|
11423
|
+
const Scheduler = {
|
|
11424
|
+
/* API */
|
|
11425
|
+
next: (id) => {
|
|
11426
|
+
const queue = Queues[id];
|
|
11427
|
+
if (!queue)
|
|
11428
|
+
return;
|
|
11429
|
+
queue.shift();
|
|
11430
|
+
const job = queue[0];
|
|
11431
|
+
if (job) {
|
|
11432
|
+
job(() => Scheduler.next(id));
|
|
11433
|
+
}
|
|
11434
|
+
else {
|
|
11435
|
+
delete Queues[id];
|
|
11436
|
+
}
|
|
11437
|
+
},
|
|
11438
|
+
schedule: (id) => {
|
|
11439
|
+
return new Promise(resolve => {
|
|
11440
|
+
let queue = Queues[id];
|
|
11441
|
+
if (!queue)
|
|
11442
|
+
queue = Queues[id] = [];
|
|
11443
|
+
queue.push(resolve);
|
|
11444
|
+
if (queue.length > 1)
|
|
11445
|
+
return;
|
|
11446
|
+
resolve(() => Scheduler.next(id));
|
|
11447
|
+
});
|
|
11448
|
+
}
|
|
11449
|
+
};
|
|
11450
|
+
|
|
11451
|
+
/* IMPORT */
|
|
11452
|
+
/* MAIN */
|
|
11453
|
+
const IS_LINUX = (process$2.platform === 'linux');
|
|
11454
|
+
const IS_WINDOWS = (process$2.platform === 'win32');
|
|
11455
|
+
|
|
11456
|
+
/* IMPORT */
|
|
11457
|
+
/* MAIN */
|
|
11458
|
+
//URL: https://github.com/tapjs/signal-exit/blob/458776d9cf8be89712aa1f7b45bb2163ce15ef4a/src/signals.ts
|
|
11459
|
+
const Signals = ['SIGHUP', 'SIGINT', 'SIGTERM'];
|
|
11460
|
+
if (!IS_WINDOWS) {
|
|
11461
|
+
Signals.push('SIGALRM', 'SIGABRT', 'SIGVTALRM', 'SIGXCPU', 'SIGXFSZ', 'SIGUSR2', 'SIGTRAP', 'SIGSYS', 'SIGQUIT', 'SIGIOT');
|
|
11462
|
+
}
|
|
11463
|
+
if (IS_LINUX) {
|
|
11464
|
+
Signals.push('SIGIO', 'SIGPOLL', 'SIGPWR', 'SIGSTKFLT');
|
|
11465
|
+
}
|
|
11466
|
+
|
|
11467
|
+
/* IMPORT */
|
|
11468
|
+
/* MAIN */
|
|
11469
|
+
class Interceptor {
|
|
11470
|
+
/* CONSTRUCTOR */
|
|
11471
|
+
constructor() {
|
|
11472
|
+
/* VARIABLES */
|
|
11473
|
+
this.callbacks = new Set();
|
|
11474
|
+
this.exited = false;
|
|
11475
|
+
/* API */
|
|
11476
|
+
this.exit = (signal) => {
|
|
11477
|
+
if (this.exited)
|
|
11478
|
+
return;
|
|
11479
|
+
this.exited = true;
|
|
11480
|
+
for (const callback of this.callbacks) {
|
|
11481
|
+
callback();
|
|
11482
|
+
}
|
|
11483
|
+
if (signal) {
|
|
11484
|
+
if (IS_WINDOWS && (signal !== 'SIGINT' && signal !== 'SIGTERM' && signal !== 'SIGKILL')) { // Windows doesn't support POSIX signals, but Node emulates these 3 signals for us
|
|
11485
|
+
process$2.kill(process$2.pid, 'SIGTERM');
|
|
11486
|
+
}
|
|
11487
|
+
else {
|
|
11488
|
+
process$2.kill(process$2.pid, signal);
|
|
11489
|
+
}
|
|
11490
|
+
}
|
|
11491
|
+
};
|
|
11492
|
+
this.hook = () => {
|
|
11493
|
+
process$2.once('exit', () => this.exit());
|
|
11494
|
+
for (const signal of Signals) {
|
|
11495
|
+
try {
|
|
11496
|
+
process$2.once(signal, () => this.exit(signal));
|
|
11497
|
+
}
|
|
11498
|
+
catch {
|
|
11499
|
+
// Sometimes "process.once" can throw...
|
|
11500
|
+
}
|
|
11501
|
+
}
|
|
11502
|
+
};
|
|
11503
|
+
this.register = (callback) => {
|
|
11504
|
+
this.callbacks.add(callback);
|
|
11505
|
+
return () => {
|
|
11506
|
+
this.callbacks.delete(callback);
|
|
11507
|
+
};
|
|
11508
|
+
};
|
|
11509
|
+
this.hook();
|
|
11510
|
+
}
|
|
11511
|
+
}
|
|
11512
|
+
/* EXPORT */
|
|
11513
|
+
var Interceptor$1 = new Interceptor();
|
|
11514
|
+
|
|
11515
|
+
/* IMPORT */
|
|
11516
|
+
/* MAIN */
|
|
11517
|
+
const whenExit = Interceptor$1.register;
|
|
11518
|
+
|
|
11519
|
+
/* IMPORT */
|
|
11520
|
+
/* MAIN */
|
|
11521
|
+
//TODO: Maybe publish this as a standalone package
|
|
11522
|
+
const Temp = {
|
|
11523
|
+
/* VARIABLES */
|
|
11524
|
+
store: {}, // filePath => purge
|
|
11525
|
+
/* API */
|
|
11526
|
+
create: (filePath) => {
|
|
11527
|
+
const randomness = `000000${Math.floor(Math.random() * 16777215).toString(16)}`.slice(-6); // 6 random-enough hex characters
|
|
11528
|
+
const timestamp = Date.now().toString().slice(-10); // 10 precise timestamp digits
|
|
11529
|
+
const prefix = 'tmp-';
|
|
11530
|
+
const suffix = `.${prefix}${timestamp}${randomness}`;
|
|
11531
|
+
const tempPath = `${filePath}${suffix}`;
|
|
11532
|
+
return tempPath;
|
|
11533
|
+
},
|
|
11534
|
+
get: (filePath, creator, purge = true) => {
|
|
11535
|
+
const tempPath = Temp.truncate(creator(filePath));
|
|
11536
|
+
if (tempPath in Temp.store)
|
|
11537
|
+
return Temp.get(filePath, creator, purge); // Collision found, try again
|
|
11538
|
+
Temp.store[tempPath] = purge;
|
|
11539
|
+
const disposer = () => delete Temp.store[tempPath];
|
|
11540
|
+
return [tempPath, disposer];
|
|
11541
|
+
},
|
|
11542
|
+
purge: (filePath) => {
|
|
11543
|
+
if (!Temp.store[filePath])
|
|
11544
|
+
return;
|
|
11545
|
+
delete Temp.store[filePath];
|
|
11546
|
+
FS.attempt.unlink(filePath);
|
|
11547
|
+
},
|
|
11548
|
+
purgeSync: (filePath) => {
|
|
11549
|
+
if (!Temp.store[filePath])
|
|
11550
|
+
return;
|
|
11551
|
+
delete Temp.store[filePath];
|
|
11552
|
+
FS.attempt.unlinkSync(filePath);
|
|
11553
|
+
},
|
|
11554
|
+
purgeSyncAll: () => {
|
|
11555
|
+
for (const filePath in Temp.store) {
|
|
11556
|
+
Temp.purgeSync(filePath);
|
|
11557
|
+
}
|
|
11558
|
+
},
|
|
11559
|
+
truncate: (filePath) => {
|
|
11560
|
+
const basename = path$z.basename(filePath);
|
|
11561
|
+
if (basename.length <= LIMIT_BASENAME_LENGTH)
|
|
11562
|
+
return filePath; //FIXME: Rough and quick attempt at detecting ok lengths
|
|
11563
|
+
const truncable = /^(\.?)(.*?)((?:\.[^.]+)?(?:\.tmp-\d{10}[a-f0-9]{6})?)$/.exec(basename);
|
|
11564
|
+
if (!truncable)
|
|
11565
|
+
return filePath; //FIXME: No truncable part detected, can't really do much without also changing the parent path, which is unsafe, hoping for the best here
|
|
11566
|
+
const truncationLength = basename.length - LIMIT_BASENAME_LENGTH;
|
|
11567
|
+
return `${filePath.slice(0, -basename.length)}${truncable[1]}${truncable[2].slice(0, -truncationLength)}${truncable[3]}`; //FIXME: The truncable part might be shorter than needed here
|
|
11568
|
+
}
|
|
11569
|
+
};
|
|
11570
|
+
/* INIT */
|
|
11571
|
+
whenExit(Temp.purgeSyncAll); // Ensuring purgeable temp files are purged on exit
|
|
11572
|
+
|
|
11573
|
+
/* IMPORT */
|
|
11574
|
+
function writeFile$1(filePath, data, options, callback) {
|
|
11575
|
+
const promise = writeFileAsync(filePath, data, options);
|
|
11576
|
+
return promise;
|
|
11577
|
+
}
|
|
11578
|
+
async function writeFileAsync(filePath, data, options = DEFAULT_WRITE_OPTIONS) {
|
|
11579
|
+
if (isString$3(options))
|
|
11580
|
+
return writeFileAsync(filePath, data, { encoding: options });
|
|
11581
|
+
const timeout = options.timeout ?? DEFAULT_TIMEOUT_ASYNC;
|
|
11582
|
+
const retryOptions = { timeout, interval: DEFAULT_INTERVAL_ASYNC };
|
|
11583
|
+
let schedulerCustomDisposer = null;
|
|
11584
|
+
let schedulerDisposer = null;
|
|
11585
|
+
let tempDisposer = null;
|
|
11586
|
+
let tempPath = null;
|
|
11587
|
+
let fd = null;
|
|
11588
|
+
try {
|
|
11589
|
+
if (options.schedule)
|
|
11590
|
+
schedulerCustomDisposer = await options.schedule(filePath);
|
|
11591
|
+
schedulerDisposer = await Scheduler.schedule(filePath);
|
|
11592
|
+
const filePathReal = await FS.attempt.realpath(filePath);
|
|
11593
|
+
const filePathExists = !!filePathReal;
|
|
11594
|
+
filePath = filePathReal || filePath;
|
|
11595
|
+
[tempPath, tempDisposer] = Temp.get(filePath, options.tmpCreate || Temp.create, !(options.tmpPurge === false));
|
|
11596
|
+
const useStatChown = IS_POSIX && isUndefined$1(options.chown);
|
|
11597
|
+
const useStatMode = isUndefined$1(options.mode);
|
|
11598
|
+
if (filePathExists && (useStatChown || useStatMode)) {
|
|
11599
|
+
const stats = await FS.attempt.stat(filePath);
|
|
11600
|
+
if (stats) {
|
|
11601
|
+
options = { ...options };
|
|
11602
|
+
if (useStatChown) {
|
|
11603
|
+
options.chown = { uid: stats.uid, gid: stats.gid };
|
|
11604
|
+
}
|
|
11605
|
+
if (useStatMode) {
|
|
11606
|
+
options.mode = stats.mode;
|
|
11607
|
+
}
|
|
11608
|
+
}
|
|
11609
|
+
}
|
|
11610
|
+
if (!filePathExists) {
|
|
11611
|
+
const parentPath = path$z.dirname(filePath);
|
|
11612
|
+
await FS.attempt.mkdir(parentPath, {
|
|
11613
|
+
mode: DEFAULT_FOLDER_MODE,
|
|
11614
|
+
recursive: true
|
|
11615
|
+
});
|
|
11616
|
+
}
|
|
11617
|
+
fd = await FS.retry.open(retryOptions)(tempPath, 'w', options.mode || DEFAULT_FILE_MODE);
|
|
11618
|
+
if (options.tmpCreated) {
|
|
11619
|
+
options.tmpCreated(tempPath);
|
|
11620
|
+
}
|
|
11621
|
+
if (isString$3(data)) {
|
|
11622
|
+
await FS.retry.write(retryOptions)(fd, data, 0, options.encoding || DEFAULT_ENCODING);
|
|
11623
|
+
}
|
|
11624
|
+
else if (data instanceof require$$0$b.Readable) {
|
|
11625
|
+
const writeStream = fs$F.createWriteStream(tempPath, { fd, autoClose: false });
|
|
11626
|
+
const finishPromise = EventEmitter$k.once(writeStream, 'finish');
|
|
11627
|
+
data.pipe(writeStream);
|
|
11628
|
+
await finishPromise;
|
|
11629
|
+
}
|
|
11630
|
+
else if (!isUndefined$1(data)) {
|
|
11631
|
+
await FS.retry.write(retryOptions)(fd, data, 0, data.length, 0);
|
|
11632
|
+
}
|
|
11633
|
+
if (options.fsync !== false) {
|
|
11634
|
+
if (options.fsyncWait !== false) {
|
|
11635
|
+
await FS.retry.fsync(retryOptions)(fd);
|
|
11636
|
+
}
|
|
11637
|
+
else {
|
|
11638
|
+
FS.attempt.fsync(fd);
|
|
11639
|
+
}
|
|
11640
|
+
}
|
|
11641
|
+
await FS.retry.close(retryOptions)(fd);
|
|
11642
|
+
fd = null;
|
|
11643
|
+
if (options.chown && (options.chown.uid !== DEFAULT_USER_UID || options.chown.gid !== DEFAULT_USER_GID)) {
|
|
11644
|
+
await FS.attempt.chown(tempPath, options.chown.uid, options.chown.gid);
|
|
11645
|
+
}
|
|
11646
|
+
if (options.mode && options.mode !== DEFAULT_FILE_MODE) {
|
|
11647
|
+
await FS.attempt.chmod(tempPath, options.mode);
|
|
11648
|
+
}
|
|
11649
|
+
try {
|
|
11650
|
+
await FS.retry.rename(retryOptions)(tempPath, filePath);
|
|
11651
|
+
}
|
|
11652
|
+
catch (error) {
|
|
11653
|
+
if (!isException(error))
|
|
11654
|
+
throw error;
|
|
11655
|
+
if (error.code !== 'ENAMETOOLONG')
|
|
11656
|
+
throw error;
|
|
11657
|
+
await FS.retry.rename(retryOptions)(tempPath, Temp.truncate(filePath));
|
|
11658
|
+
}
|
|
11659
|
+
tempDisposer();
|
|
11660
|
+
tempPath = null;
|
|
11661
|
+
}
|
|
11662
|
+
finally {
|
|
11663
|
+
if (fd)
|
|
11664
|
+
await FS.attempt.close(fd);
|
|
11665
|
+
if (tempPath)
|
|
11666
|
+
Temp.purge(tempPath);
|
|
11667
|
+
if (schedulerCustomDisposer)
|
|
11668
|
+
schedulerCustomDisposer();
|
|
11669
|
+
if (schedulerDisposer)
|
|
11670
|
+
schedulerDisposer();
|
|
11671
|
+
}
|
|
11672
|
+
}
|
|
11673
|
+
|
|
11674
|
+
function writeJSON(filePath, data) {
|
|
11675
|
+
const jsonData = JSON.stringify(data);
|
|
11676
|
+
return writeFile$1(filePath, jsonData, "utf-8");
|
|
11677
|
+
}
|
|
11222
11678
|
class CommonPreset {
|
|
11223
11679
|
filepath;
|
|
11224
11680
|
defaultConfig;
|
|
@@ -11241,7 +11697,7 @@ class CommonPreset {
|
|
|
11241
11697
|
allPresets[presetIndex] = presets;
|
|
11242
11698
|
}
|
|
11243
11699
|
const presetsPath = this.filepath;
|
|
11244
|
-
await
|
|
11700
|
+
await writeJSON(presetsPath, allPresets);
|
|
11245
11701
|
return true;
|
|
11246
11702
|
}
|
|
11247
11703
|
// 保存预设
|
|
@@ -11255,7 +11711,7 @@ class CommonPreset {
|
|
|
11255
11711
|
allPresets[presetIndex] = presets;
|
|
11256
11712
|
}
|
|
11257
11713
|
const presetsPath = this.filepath;
|
|
11258
|
-
await
|
|
11714
|
+
await writeJSON(presetsPath, allPresets);
|
|
11259
11715
|
return true;
|
|
11260
11716
|
}
|
|
11261
11717
|
// 删除预设
|
|
@@ -11270,7 +11726,7 @@ class CommonPreset {
|
|
|
11270
11726
|
}
|
|
11271
11727
|
allPresets.splice(presetIndex, 1);
|
|
11272
11728
|
const presetsPath = this.filepath;
|
|
11273
|
-
await
|
|
11729
|
+
await writeJSON(presetsPath, allPresets);
|
|
11274
11730
|
return true;
|
|
11275
11731
|
}
|
|
11276
11732
|
// 读取预设
|
|
@@ -11329,6 +11785,7 @@ var LLMType;
|
|
|
11329
11785
|
})(LLMType || (LLMType = {}));
|
|
11330
11786
|
const APP_DEFAULT_CONFIG = {
|
|
11331
11787
|
logLevel: "debug",
|
|
11788
|
+
uploadCrashReport: false,
|
|
11332
11789
|
autoUpdate: true,
|
|
11333
11790
|
autoLaunch: false,
|
|
11334
11791
|
trash: false,
|
|
@@ -11341,6 +11798,7 @@ const APP_DEFAULT_CONFIG = {
|
|
|
11341
11798
|
host: "127.0.0.1",
|
|
11342
11799
|
passKey: "",
|
|
11343
11800
|
https: false,
|
|
11801
|
+
externalWebhook: "",
|
|
11344
11802
|
webhook: {
|
|
11345
11803
|
open: false,
|
|
11346
11804
|
recoderFolder: "",
|
|
@@ -38712,8 +39170,17 @@ var ref = ReferenceError;
|
|
|
38712
39170
|
/** @type {import('./syntax')} */
|
|
38713
39171
|
var syntax = SyntaxError;
|
|
38714
39172
|
|
|
38715
|
-
|
|
38716
|
-
var
|
|
39173
|
+
var type$2;
|
|
39174
|
+
var hasRequiredType$1;
|
|
39175
|
+
|
|
39176
|
+
function requireType$1 () {
|
|
39177
|
+
if (hasRequiredType$1) return type$2;
|
|
39178
|
+
hasRequiredType$1 = 1;
|
|
39179
|
+
|
|
39180
|
+
/** @type {import('./type')} */
|
|
39181
|
+
type$2 = TypeError;
|
|
39182
|
+
return type$2;
|
|
39183
|
+
}
|
|
38717
39184
|
|
|
38718
39185
|
/** @type {import('./uri')} */
|
|
38719
39186
|
var uri = URIError;
|
|
@@ -38781,58 +39248,49 @@ if ($defineProperty$2) {
|
|
|
38781
39248
|
|
|
38782
39249
|
var esDefineProperty = $defineProperty$2;
|
|
38783
39250
|
|
|
38784
|
-
|
|
38785
|
-
|
|
38786
|
-
|
|
38787
|
-
function
|
|
38788
|
-
if (
|
|
38789
|
-
hasRequiredShams = 1;
|
|
38790
|
-
|
|
38791
|
-
/** @type {import('./shams')} */
|
|
38792
|
-
/* eslint complexity: [2, 18], max-statements: [2, 33] */
|
|
38793
|
-
shams$2 = function hasSymbols() {
|
|
38794
|
-
if (typeof Symbol !== 'function' || typeof Object.getOwnPropertySymbols !== 'function') { return false; }
|
|
38795
|
-
if (typeof Symbol.iterator === 'symbol') { return true; }
|
|
39251
|
+
/** @type {import('./shams')} */
|
|
39252
|
+
/* eslint complexity: [2, 18], max-statements: [2, 33] */
|
|
39253
|
+
var shams$1 = function hasSymbols() {
|
|
39254
|
+
if (typeof Symbol !== 'function' || typeof Object.getOwnPropertySymbols !== 'function') { return false; }
|
|
39255
|
+
if (typeof Symbol.iterator === 'symbol') { return true; }
|
|
38796
39256
|
|
|
38797
|
-
|
|
38798
|
-
|
|
38799
|
-
|
|
38800
|
-
|
|
38801
|
-
|
|
39257
|
+
/** @type {{ [k in symbol]?: unknown }} */
|
|
39258
|
+
var obj = {};
|
|
39259
|
+
var sym = Symbol('test');
|
|
39260
|
+
var symObj = Object(sym);
|
|
39261
|
+
if (typeof sym === 'string') { return false; }
|
|
38802
39262
|
|
|
38803
|
-
|
|
38804
|
-
|
|
39263
|
+
if (Object.prototype.toString.call(sym) !== '[object Symbol]') { return false; }
|
|
39264
|
+
if (Object.prototype.toString.call(symObj) !== '[object Symbol]') { return false; }
|
|
38805
39265
|
|
|
38806
|
-
|
|
38807
|
-
|
|
38808
|
-
|
|
38809
|
-
|
|
39266
|
+
// temp disabled per https://github.com/ljharb/object.assign/issues/17
|
|
39267
|
+
// if (sym instanceof Symbol) { return false; }
|
|
39268
|
+
// temp disabled per https://github.com/WebReflection/get-own-property-symbols/issues/4
|
|
39269
|
+
// if (!(symObj instanceof Symbol)) { return false; }
|
|
38810
39270
|
|
|
38811
|
-
|
|
38812
|
-
|
|
39271
|
+
// if (typeof Symbol.prototype.toString !== 'function') { return false; }
|
|
39272
|
+
// if (String(sym) !== Symbol.prototype.toString.call(sym)) { return false; }
|
|
38813
39273
|
|
|
38814
|
-
|
|
38815
|
-
|
|
38816
|
-
|
|
38817
|
-
|
|
39274
|
+
var symVal = 42;
|
|
39275
|
+
obj[sym] = symVal;
|
|
39276
|
+
for (var _ in obj) { return false; } // eslint-disable-line no-restricted-syntax, no-unreachable-loop
|
|
39277
|
+
if (typeof Object.keys === 'function' && Object.keys(obj).length !== 0) { return false; }
|
|
38818
39278
|
|
|
38819
|
-
|
|
39279
|
+
if (typeof Object.getOwnPropertyNames === 'function' && Object.getOwnPropertyNames(obj).length !== 0) { return false; }
|
|
38820
39280
|
|
|
38821
|
-
|
|
38822
|
-
|
|
39281
|
+
var syms = Object.getOwnPropertySymbols(obj);
|
|
39282
|
+
if (syms.length !== 1 || syms[0] !== sym) { return false; }
|
|
38823
39283
|
|
|
38824
|
-
|
|
39284
|
+
if (!Object.prototype.propertyIsEnumerable.call(obj, sym)) { return false; }
|
|
38825
39285
|
|
|
38826
|
-
|
|
38827
|
-
|
|
38828
|
-
|
|
38829
|
-
|
|
38830
|
-
|
|
39286
|
+
if (typeof Object.getOwnPropertyDescriptor === 'function') {
|
|
39287
|
+
// eslint-disable-next-line no-extra-parens
|
|
39288
|
+
var descriptor = /** @type {PropertyDescriptor} */ (Object.getOwnPropertyDescriptor(obj, sym));
|
|
39289
|
+
if (descriptor.value !== symVal || descriptor.enumerable !== true) { return false; }
|
|
39290
|
+
}
|
|
38831
39291
|
|
|
38832
|
-
|
|
38833
|
-
|
|
38834
|
-
return shams$2;
|
|
38835
|
-
}
|
|
39292
|
+
return true;
|
|
39293
|
+
};
|
|
38836
39294
|
|
|
38837
39295
|
var hasSymbols$2;
|
|
38838
39296
|
var hasRequiredHasSymbols;
|
|
@@ -38842,7 +39300,7 @@ function requireHasSymbols () {
|
|
|
38842
39300
|
hasRequiredHasSymbols = 1;
|
|
38843
39301
|
|
|
38844
39302
|
var origSymbol = typeof Symbol !== 'undefined' && Symbol;
|
|
38845
|
-
var hasSymbolSham =
|
|
39303
|
+
var hasSymbolSham = shams$1;
|
|
38846
39304
|
|
|
38847
39305
|
/** @type {import('.')} */
|
|
38848
39306
|
hasSymbols$2 = function hasNativeSymbols() {
|
|
@@ -39031,7 +39489,7 @@ function requireCallBindApplyHelpers () {
|
|
|
39031
39489
|
hasRequiredCallBindApplyHelpers = 1;
|
|
39032
39490
|
|
|
39033
39491
|
var bind = functionBind;
|
|
39034
|
-
var $TypeError =
|
|
39492
|
+
var $TypeError = requireType$1();
|
|
39035
39493
|
|
|
39036
39494
|
var $call = requireFunctionCall();
|
|
39037
39495
|
var $actualApply = requireActualApply();
|
|
@@ -39135,7 +39593,7 @@ var $EvalError = _eval;
|
|
|
39135
39593
|
var $RangeError = range$2;
|
|
39136
39594
|
var $ReferenceError = ref;
|
|
39137
39595
|
var $SyntaxError = syntax;
|
|
39138
|
-
var $TypeError$1 =
|
|
39596
|
+
var $TypeError$1 = requireType$1();
|
|
39139
39597
|
var $URIError = uri;
|
|
39140
39598
|
|
|
39141
39599
|
var abs = abs$1;
|
|
@@ -39503,47 +39961,6 @@ var getIntrinsic = function GetIntrinsic(name, allowMissing) {
|
|
|
39503
39961
|
return value;
|
|
39504
39962
|
};
|
|
39505
39963
|
|
|
39506
|
-
/* eslint complexity: [2, 18], max-statements: [2, 33] */
|
|
39507
|
-
var shams$1 = function hasSymbols() {
|
|
39508
|
-
if (typeof Symbol !== 'function' || typeof Object.getOwnPropertySymbols !== 'function') { return false; }
|
|
39509
|
-
if (typeof Symbol.iterator === 'symbol') { return true; }
|
|
39510
|
-
|
|
39511
|
-
var obj = {};
|
|
39512
|
-
var sym = Symbol('test');
|
|
39513
|
-
var symObj = Object(sym);
|
|
39514
|
-
if (typeof sym === 'string') { return false; }
|
|
39515
|
-
|
|
39516
|
-
if (Object.prototype.toString.call(sym) !== '[object Symbol]') { return false; }
|
|
39517
|
-
if (Object.prototype.toString.call(symObj) !== '[object Symbol]') { return false; }
|
|
39518
|
-
|
|
39519
|
-
// temp disabled per https://github.com/ljharb/object.assign/issues/17
|
|
39520
|
-
// if (sym instanceof Symbol) { return false; }
|
|
39521
|
-
// temp disabled per https://github.com/WebReflection/get-own-property-symbols/issues/4
|
|
39522
|
-
// if (!(symObj instanceof Symbol)) { return false; }
|
|
39523
|
-
|
|
39524
|
-
// if (typeof Symbol.prototype.toString !== 'function') { return false; }
|
|
39525
|
-
// if (String(sym) !== Symbol.prototype.toString.call(sym)) { return false; }
|
|
39526
|
-
|
|
39527
|
-
var symVal = 42;
|
|
39528
|
-
obj[sym] = symVal;
|
|
39529
|
-
for (sym in obj) { return false; } // eslint-disable-line no-restricted-syntax, no-unreachable-loop
|
|
39530
|
-
if (typeof Object.keys === 'function' && Object.keys(obj).length !== 0) { return false; }
|
|
39531
|
-
|
|
39532
|
-
if (typeof Object.getOwnPropertyNames === 'function' && Object.getOwnPropertyNames(obj).length !== 0) { return false; }
|
|
39533
|
-
|
|
39534
|
-
var syms = Object.getOwnPropertySymbols(obj);
|
|
39535
|
-
if (syms.length !== 1 || syms[0] !== sym) { return false; }
|
|
39536
|
-
|
|
39537
|
-
if (!Object.prototype.propertyIsEnumerable.call(obj, sym)) { return false; }
|
|
39538
|
-
|
|
39539
|
-
if (typeof Object.getOwnPropertyDescriptor === 'function') {
|
|
39540
|
-
var descriptor = Object.getOwnPropertyDescriptor(obj, sym);
|
|
39541
|
-
if (descriptor.value !== symVal || descriptor.enumerable !== true) { return false; }
|
|
39542
|
-
}
|
|
39543
|
-
|
|
39544
|
-
return true;
|
|
39545
|
-
};
|
|
39546
|
-
|
|
39547
39964
|
var hasSymbols = shams$1;
|
|
39548
39965
|
|
|
39549
39966
|
/** @type {import('.')} */
|
|
@@ -39557,7 +39974,7 @@ var $defineProperty = GetIntrinsic('%Object.defineProperty%', true);
|
|
|
39557
39974
|
|
|
39558
39975
|
var hasToStringTag = shams();
|
|
39559
39976
|
var hasOwn$1 = hasown;
|
|
39560
|
-
var $TypeError =
|
|
39977
|
+
var $TypeError = requireType$1();
|
|
39561
39978
|
|
|
39562
39979
|
var toStringTag = hasToStringTag ? Symbol.toStringTag : null;
|
|
39563
39980
|
|
|
@@ -42321,7 +42738,7 @@ function requireSupportsColor () {
|
|
|
42321
42738
|
if (hasRequiredSupportsColor) return supportsColor_1;
|
|
42322
42739
|
hasRequiredSupportsColor = 1;
|
|
42323
42740
|
const os = require$$1$2;
|
|
42324
|
-
const tty = require$$0$
|
|
42741
|
+
const tty = require$$0$c;
|
|
42325
42742
|
const hasFlag = requireHasFlag();
|
|
42326
42743
|
|
|
42327
42744
|
const {env} = process;
|
|
@@ -42467,7 +42884,7 @@ function requireNode$1 () {
|
|
|
42467
42884
|
if (hasRequiredNode$1) return node$3.exports;
|
|
42468
42885
|
hasRequiredNode$1 = 1;
|
|
42469
42886
|
(function (module, exports) {
|
|
42470
|
-
const tty = require$$0$
|
|
42887
|
+
const tty = require$$0$c;
|
|
42471
42888
|
const util = require$$1$1;
|
|
42472
42889
|
|
|
42473
42890
|
/**
|
|
@@ -46962,7 +47379,7 @@ function getMainModulePath() {
|
|
|
46962
47379
|
|
|
46963
47380
|
/* eslint-disable no-unused-vars */
|
|
46964
47381
|
|
|
46965
|
-
const childProcess$1 = require$$0$
|
|
47382
|
+
const childProcess$1 = require$$0$d;
|
|
46966
47383
|
const os$3 = require$$1$2;
|
|
46967
47384
|
const path$a = require$$0$7;
|
|
46968
47385
|
const packageJson = packageJson$1;
|
|
@@ -50067,7 +50484,7 @@ class SubtitleStylePreset {
|
|
|
50067
50484
|
}
|
|
50068
50485
|
}
|
|
50069
50486
|
|
|
50070
|
-
var childProcess = require$$0$
|
|
50487
|
+
var childProcess = require$$0$d;
|
|
50071
50488
|
var spawn$1 = childProcess.spawn;
|
|
50072
50489
|
var exec = childProcess.exec;
|
|
50073
50490
|
|
|
@@ -54507,7 +54924,7 @@ async function trash(paths, options) {
|
|
|
54507
54924
|
} else if (process$2.platform === 'win32') {
|
|
54508
54925
|
module = await Promise.resolve().then(function () { return require('./windows-OmnJ7a39.cjs'); });
|
|
54509
54926
|
} else {
|
|
54510
|
-
module = await Promise.resolve().then(function () { return require('./linux-
|
|
54927
|
+
module = await Promise.resolve().then(function () { return require('./linux-9g8WByl9.cjs'); });
|
|
54511
54928
|
}
|
|
54512
54929
|
|
|
54513
54930
|
return module.default(paths);
|
|
@@ -61311,6 +61728,34 @@ const decrypt = (encryptedData, password) => {
|
|
|
61311
61728
|
return decrypted;
|
|
61312
61729
|
};
|
|
61313
61730
|
|
|
61731
|
+
const getExternalWebhookUrl = () => {
|
|
61732
|
+
return appConfig.get("externalWebhook")?.trim();
|
|
61733
|
+
};
|
|
61734
|
+
const sendExternalEventRequest = async (type, data) => {
|
|
61735
|
+
const webhookUrl = getExternalWebhookUrl();
|
|
61736
|
+
if (!webhookUrl)
|
|
61737
|
+
return;
|
|
61738
|
+
const body = {
|
|
61739
|
+
id: crypto$c.randomUUID(),
|
|
61740
|
+
version: 1,
|
|
61741
|
+
time: new Date().toISOString(),
|
|
61742
|
+
type,
|
|
61743
|
+
data,
|
|
61744
|
+
};
|
|
61745
|
+
try {
|
|
61746
|
+
await axios.post(webhookUrl, body, {
|
|
61747
|
+
proxy: false,
|
|
61748
|
+
timeout: 10000,
|
|
61749
|
+
});
|
|
61750
|
+
}
|
|
61751
|
+
catch (error) {
|
|
61752
|
+
logObj.error("发送外部事件失败", {
|
|
61753
|
+
webhookUrl,
|
|
61754
|
+
error,
|
|
61755
|
+
});
|
|
61756
|
+
}
|
|
61757
|
+
};
|
|
61758
|
+
|
|
61314
61759
|
// ffmpeg的subtitle参数转义
|
|
61315
61760
|
const escaped = (s) => {
|
|
61316
61761
|
s = s.replaceAll("\\", "/");
|
|
@@ -64056,7 +64501,7 @@ function requireNode () {
|
|
|
64056
64501
|
if (hasRequiredNode) return node.exports;
|
|
64057
64502
|
hasRequiredNode = 1;
|
|
64058
64503
|
(function (module, exports) {
|
|
64059
|
-
var tty = require$$0$
|
|
64504
|
+
var tty = require$$0$c;
|
|
64060
64505
|
var util = require$$1$1;
|
|
64061
64506
|
|
|
64062
64507
|
/**
|
|
@@ -64244,7 +64689,7 @@ function requireNode () {
|
|
|
64244
64689
|
|
|
64245
64690
|
case 'PIPE':
|
|
64246
64691
|
case 'TCP':
|
|
64247
|
-
var net = require$$0$
|
|
64692
|
+
var net = require$$0$e;
|
|
64248
64693
|
stream = new net.Socket({
|
|
64249
64694
|
fd: fd,
|
|
64250
64695
|
readable: false,
|
|
@@ -75069,15 +75514,23 @@ var Stream$1 = /*#__PURE__*/function () {
|
|
|
75069
75514
|
return Stream;
|
|
75070
75515
|
}();
|
|
75071
75516
|
|
|
75072
|
-
|
|
75073
|
-
|
|
75074
|
-
|
|
75075
|
-
|
|
75076
|
-
|
|
75077
|
-
|
|
75078
|
-
|
|
75079
|
-
|
|
75080
|
-
}
|
|
75517
|
+
var _extends$1 = {exports: {}};
|
|
75518
|
+
|
|
75519
|
+
(function (module) {
|
|
75520
|
+
function _extends() {
|
|
75521
|
+
return module.exports = _extends = Object.assign ? Object.assign.bind() : function (n) {
|
|
75522
|
+
for (var e = 1; e < arguments.length; e++) {
|
|
75523
|
+
var t = arguments[e];
|
|
75524
|
+
for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
|
|
75525
|
+
}
|
|
75526
|
+
return n;
|
|
75527
|
+
}, module.exports.__esModule = true, module.exports["default"] = module.exports, _extends.apply(null, arguments);
|
|
75528
|
+
}
|
|
75529
|
+
module.exports = _extends, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
75530
|
+
} (_extends$1));
|
|
75531
|
+
|
|
75532
|
+
var _extendsExports = _extends$1.exports;
|
|
75533
|
+
var _extends = /*@__PURE__*/getDefaultExportFromCjs(_extendsExports);
|
|
75081
75534
|
|
|
75082
75535
|
var win;
|
|
75083
75536
|
|
|
@@ -77744,7 +78197,7 @@ const zlib$2 = zlib$3;
|
|
|
77744
78197
|
const PassThrough$5 = require$$0$4.PassThrough;
|
|
77745
78198
|
const Cookies = cookies$1;
|
|
77746
78199
|
const packageData$8 = require$$9;
|
|
77747
|
-
const net$a = require$$0$
|
|
78200
|
+
const net$a = require$$0$e;
|
|
77748
78201
|
|
|
77749
78202
|
const MAX_REDIRECTS = 5;
|
|
77750
78203
|
|
|
@@ -78021,7 +78474,7 @@ var fetchExports = fetch$3.exports;
|
|
|
78021
78474
|
const fs = require$$0$6;
|
|
78022
78475
|
const nmfetch = fetchExports;
|
|
78023
78476
|
const dns = require$$4;
|
|
78024
|
-
const net = require$$0$
|
|
78477
|
+
const net = require$$0$e;
|
|
78025
78478
|
const os = require$$1$2;
|
|
78026
78479
|
|
|
78027
78480
|
const DNS_TTL = 5 * 60 * 1000;
|
|
@@ -85251,7 +85704,7 @@ var dkim = DKIM$1;
|
|
|
85251
85704
|
* Minimal HTTP/S proxy client
|
|
85252
85705
|
*/
|
|
85253
85706
|
|
|
85254
|
-
const net$9 = require$$0$
|
|
85707
|
+
const net$9 = require$$0$e;
|
|
85255
85708
|
const tls$6 = require$$1$7;
|
|
85256
85709
|
const urllib$1 = require$$0$9;
|
|
85257
85710
|
|
|
@@ -85712,7 +86165,7 @@ const util$E = require$$1$1;
|
|
|
85712
86165
|
const urllib = require$$0$9;
|
|
85713
86166
|
const packageData$7 = require$$9;
|
|
85714
86167
|
const MailMessage = mailMessage;
|
|
85715
|
-
const net$8 = require$$0$
|
|
86168
|
+
const net$8 = require$$0$e;
|
|
85716
86169
|
const dns$2 = require$$4;
|
|
85717
86170
|
const crypto$6 = require$$1$5;
|
|
85718
86171
|
|
|
@@ -86239,7 +86692,7 @@ var dataStream = DataStream$1;
|
|
|
86239
86692
|
|
|
86240
86693
|
const packageInfo = require$$9;
|
|
86241
86694
|
const EventEmitter$f = require$$0$8.EventEmitter;
|
|
86242
|
-
const net$7 = require$$0$
|
|
86695
|
+
const net$7 = require$$0$e;
|
|
86243
86696
|
const tls$5 = require$$1$7;
|
|
86244
86697
|
const os = require$$1$2;
|
|
86245
86698
|
const crypto$5 = require$$1$5;
|
|
@@ -90213,7 +90666,7 @@ let SMTPTransport$1 = class SMTPTransport extends EventEmitter$c {
|
|
|
90213
90666
|
// expose to the world
|
|
90214
90667
|
var smtpTransport = SMTPTransport$1;
|
|
90215
90668
|
|
|
90216
|
-
const spawn = require$$0$
|
|
90669
|
+
const spawn = require$$0$d.spawn;
|
|
90217
90670
|
const packageData$4 = require$$9;
|
|
90218
90671
|
const shared$4 = sharedExports;
|
|
90219
90672
|
|
|
@@ -169010,7 +169463,7 @@ var require$$1 = [
|
|
|
169010
169463
|
]
|
|
169011
169464
|
];
|
|
169012
169465
|
|
|
169013
|
-
var punycode = require$$0$
|
|
169466
|
+
var punycode = require$$0$f;
|
|
169014
169467
|
var mappingTable = require$$1;
|
|
169015
169468
|
|
|
169016
169469
|
var PROCESSING_OPTIONS = {
|
|
@@ -169203,7 +169656,7 @@ tr46.toUnicode = function(domain_name, useSTD3) {
|
|
|
169203
169656
|
tr46.PROCESSING_OPTIONS = PROCESSING_OPTIONS;
|
|
169204
169657
|
|
|
169205
169658
|
(function (module) {
|
|
169206
|
-
const punycode = require$$0$
|
|
169659
|
+
const punycode = require$$0$f;
|
|
169207
169660
|
const tr46$1 = tr46;
|
|
169208
169661
|
|
|
169209
169662
|
const specialSchemes = {
|
|
@@ -172789,9 +173242,11 @@ async function sendByTg(title, desp, options) {
|
|
|
172789
173242
|
*/
|
|
172790
173243
|
async function sendBySystem(title, desp) {
|
|
172791
173244
|
// 非electron环境不触发
|
|
173245
|
+
// @ts-ignore
|
|
172792
173246
|
if (process.type !== "browser")
|
|
172793
173247
|
return;
|
|
172794
|
-
|
|
173248
|
+
// @ts-ignore
|
|
173249
|
+
const { Notification } = await import('electron');
|
|
172795
173250
|
const event = new Notification({
|
|
172796
173251
|
title: title,
|
|
172797
173252
|
body: desp,
|
|
@@ -173210,7 +173665,7 @@ function whichSync (cmd, opt) {
|
|
|
173210
173665
|
|
|
173211
173666
|
/*jshint node:true*/
|
|
173212
173667
|
|
|
173213
|
-
require$$0$
|
|
173668
|
+
require$$0$d.exec;
|
|
173214
173669
|
var isWindows = require$$1$2.platform().match(/win(32|64)/);
|
|
173215
173670
|
var which = which_1;
|
|
173216
173671
|
|
|
@@ -175953,7 +176408,7 @@ function requireProcessor () {
|
|
|
175953
176408
|
if (hasRequiredProcessor) return processor;
|
|
175954
176409
|
hasRequiredProcessor = 1;
|
|
175955
176410
|
|
|
175956
|
-
var spawn = require$$0$
|
|
176411
|
+
var spawn = require$$0$d.spawn;
|
|
175957
176412
|
var async = requireAsync();
|
|
175958
176413
|
var utils = utilsExports;
|
|
175959
176414
|
|
|
@@ -177346,7 +177801,7 @@ function requireFfprobe () {
|
|
|
177346
177801
|
if (hasRequiredFfprobe) return ffprobe;
|
|
177347
177802
|
hasRequiredFfprobe = 1;
|
|
177348
177803
|
|
|
177349
|
-
var spawn = require$$0$
|
|
177804
|
+
var spawn = require$$0$d.spawn;
|
|
177350
177805
|
|
|
177351
177806
|
function legacyTag(key) {
|
|
177352
177807
|
return key.match(/^TAG:/);
|
|
@@ -183592,8 +184047,8 @@ class TaskQueue {
|
|
|
183592
184047
|
* @param autoRun 是否自动运行(true: 立即执行, false: 根据任务限制决定)
|
|
183593
184048
|
*/
|
|
183594
184049
|
addTask(task, autoRun = true) {
|
|
183595
|
-
task.emitter.on("task-end", ({ taskId }) => {
|
|
183596
|
-
this.emitter.emit("task-end", { taskId });
|
|
184050
|
+
task.emitter.on("task-end", ({ taskId, data }) => {
|
|
184051
|
+
this.emitter.emit("task-end", { taskId, data });
|
|
183597
184052
|
});
|
|
183598
184053
|
task.emitter.on("task-error", ({ taskId, error }) => {
|
|
183599
184054
|
this.emitter.emit("task-error", { taskId, error });
|
|
@@ -183613,6 +184068,9 @@ class TaskQueue {
|
|
|
183613
184068
|
task.emitter.on("task-cancel", ({ taskId, autoStart }) => {
|
|
183614
184069
|
this.emitter.emit("task-cancel", { taskId, autoStart });
|
|
183615
184070
|
});
|
|
184071
|
+
// task.emitter.on("task-removed-queue", ({ taskId }) => {
|
|
184072
|
+
// this.emitter.emit("task-removed-queue", { taskId });
|
|
184073
|
+
// });
|
|
183616
184074
|
this.queue.push(task);
|
|
183617
184075
|
if (autoRun) {
|
|
183618
184076
|
task.exec();
|
|
@@ -183688,11 +184146,11 @@ class TaskQueue {
|
|
|
183688
184146
|
const task = this.queryTask(taskId);
|
|
183689
184147
|
if (!task)
|
|
183690
184148
|
return;
|
|
184149
|
+
task.emit("task-removed-queue", { taskId: task.taskId });
|
|
183691
184150
|
const index = this.queue.indexOf(task);
|
|
183692
184151
|
if (index !== -1) {
|
|
183693
184152
|
this.queue.splice(index, 1);
|
|
183694
184153
|
}
|
|
183695
|
-
task.emit("task-removed-queue", { taskId: task.taskId });
|
|
183696
184154
|
}
|
|
183697
184155
|
/**
|
|
183698
184156
|
* 暂停任务
|
|
@@ -183794,6 +184252,68 @@ class TaskQueue {
|
|
|
183794
184252
|
};
|
|
183795
184253
|
}
|
|
183796
184254
|
|
|
184255
|
+
const getExternalTaskStatus = (eventName, status) => {
|
|
184256
|
+
if (status === "pending")
|
|
184257
|
+
return "pending";
|
|
184258
|
+
if (status === "running")
|
|
184259
|
+
return "running";
|
|
184260
|
+
if (status === "paused")
|
|
184261
|
+
return "paused";
|
|
184262
|
+
if (status === "completed")
|
|
184263
|
+
return "completed";
|
|
184264
|
+
if (status === "error")
|
|
184265
|
+
return "error";
|
|
184266
|
+
if (status === "canceled")
|
|
184267
|
+
return "cancelled";
|
|
184268
|
+
if (eventName === "task-start" || eventName === "task-resume") {
|
|
184269
|
+
return "running";
|
|
184270
|
+
}
|
|
184271
|
+
if (eventName === "task-pause")
|
|
184272
|
+
return "paused";
|
|
184273
|
+
if (eventName === "task-end")
|
|
184274
|
+
return "completed";
|
|
184275
|
+
if (eventName === "task-error")
|
|
184276
|
+
return "error";
|
|
184277
|
+
if (eventName === "task-cancel")
|
|
184278
|
+
return "cancelled";
|
|
184279
|
+
return undefined;
|
|
184280
|
+
};
|
|
184281
|
+
const getExternalTaskType = (taskType) => {
|
|
184282
|
+
if (taskType === TaskType.bili) {
|
|
184283
|
+
return TaskType.biliUpload;
|
|
184284
|
+
}
|
|
184285
|
+
return taskType;
|
|
184286
|
+
};
|
|
184287
|
+
const toISOString = (time) => {
|
|
184288
|
+
if (!time)
|
|
184289
|
+
return undefined;
|
|
184290
|
+
return new Date(time).toISOString();
|
|
184291
|
+
};
|
|
184292
|
+
const isTerminalTaskEvent = (eventName) => {
|
|
184293
|
+
return ["task-end", "task-error", "task-cancel"].includes(eventName);
|
|
184294
|
+
};
|
|
184295
|
+
const sendExternalTaskEvent = async (taskQueue, eventName, payload) => {
|
|
184296
|
+
const task = taskQueue.queryTask(payload.taskId);
|
|
184297
|
+
const taskInfo = task ? taskQueue.stringify([task])[0] : undefined;
|
|
184298
|
+
const eventTime = Date.now();
|
|
184299
|
+
const startedTime = taskInfo?.startTime || (eventName === "task-start" ? eventTime : undefined);
|
|
184300
|
+
const endedTime = taskInfo?.endTime || (isTerminalTaskEvent(eventName) ? eventTime : undefined);
|
|
184301
|
+
const durationMs = taskInfo?.duration ??
|
|
184302
|
+
(startedTime && endedTime ? Math.max(endedTime - startedTime, 0) : undefined);
|
|
184303
|
+
await sendExternalEventRequest("task", {
|
|
184304
|
+
event: eventName,
|
|
184305
|
+
taskId: payload.taskId,
|
|
184306
|
+
taskType: getExternalTaskType(taskInfo?.type),
|
|
184307
|
+
status: getExternalTaskStatus(eventName, taskInfo?.status),
|
|
184308
|
+
message: taskInfo?.custsomProgressMsg || undefined,
|
|
184309
|
+
error: "error" in payload ? payload.error : taskInfo?.error || undefined,
|
|
184310
|
+
startedAt: toISOString(startedTime),
|
|
184311
|
+
endedAt: toISOString(endedTime),
|
|
184312
|
+
durationMs,
|
|
184313
|
+
extra: taskInfo?.extra,
|
|
184314
|
+
});
|
|
184315
|
+
};
|
|
184316
|
+
|
|
183797
184317
|
/**
|
|
183798
184318
|
* 全局任务队列实例
|
|
183799
184319
|
*/
|
|
@@ -183860,6 +184380,24 @@ taskQueue.on("task-end", ({ taskId }) => {
|
|
|
183860
184380
|
taskQueue.on("task-error", ({ taskId }) => {
|
|
183861
184381
|
sendTaskNotify("failure", taskId);
|
|
183862
184382
|
});
|
|
184383
|
+
taskQueue.on("task-start", (payload) => {
|
|
184384
|
+
void sendExternalTaskEvent(taskQueue, "task-start", payload);
|
|
184385
|
+
});
|
|
184386
|
+
taskQueue.on("task-end", (payload) => {
|
|
184387
|
+
void sendExternalTaskEvent(taskQueue, "task-end", payload);
|
|
184388
|
+
});
|
|
184389
|
+
taskQueue.on("task-error", (payload) => {
|
|
184390
|
+
void sendExternalTaskEvent(taskQueue, "task-error", payload);
|
|
184391
|
+
});
|
|
184392
|
+
taskQueue.on("task-pause", (payload) => {
|
|
184393
|
+
void sendExternalTaskEvent(taskQueue, "task-pause", payload);
|
|
184394
|
+
});
|
|
184395
|
+
taskQueue.on("task-resume", (payload) => {
|
|
184396
|
+
void sendExternalTaskEvent(taskQueue, "task-resume", payload);
|
|
184397
|
+
});
|
|
184398
|
+
taskQueue.on("task-cancel", (payload) => {
|
|
184399
|
+
void sendExternalTaskEvent(taskQueue, "task-cancel", payload);
|
|
184400
|
+
});
|
|
183863
184401
|
/**
|
|
183864
184402
|
* 暂停任务
|
|
183865
184403
|
*/
|
|
@@ -185102,7 +185640,7 @@ class BiliCheckQueue extends TypedEmitter {
|
|
|
185102
185640
|
};
|
|
185103
185641
|
}
|
|
185104
185642
|
|
|
185105
|
-
var vm = require$$0$
|
|
185643
|
+
var vm = require$$0$g;
|
|
185106
185644
|
|
|
185107
185645
|
var safeEval = function safeEval (code, context, opts) {
|
|
185108
185646
|
var sandbox = {};
|
|
@@ -185710,7 +186248,7 @@ async function downloadImage(imageUrl, savePath) {
|
|
|
185710
186248
|
}
|
|
185711
186249
|
const fileStream = fs$F.createWriteStream(savePath, { flags: "wx" });
|
|
185712
186250
|
// @ts-ignore
|
|
185713
|
-
await promises.finished(require$$0$
|
|
186251
|
+
await promises.finished(require$$0$b.Readable.fromWeb(res.body).pipe(fileStream));
|
|
185714
186252
|
}
|
|
185715
186253
|
const md5$3 = (str) => {
|
|
185716
186254
|
return crypto$c.createHash("md5").update(str).digest("hex");
|
|
@@ -189175,7 +189713,7 @@ var tree_1 = {
|
|
|
189175
189713
|
const assert$l = require$$0$h;
|
|
189176
189714
|
const { kDestroyed: kDestroyed$2, kBodyUsed: kBodyUsed$1, kListeners, kBody: kBody$2 } = requireSymbols();
|
|
189177
189715
|
const { IncomingMessage } = require$$2;
|
|
189178
|
-
const stream$1 = require$$0$
|
|
189716
|
+
const stream$1 = require$$0$b;
|
|
189179
189717
|
const net$6 = require$$0$i;
|
|
189180
189718
|
const { stringify } = require$$5;
|
|
189181
189719
|
const { EventEmitter: EE$1 } = EventEmitter$k;
|
|
@@ -194198,7 +194736,7 @@ function requireUtil$5 () {
|
|
|
194198
194736
|
if (hasRequiredUtil$5) return util$z;
|
|
194199
194737
|
hasRequiredUtil$5 = 1;
|
|
194200
194738
|
|
|
194201
|
-
const { Transform } = require$$0$
|
|
194739
|
+
const { Transform } = require$$0$b;
|
|
194202
194740
|
const zlib = require$$3$3;
|
|
194203
194741
|
const { redirectStatusSet, referrerPolicyTokens, badPortsSet } = requireConstants$2();
|
|
194204
194742
|
const { getGlobalOrigin } = requireGlobal();
|
|
@@ -196619,7 +197157,7 @@ function requireBody () {
|
|
|
196619
197157
|
const { FormData, setFormDataState } = requireFormdata();
|
|
196620
197158
|
const { webidl } = requireWebidl();
|
|
196621
197159
|
const assert = require$$0$h;
|
|
196622
|
-
const { isErrored, isDisturbed } = require$$0$
|
|
197160
|
+
const { isErrored, isDisturbed } = require$$0$b;
|
|
196623
197161
|
const { isUint8Array } = require$$8;
|
|
196624
197162
|
const { serializeAMimeType } = requireDataUrl();
|
|
196625
197163
|
const { multipartFormDataParser } = requireFormdataParser();
|
|
@@ -198729,7 +199267,7 @@ class AsyncWriter {
|
|
|
198729
199267
|
var clientH1 = connectH1$1;
|
|
198730
199268
|
|
|
198731
199269
|
const assert$h = require$$0$h;
|
|
198732
|
-
const { pipeline: pipeline$2 } = require$$0$
|
|
199270
|
+
const { pipeline: pipeline$2 } = require$$0$b;
|
|
198733
199271
|
const util$x = util$C;
|
|
198734
199272
|
const {
|
|
198735
199273
|
RequestContentLengthMismatchError,
|
|
@@ -203149,7 +203687,7 @@ var api = {};
|
|
|
203149
203687
|
var apiRequest = {exports: {}};
|
|
203150
203688
|
|
|
203151
203689
|
const assert$e = require$$0$h;
|
|
203152
|
-
const { Readable: Readable$3 } = require$$0$
|
|
203690
|
+
const { Readable: Readable$3 } = require$$0$b;
|
|
203153
203691
|
const { RequestAbortedError: RequestAbortedError$5, NotSupportedError, InvalidArgumentError: InvalidArgumentError$i, AbortError: AbortError$1 } = errors;
|
|
203154
203692
|
const util$r = util$C;
|
|
203155
203693
|
const { ReadableStreamFrom } = util$C;
|
|
@@ -204001,7 +204539,7 @@ var abortSignal = {
|
|
|
204001
204539
|
};
|
|
204002
204540
|
|
|
204003
204541
|
const assert$c = require$$0$h;
|
|
204004
|
-
const { finished } = require$$0$
|
|
204542
|
+
const { finished } = require$$0$b;
|
|
204005
204543
|
const { AsyncResource: AsyncResource$3 } = require$$1$9;
|
|
204006
204544
|
const { InvalidArgumentError: InvalidArgumentError$g, InvalidReturnValueError: InvalidReturnValueError$1 } = errors;
|
|
204007
204545
|
const util$p = util$C;
|
|
@@ -204212,7 +204750,7 @@ const {
|
|
|
204212
204750
|
Readable: Readable$1,
|
|
204213
204751
|
Duplex,
|
|
204214
204752
|
PassThrough
|
|
204215
|
-
} = require$$0$
|
|
204753
|
+
} = require$$0$b;
|
|
204216
204754
|
const assert$b = require$$0$h;
|
|
204217
204755
|
const { AsyncResource: AsyncResource$2 } = require$$1$9;
|
|
204218
204756
|
const {
|
|
@@ -205814,7 +206352,7 @@ let MockPool$1 = class MockPool extends Pool {
|
|
|
205814
206352
|
|
|
205815
206353
|
var mockPool = MockPool$1;
|
|
205816
206354
|
|
|
205817
|
-
const { Transform } = require$$0$
|
|
206355
|
+
const { Transform } = require$$0$b;
|
|
205818
206356
|
const { Console } = require$$1$a;
|
|
205819
206357
|
|
|
205820
206358
|
const PERSISTENT = process.versions.icu ? '✅' : 'Y ';
|
|
@@ -209950,7 +210488,7 @@ function isValidDate (date) {
|
|
|
209950
210488
|
|
|
209951
210489
|
var cacheHandler = CacheHandler$1;
|
|
209952
210490
|
|
|
209953
|
-
const { Writable: Writable$2 } = require$$0$
|
|
210491
|
+
const { Writable: Writable$2 } = require$$0$b;
|
|
209954
210492
|
const { EventEmitter: EventEmitter$7 } = EventEmitter$k;
|
|
209955
210493
|
const { assertCacheKey: assertCacheKey$1, assertCacheValue: assertCacheValue$1 } = cache$2;
|
|
209956
210494
|
|
|
@@ -210307,7 +210845,7 @@ let CacheRevalidationHandler$1 = class CacheRevalidationHandler {
|
|
|
210307
210845
|
var cacheRevalidationHandler = CacheRevalidationHandler$1;
|
|
210308
210846
|
|
|
210309
210847
|
const assert$5 = require$$0$h;
|
|
210310
|
-
const { Readable } = require$$0$
|
|
210848
|
+
const { Readable } = require$$0$b;
|
|
210311
210849
|
const util$j = util$C;
|
|
210312
210850
|
const CacheHandler = cacheHandler;
|
|
210313
210851
|
const MemoryCacheStore = memoryCacheStore;
|
|
@@ -210801,7 +211339,7 @@ var cache$1 = (opts = {}) => {
|
|
|
210801
211339
|
};
|
|
210802
211340
|
|
|
210803
211341
|
const { createInflate, createGunzip, createBrotliDecompress, createZstdDecompress } = require$$3$3;
|
|
210804
|
-
const { pipeline } = require$$0$
|
|
211342
|
+
const { pipeline } = require$$0$b;
|
|
210805
211343
|
const DecoratorHandler = decoratorHandler;
|
|
210806
211344
|
const { runtimeFeatures } = runtimeFeatures$2;
|
|
210807
211345
|
|
|
@@ -211633,7 +212171,7 @@ var deduplicate = (opts = {}) => {
|
|
|
211633
212171
|
}
|
|
211634
212172
|
};
|
|
211635
212173
|
|
|
211636
|
-
const { Writable: Writable$1 } = require$$0$
|
|
212174
|
+
const { Writable: Writable$1 } = require$$0$b;
|
|
211637
212175
|
const { assertCacheKey, assertCacheValue } = cache$2;
|
|
211638
212176
|
|
|
211639
212177
|
let DatabaseSync;
|
|
@@ -214967,7 +215505,7 @@ function requireFetch () {
|
|
|
214967
215505
|
subresourceSet
|
|
214968
215506
|
} = requireConstants$2();
|
|
214969
215507
|
const EE = EventEmitter$k;
|
|
214970
|
-
const { Readable, pipeline, finished, isErrored, isReadable } = require$$0$
|
|
215508
|
+
const { Readable, pipeline, finished, isErrored, isReadable } = require$$0$b;
|
|
214971
215509
|
const { addAbortListener, bufferToLowerCasedHeaderName } = util$C;
|
|
214972
215510
|
const { dataURLProcessor, serializeAMimeType, minimizeSupportedMimeType } = requireDataUrl();
|
|
214973
215511
|
const { getGlobalDispatcher } = global$1;
|
|
@@ -220602,7 +221140,7 @@ function requireReceiver () {
|
|
|
220602
221140
|
if (hasRequiredReceiver) return receiver$2;
|
|
220603
221141
|
hasRequiredReceiver = 1;
|
|
220604
221142
|
|
|
220605
|
-
const { Writable } = require$$0$
|
|
221143
|
+
const { Writable } = require$$0$b;
|
|
220606
221144
|
const assert = require$$0$h;
|
|
220607
221145
|
const { parserStates, opcodes, states, emptyBuffer, sentCloseFrameState } = requireConstants();
|
|
220608
221146
|
const {
|
|
@@ -222577,7 +223115,7 @@ var hasRequiredEventsourceStream;
|
|
|
222577
223115
|
function requireEventsourceStream () {
|
|
222578
223116
|
if (hasRequiredEventsourceStream) return eventsourceStream;
|
|
222579
223117
|
hasRequiredEventsourceStream = 1;
|
|
222580
|
-
const { Transform } = require$$0$
|
|
223118
|
+
const { Transform } = require$$0$b;
|
|
222581
223119
|
const { isASCIINumber, isValidLastEventId } = requireUtil$1();
|
|
222582
223120
|
|
|
222583
223121
|
/**
|
|
@@ -222985,7 +223523,7 @@ function requireEventsource () {
|
|
|
222985
223523
|
if (hasRequiredEventsource) return eventsource;
|
|
222986
223524
|
hasRequiredEventsource = 1;
|
|
222987
223525
|
|
|
222988
|
-
const { pipeline } = require$$0$
|
|
223526
|
+
const { pipeline } = require$$0$b;
|
|
222989
223527
|
const { fetching } = requireFetch();
|
|
222990
223528
|
const { makeRequest } = requireRequest();
|
|
222991
223529
|
const { webidl } = requireWebidl();
|
|
@@ -231861,7 +232399,7 @@ var extension$3 = { format: format$2, parse: parse$4 };
|
|
|
231861
232399
|
const EventEmitter$6 = require$$0$8;
|
|
231862
232400
|
const https$2 = require$$1$4;
|
|
231863
232401
|
const http$2 = require$$3$2;
|
|
231864
|
-
const net$1 = require$$0$
|
|
232402
|
+
const net$1 = require$$0$e;
|
|
231865
232403
|
const tls$2 = require$$1$7;
|
|
231866
232404
|
const { randomBytes, createHash } = require$$1$5;
|
|
231867
232405
|
const { URL: URL$1 } = require$$0$9;
|
|
@@ -245526,7 +246064,7 @@ var SmartBuffer$1 = (function () {
|
|
|
245526
246064
|
|
|
245527
246065
|
var smartBuffer = SmartBuffer$1;
|
|
245528
246066
|
|
|
245529
|
-
var net = require$$0$
|
|
246067
|
+
var net = require$$0$e;
|
|
245530
246068
|
var ip = ip$1;
|
|
245531
246069
|
var SmartBuffer = smartBuffer;
|
|
245532
246070
|
|
|
@@ -268806,6 +269344,7 @@ async function getRoomInfoByUserWeb(secUserId, opts = {}) {
|
|
|
268806
269344
|
if (!res.data.includes("直播中")) {
|
|
268807
269345
|
return {
|
|
268808
269346
|
living: false,
|
|
269347
|
+
isLiveRadio: false,
|
|
268809
269348
|
nickname: "",
|
|
268810
269349
|
sec_uid: "",
|
|
268811
269350
|
avatar: "",
|
|
@@ -268824,19 +269363,38 @@ async function getRoomInfoByUserWeb(secUserId, opts = {}) {
|
|
|
268824
269363
|
.replace(/\\"/g, '"')
|
|
268825
269364
|
.replace(/\\"/g, '"')
|
|
268826
269365
|
.replace(/"\$\w+"/g, "null");
|
|
268827
|
-
// const roomRegex = /(\{\\"common\\":.*?)"\]\)/;
|
|
268828
|
-
// const roomMatch = res.data.match(roomRegex);
|
|
268829
|
-
// if (!roomMatch) {
|
|
268830
|
-
// throw new Error("No room match found in HTML");
|
|
268831
|
-
// }
|
|
268832
|
-
// let roomJsonStr = roomMatch[1];
|
|
268833
|
-
// roomJsonStr = roomJsonStr
|
|
268834
|
-
// .replace(/\\"/g, '"')
|
|
268835
|
-
// .replace(/\\"/g, '"')
|
|
268836
|
-
// .replace(/"\$\w+"/g, "null");
|
|
268837
269366
|
try {
|
|
268838
|
-
// console.log(userJsonStr);
|
|
268839
269367
|
const userData = JSON.parse(userJsonStr);
|
|
269368
|
+
const roomData = userData?.user?.user?.roomData;
|
|
269369
|
+
const streamUrl = roomData?.stream_url;
|
|
269370
|
+
let liveCoreSdkData = null;
|
|
269371
|
+
if (streamUrl) {
|
|
269372
|
+
liveCoreSdkData = { live_core_sdk_data: streamUrl.live_core_sdk_data };
|
|
269373
|
+
if (liveCoreSdkData?.live_core_sdk_data?.pull_data) {
|
|
269374
|
+
const flvPullUrl = streamUrl.flv_pull_url;
|
|
269375
|
+
let streamData = {};
|
|
269376
|
+
for (const quality of [{ key: "or4", desc: "原画" }, ...qualityList]) {
|
|
269377
|
+
const flvUrls = Object.values(flvPullUrl);
|
|
269378
|
+
if (flvUrls.some((url) => url.includes(`${quality.key}`))) {
|
|
269379
|
+
const url = flvUrls.find((url) => url.includes(`${quality.key}`));
|
|
269380
|
+
const convertedQuality = quality.key === "or4" ? "origin" : quality.key;
|
|
269381
|
+
streamData[convertedQuality] = {
|
|
269382
|
+
// @ts-ignore
|
|
269383
|
+
main: {
|
|
269384
|
+
flv: url,
|
|
269385
|
+
hls: "",
|
|
269386
|
+
},
|
|
269387
|
+
};
|
|
269388
|
+
}
|
|
269389
|
+
}
|
|
269390
|
+
liveCoreSdkData.live_core_sdk_data.pull_data.stream_data = streamData;
|
|
269391
|
+
}
|
|
269392
|
+
else {
|
|
269393
|
+
liveCoreSdkData = null;
|
|
269394
|
+
}
|
|
269395
|
+
}
|
|
269396
|
+
// console.log("pppp", JSON.stringify(liveCoreSdkData, null, 2));
|
|
269397
|
+
// console.log(JSON.stringify(streamUrl, null, 2));
|
|
268840
269398
|
// console.log(JSON.stringify(userData, null, 2));
|
|
268841
269399
|
// const roomData = JSON.parse(roomJsonStr);
|
|
268842
269400
|
// console.log(roomData);
|
|
@@ -268844,15 +269402,16 @@ async function getRoomInfoByUserWeb(secUserId, opts = {}) {
|
|
|
268844
269402
|
// const streamData = data.state.streamStore.streamData;
|
|
268845
269403
|
return {
|
|
268846
269404
|
living: userData?.user?.user?.roomData?.status === 2,
|
|
269405
|
+
isLiveRadio: roomData?.live_type_audio ?? false,
|
|
268847
269406
|
nickname: userData?.user?.user?.nickname ?? "",
|
|
268848
269407
|
sec_uid: userData?.user?.user?.secUid ?? "",
|
|
268849
269408
|
avatar: userData?.user?.user?.avatar ?? "",
|
|
268850
|
-
api: "
|
|
269409
|
+
api: "userHTML",
|
|
268851
269410
|
room: {
|
|
268852
269411
|
title: "",
|
|
268853
269412
|
cover: "",
|
|
268854
269413
|
id_str: userData?.user?.user?.roomIdStr,
|
|
268855
|
-
stream_url:
|
|
269414
|
+
stream_url: liveCoreSdkData,
|
|
268856
269415
|
},
|
|
268857
269416
|
};
|
|
268858
269417
|
}
|
|
@@ -268897,8 +269456,10 @@ async function getRoomInfoByHtml(webRoomId, opts = {}) {
|
|
|
268897
269456
|
const data = JSON.parse(jsonStr);
|
|
268898
269457
|
const roomInfo = data.state.roomStore.roomInfo;
|
|
268899
269458
|
const streamData = data.state.streamStore.streamData;
|
|
269459
|
+
const isLiveRadio = roomInfo.enter_mode == 1;
|
|
268900
269460
|
return {
|
|
268901
|
-
living: roomInfo?.room?.status === 2,
|
|
269461
|
+
living: roomInfo?.room?.status === 2 || isLiveRadio,
|
|
269462
|
+
isLiveRadio: isLiveRadio,
|
|
268902
269463
|
nickname: roomInfo?.anchor?.nickname ?? "",
|
|
268903
269464
|
sec_uid: roomInfo?.anchor?.sec_uid ?? "",
|
|
268904
269465
|
avatar: roomInfo?.anchor?.avatar_thumb?.url_list?.[0] ?? "",
|
|
@@ -268907,15 +269468,17 @@ async function getRoomInfoByHtml(webRoomId, opts = {}) {
|
|
|
268907
269468
|
title: roomInfo?.room?.title ?? "",
|
|
268908
269469
|
cover: roomInfo?.room?.cover?.url_list?.[0] ?? "",
|
|
268909
269470
|
id_str: roomInfo?.room?.id_str ?? "",
|
|
268910
|
-
stream_url:
|
|
268911
|
-
|
|
268912
|
-
|
|
268913
|
-
|
|
268914
|
-
|
|
268915
|
-
|
|
269471
|
+
stream_url: roomInfo?.room?.stream_url?.pull_datas
|
|
269472
|
+
? {
|
|
269473
|
+
pull_datas: roomInfo?.room?.stream_url?.pull_datas,
|
|
269474
|
+
live_core_sdk_data: {
|
|
269475
|
+
pull_data: {
|
|
269476
|
+
options: { qualities: streamData.H264_streamData?.options?.qualities ?? [] },
|
|
269477
|
+
stream_data: streamData.H264_streamData?.stream ?? {},
|
|
269478
|
+
},
|
|
268916
269479
|
},
|
|
268917
|
-
}
|
|
268918
|
-
|
|
269480
|
+
}
|
|
269481
|
+
: null,
|
|
268919
269482
|
},
|
|
268920
269483
|
};
|
|
268921
269484
|
}
|
|
@@ -268963,6 +269526,7 @@ async function getRoomInfoByWeb(webRoomId, opts = {}) {
|
|
|
268963
269526
|
// 直播已结束
|
|
268964
269527
|
return {
|
|
268965
269528
|
living: false,
|
|
269529
|
+
isLiveRadio: false,
|
|
268966
269530
|
nickname: "",
|
|
268967
269531
|
sec_uid: "",
|
|
268968
269532
|
avatar: "",
|
|
@@ -268979,7 +269543,8 @@ async function getRoomInfoByWeb(webRoomId, opts = {}) {
|
|
|
268979
269543
|
const data = res.data.data;
|
|
268980
269544
|
const room = data?.data?.[0];
|
|
268981
269545
|
return {
|
|
268982
|
-
living: data?.room_status === 0,
|
|
269546
|
+
living: data?.room_status === 0 || data?.room_status === 1,
|
|
269547
|
+
isLiveRadio: data?.room_status === 1,
|
|
268983
269548
|
nickname: data?.user?.nickname ?? "",
|
|
268984
269549
|
avatar: data?.user?.avatar_thumb?.url_list?.[0] ?? "",
|
|
268985
269550
|
sec_uid: data?.user?.sec_uid ?? "",
|
|
@@ -269018,6 +269583,7 @@ async function getRoomInfoByMobile(secUserId, opts = {}) {
|
|
|
269018
269583
|
const room = res?.data?.data?.room;
|
|
269019
269584
|
return {
|
|
269020
269585
|
living: room?.status === 2,
|
|
269586
|
+
isLiveRadio: room?.live_type_audio ?? false,
|
|
269021
269587
|
nickname: room?.owner?.nickname,
|
|
269022
269588
|
sec_uid: room?.owner?.sec_uid,
|
|
269023
269589
|
avatar: room?.owner?.avatar_thumb?.url_list?.[0],
|
|
@@ -269055,11 +269621,12 @@ async function getRoomInfo(webRoomId, opts = {}) {
|
|
|
269055
269621
|
else {
|
|
269056
269622
|
data = await getRoomInfoByWeb(webRoomId, opts);
|
|
269057
269623
|
}
|
|
269058
|
-
// console.log(JSON.stringify(data, null, 2));
|
|
269059
269624
|
const room = data.room;
|
|
269060
|
-
|
|
269625
|
+
assert(room, `No room data, id ${webRoomId}`);
|
|
269626
|
+
if (!room?.stream_url) {
|
|
269061
269627
|
return {
|
|
269062
269628
|
living: data.living,
|
|
269629
|
+
isLiveRadio: data.isLiveRadio,
|
|
269063
269630
|
roomId: webRoomId,
|
|
269064
269631
|
owner: data.nickname,
|
|
269065
269632
|
title: room?.title ?? data.nickname,
|
|
@@ -269072,22 +269639,6 @@ async function getRoomInfo(webRoomId, opts = {}) {
|
|
|
269072
269639
|
api: data.api,
|
|
269073
269640
|
};
|
|
269074
269641
|
}
|
|
269075
|
-
assert(room, `No room data, id ${webRoomId}`);
|
|
269076
|
-
if (room?.stream_url == null) {
|
|
269077
|
-
return {
|
|
269078
|
-
living: false,
|
|
269079
|
-
roomId: webRoomId,
|
|
269080
|
-
owner: data.nickname,
|
|
269081
|
-
title: room?.title ?? data.nickname,
|
|
269082
|
-
streams: [],
|
|
269083
|
-
sources: [],
|
|
269084
|
-
avatar: data.avatar,
|
|
269085
|
-
cover: room.cover,
|
|
269086
|
-
liveId: room.id_str,
|
|
269087
|
-
uid: data.sec_uid,
|
|
269088
|
-
api: data.api,
|
|
269089
|
-
};
|
|
269090
|
-
}
|
|
269091
269642
|
let qualities = [];
|
|
269092
269643
|
let stream_data = "";
|
|
269093
269644
|
if (opts.doubleScreen && !isEmpty(room.stream_url.pull_datas)) {
|
|
@@ -269156,6 +269707,7 @@ async function getRoomInfo(webRoomId, opts = {}) {
|
|
|
269156
269707
|
// console.log(JSON.stringify(sources, null, 2), qualities);
|
|
269157
269708
|
return {
|
|
269158
269709
|
living: data.living,
|
|
269710
|
+
isLiveRadio: data.isLiveRadio,
|
|
269159
269711
|
roomId: webRoomId,
|
|
269160
269712
|
owner: data.nickname,
|
|
269161
269713
|
title: room.title,
|
|
@@ -269434,6 +269986,7 @@ async function getInfo$1(channelId, opts) {
|
|
|
269434
269986
|
const startTime = new Date();
|
|
269435
269987
|
return {
|
|
269436
269988
|
living: info.living,
|
|
269989
|
+
isLiveRadio: info.isLiveRadio,
|
|
269437
269990
|
owner: info.owner,
|
|
269438
269991
|
title: info.title,
|
|
269439
269992
|
roomId: info.roomId,
|
|
@@ -269449,12 +270002,20 @@ async function getInfo$1(channelId, opts) {
|
|
|
269449
270002
|
}
|
|
269450
270003
|
async function getStream$1(opts) {
|
|
269451
270004
|
let api = opts.api ?? "web";
|
|
269452
|
-
if (api === "userHTML") {
|
|
270005
|
+
if (api === "userHTML" || api === "webHTML") {
|
|
269453
270006
|
// userHTML 接口只能用于状态检测
|
|
269454
270007
|
api = "web";
|
|
269455
270008
|
}
|
|
269456
270009
|
else if (api === "random") {
|
|
269457
|
-
api = selectRandomAPI(["userHTML"]);
|
|
270010
|
+
api = selectRandomAPI(["userHTML", "webHTML"]);
|
|
270011
|
+
}
|
|
270012
|
+
if (opts.isLiveRadio) {
|
|
270013
|
+
// 直播电台可能需要特殊处理,优先使用 userHTML 接口
|
|
270014
|
+
api = "userHTML";
|
|
270015
|
+
// 如果用户指定了mobile接口,那么优先使用mobile接口获取流信息
|
|
270016
|
+
if (opts.api === "mobile") {
|
|
270017
|
+
api = "mobile";
|
|
270018
|
+
}
|
|
269458
270019
|
}
|
|
269459
270020
|
const info = await getRoomInfo(opts.channelId, {
|
|
269460
270021
|
doubleScreen: opts.doubleScreen ?? true,
|
|
@@ -301148,6 +301709,7 @@ const checkLiveStatusAndRecord$1 = async function ({ getSavePath, banLiveId, isM
|
|
|
301148
301709
|
return this.recordHandle;
|
|
301149
301710
|
}
|
|
301150
301711
|
// 获取直播间信息
|
|
301712
|
+
let isLiveRadio = false;
|
|
301151
301713
|
try {
|
|
301152
301714
|
const liveInfo = await getInfo$1(this.channelId, {
|
|
301153
301715
|
auth: this.auth,
|
|
@@ -301155,6 +301717,7 @@ const checkLiveStatusAndRecord$1 = async function ({ getSavePath, banLiveId, isM
|
|
|
301155
301717
|
uid: this.uid,
|
|
301156
301718
|
});
|
|
301157
301719
|
this.liveInfo = liveInfo;
|
|
301720
|
+
isLiveRadio = liveInfo.isLiveRadio;
|
|
301158
301721
|
this.emit("stateChange", { state: "idle" });
|
|
301159
301722
|
}
|
|
301160
301723
|
catch (error) {
|
|
@@ -301192,6 +301755,7 @@ const checkLiveStatusAndRecord$1 = async function ({ getSavePath, banLiveId, isM
|
|
|
301192
301755
|
doubleScreen: this.doubleScreen,
|
|
301193
301756
|
api: this.api,
|
|
301194
301757
|
uid: this.uid,
|
|
301758
|
+
isLiveRadio: isLiveRadio,
|
|
301195
301759
|
});
|
|
301196
301760
|
this.liveInfo.owner = res.owner;
|
|
301197
301761
|
this.liveInfo.title = res.title;
|
|
@@ -302333,6 +302897,21 @@ class RecorderConfig {
|
|
|
302333
302897
|
|
|
302334
302898
|
// 缓存直播结束通知的最后触发时间,避免频繁通知
|
|
302335
302899
|
const endLiveNotificationCache = new Map();
|
|
302900
|
+
const getRecorderExternalBase = (recorder) => {
|
|
302901
|
+
return {
|
|
302902
|
+
roomId: String(recorder.channelId),
|
|
302903
|
+
platform: recorder.providerId,
|
|
302904
|
+
title: recorder.liveInfo?.title,
|
|
302905
|
+
username: recorder.liveInfo?.owner,
|
|
302906
|
+
time: new Date().toISOString(),
|
|
302907
|
+
liveId: recorder.liveInfo?.liveId || "",
|
|
302908
|
+
avatar: recorder.liveInfo?.avatar || recorder.extra?.avatar || "",
|
|
302909
|
+
cover: recorder.liveInfo?.cover || "",
|
|
302910
|
+
};
|
|
302911
|
+
};
|
|
302912
|
+
const sendRecorderExternalEvent = async (type, data) => {
|
|
302913
|
+
await sendExternalEventRequest(type, data);
|
|
302914
|
+
};
|
|
302336
302915
|
async function sendStartLiveNotification(appConfig, recorder, config) {
|
|
302337
302916
|
const name = recorder?.liveInfo?.owner ? recorder.liveInfo.owner : config.remarks;
|
|
302338
302917
|
const title = `${name}(${config.channelId}) 正在直播`;
|
|
@@ -302343,7 +302922,8 @@ async function sendStartLiveNotification(appConfig, recorder, config) {
|
|
|
302343
302922
|
}
|
|
302344
302923
|
if (notifyType === "system") {
|
|
302345
302924
|
const event = await sendBySystem(title, `${recorder?.liveInfo?.title}\n点击打开直播间`);
|
|
302346
|
-
|
|
302925
|
+
// @ts-ignore
|
|
302926
|
+
const { shell } = await import('electron');
|
|
302347
302927
|
event?.on("click", () => {
|
|
302348
302928
|
const url = recorder.getChannelURL();
|
|
302349
302929
|
shell.openExternal(url);
|
|
@@ -302380,8 +302960,9 @@ async function sendEndLiveNotification(appConfig, recorder, config) {
|
|
|
302380
302960
|
}
|
|
302381
302961
|
async function convert2Mp4(videoFile) {
|
|
302382
302962
|
const output = replaceExtName$1(videoFile, ".mp4");
|
|
302383
|
-
if (await fs$m.pathExists(output))
|
|
302384
|
-
|
|
302963
|
+
if (await fs$m.pathExists(output)) {
|
|
302964
|
+
throw new Error(`目标文件已存在: ${output}`);
|
|
302965
|
+
}
|
|
302385
302966
|
const name = path$z.basename(output);
|
|
302386
302967
|
return new Promise((resolve, reject) => {
|
|
302387
302968
|
transcode(videoFile, name, {
|
|
@@ -302540,9 +303121,16 @@ async function createRecorderManager(appConfig) {
|
|
|
302540
303121
|
recorder.extra = {};
|
|
302541
303122
|
const timestamp = Date.now();
|
|
302542
303123
|
recorder.extra.lastRecordTime = timestamp;
|
|
303124
|
+
void sendRecorderExternalEvent("record_start", {
|
|
303125
|
+
...getRecorderExternalBase(recorder),
|
|
303126
|
+
time: new Date(timestamp).toISOString(),
|
|
303127
|
+
});
|
|
302543
303128
|
});
|
|
302544
303129
|
manager.on("RecordStop", ({ recorder }) => {
|
|
302545
303130
|
logObj.info("Manager stop", recorder);
|
|
303131
|
+
void sendRecorderExternalEvent("record_end", {
|
|
303132
|
+
...getRecorderExternalBase(recorder),
|
|
303133
|
+
});
|
|
302546
303134
|
// 录制结束通知,自动监听&开启推送时才会发送
|
|
302547
303135
|
const config = recorderConfig.get(recorder.id);
|
|
302548
303136
|
if (!config)
|
|
@@ -302595,6 +303183,11 @@ async function createRecorderManager(appConfig) {
|
|
|
302595
303183
|
}, {
|
|
302596
303184
|
proxy: false,
|
|
302597
303185
|
});
|
|
303186
|
+
await sendRecorderExternalEvent("file_created", {
|
|
303187
|
+
filePath: filename,
|
|
303188
|
+
roomId: String(recorder.channelId),
|
|
303189
|
+
platform: recorder.providerId,
|
|
303190
|
+
});
|
|
302598
303191
|
recordHistory.addWithStreamer({
|
|
302599
303192
|
live_start_time: liveStartTime?.getTime(),
|
|
302600
303193
|
live_id: recorder?.liveInfo?.liveId,
|
|
@@ -302678,6 +303271,11 @@ async function createRecorderManager(appConfig) {
|
|
|
302678
303271
|
logObj.error("Update live error", { recorder, filename, error });
|
|
302679
303272
|
}
|
|
302680
303273
|
finally {
|
|
303274
|
+
await sendRecorderExternalEvent("file_completed", {
|
|
303275
|
+
filePath: filename,
|
|
303276
|
+
roomId: String(recorder.channelId),
|
|
303277
|
+
platform: recorder.providerId,
|
|
303278
|
+
});
|
|
302681
303279
|
if (data?.sendToWebhook) {
|
|
302682
303280
|
const webhookUrl = `http://127.0.0.1:${config.port}/webhook/custom`;
|
|
302683
303281
|
const payload = {
|
|
@@ -302986,16 +303584,18 @@ exports.DouyinDownloadVideoTask = DouyinDownloadVideoTask;
|
|
|
302986
303584
|
exports.FFmpegPreset = FFmpegPreset;
|
|
302987
303585
|
exports.FlvRepairTask = FlvRepairTask;
|
|
302988
303586
|
exports.FormData = FormData$2;
|
|
303587
|
+
exports.Headers = Headers$1;
|
|
302989
303588
|
exports.KuaishouDownloadVideoTask = KuaishouDownloadVideoTask;
|
|
302990
303589
|
exports.M3U8Downloader = M3U8Downloader;
|
|
302991
303590
|
exports.Pan123 = Pan123;
|
|
303591
|
+
exports.Request = Request$3;
|
|
303592
|
+
exports.Response = Response$1;
|
|
302992
303593
|
exports.SpeedCalculator = SpeedCalculator;
|
|
302993
303594
|
exports.SyncTask = SyncTask;
|
|
302994
303595
|
exports.Throttle = Throttle$1;
|
|
302995
303596
|
exports.TvQrcodeLogin = TvQrcodeLogin;
|
|
302996
303597
|
exports.TypedEmitter = TypedEmitter;
|
|
302997
303598
|
exports.VideoPreset = VideoPreset;
|
|
302998
|
-
exports._eval = _eval;
|
|
302999
303599
|
exports._send = _send;
|
|
303000
303600
|
exports.addExtractAudioTask = addExtractAudioTask;
|
|
303001
303601
|
exports.analyzeResolutionChanges = analyzeResolutionChanges;
|
|
@@ -303018,10 +303618,11 @@ exports.convertXml2Ass = convertXml2Ass;
|
|
|
303018
303618
|
exports.cut = cut;
|
|
303019
303619
|
exports.defaultRecordConfig = defaultRecordConfig;
|
|
303020
303620
|
exports.douyu = douyu;
|
|
303021
|
-
exports.
|
|
303621
|
+
exports.esDefineProperty = esDefineProperty;
|
|
303022
303622
|
exports.escaped = escaped;
|
|
303023
303623
|
exports.executeVirtualRecordConfig = executeVirtualRecordConfig;
|
|
303024
303624
|
exports.extension = extension$3;
|
|
303625
|
+
exports.fetch = fetch$2;
|
|
303025
303626
|
exports.formatDesc = formatDesc;
|
|
303026
303627
|
exports.formatPartTitle = formatPartTitle;
|
|
303027
303628
|
exports.formatTitle = formatTitle;
|
|
@@ -303032,10 +303633,12 @@ exports.getBinPath = getBinPath;
|
|
|
303032
303633
|
exports.getDefaultExportFromCjs = getDefaultExportFromCjs;
|
|
303033
303634
|
exports.getFileSize = getFileSize$1;
|
|
303034
303635
|
exports.getInfo = getInfo$1;
|
|
303636
|
+
exports.getIntrinsic = getIntrinsic;
|
|
303035
303637
|
exports.getStream = getStream$1;
|
|
303036
303638
|
exports.getTempPath = getTempPath;
|
|
303037
303639
|
exports.getToken = getToken;
|
|
303038
303640
|
exports.globParent = globParent$1;
|
|
303641
|
+
exports.gopd = gopd;
|
|
303039
303642
|
exports.handleKillTask = handleKillTask;
|
|
303040
303643
|
exports.handleListTask = handleListTask;
|
|
303041
303644
|
exports.handlePauseTask = handlePauseTask;
|
|
@@ -303045,7 +303648,6 @@ exports.handleRestartTask = handleRestartTask;
|
|
|
303045
303648
|
exports.handleResumeTask = handleResumeTask;
|
|
303046
303649
|
exports.handleStartTask = handleStartTask;
|
|
303047
303650
|
exports.hanldeInterruptTask = hanldeInterruptTask;
|
|
303048
|
-
exports.hasown = hasown;
|
|
303049
303651
|
exports.huya = huya;
|
|
303050
303652
|
exports.index = index;
|
|
303051
303653
|
exports.inheritsExports = inheritsExports;
|
|
@@ -303065,18 +303667,18 @@ exports.parseMeta = parseMeta;
|
|
|
303065
303667
|
exports.parseSavePath = parseSavePath;
|
|
303066
303668
|
exports.permessageDeflate = permessageDeflate$1;
|
|
303067
303669
|
exports.pick = pick;
|
|
303068
|
-
exports.
|
|
303670
|
+
exports.picomatch = picomatch$1;
|
|
303069
303671
|
exports.readVideoMeta = readVideoMeta;
|
|
303070
303672
|
exports.readXmlTimestamp = readXmlTimestamp;
|
|
303071
303673
|
exports.reconnectDB = reconnectDB;
|
|
303072
303674
|
exports.recordHistory = recordHistory;
|
|
303073
|
-
exports.ref = ref;
|
|
303074
303675
|
exports.replaceExtName = replaceExtName$1;
|
|
303075
303676
|
exports.replaceFourByteUnicode = replaceFourByteUnicode;
|
|
303076
303677
|
exports.requireMs = requireMs$1;
|
|
303077
303678
|
exports.requireSupportsColor = requireSupportsColor;
|
|
303679
|
+
exports.requireType = requireType$1;
|
|
303680
|
+
exports.safeBufferExports = safeBufferExports;
|
|
303078
303681
|
exports.shams = shams;
|
|
303079
|
-
exports.shams$1 = shams$1;
|
|
303080
303682
|
exports.sleep = sleep;
|
|
303081
303683
|
exports.sleep$1 = sleep$1;
|
|
303082
303684
|
exports.srcExports = srcExports$2;
|
|
@@ -303085,8 +303687,6 @@ exports.taskQueue = taskQueue;
|
|
|
303085
303687
|
exports.testVirtualRecordConfig = testVirtualRecordConfig;
|
|
303086
303688
|
exports.transcode = transcode;
|
|
303087
303689
|
exports.trashItem = trashItem;
|
|
303088
|
-
exports.type = type$2;
|
|
303089
|
-
exports.uri = uri;
|
|
303090
303690
|
exports.uuid = uuid$4;
|
|
303091
303691
|
exports.validateBiliupConfig = validateBiliupConfig;
|
|
303092
303692
|
exports.validationExports = validationExports;
|