bililive-cli 3.13.0 → 3.14.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.
|
@@ -4,7 +4,7 @@ var path$7 = require('node:path');
|
|
|
4
4
|
var require$$2$1 = require('node:http');
|
|
5
5
|
var require$$1$2 = require('node:url');
|
|
6
6
|
var a = require('node:https');
|
|
7
|
-
var index = require('./index-
|
|
7
|
+
var index = require('./index-DnN22ZAd.cjs');
|
|
8
8
|
var require$$0$4 = require('tty');
|
|
9
9
|
var require$$1$3 = require('util');
|
|
10
10
|
var require$$0$b = require('assert');
|
|
@@ -13968,9 +13968,9 @@ for (const method of methods$1) {
|
|
|
13968
13968
|
|
|
13969
13969
|
Router.prototype.del = Router.prototype['delete'];
|
|
13970
13970
|
|
|
13971
|
-
var router$
|
|
13971
|
+
var router$i = Router;
|
|
13972
13972
|
|
|
13973
|
-
var Router$1 = /*@__PURE__*/index.getDefaultExportFromCjs(router$
|
|
13973
|
+
var Router$1 = /*@__PURE__*/index.getDefaultExportFromCjs(router$i);
|
|
13974
13974
|
|
|
13975
13975
|
const vary = varyExports;
|
|
13976
13976
|
|
|
@@ -30882,11 +30882,11 @@ var recorderService = {
|
|
|
30882
30882
|
resolve,
|
|
30883
30883
|
};
|
|
30884
30884
|
|
|
30885
|
-
const router$
|
|
30886
|
-
router$
|
|
30885
|
+
const router$h = new Router$1();
|
|
30886
|
+
router$h.get("/webhook", async (ctx) => {
|
|
30887
30887
|
ctx.body = "webhook 服务器已启动";
|
|
30888
30888
|
});
|
|
30889
|
-
router$
|
|
30889
|
+
router$h.post("/webhook/bililiverecorder", async (ctx) => {
|
|
30890
30890
|
const config = exports.appConfig.getAll();
|
|
30891
30891
|
index.logObj.info("录播姬:", ctx.request.body);
|
|
30892
30892
|
const event = ctx.request.body;
|
|
@@ -30915,7 +30915,7 @@ router$g.post("/webhook/bililiverecorder", async (ctx) => {
|
|
|
30915
30915
|
}
|
|
30916
30916
|
ctx.body = "ok";
|
|
30917
30917
|
});
|
|
30918
|
-
router$
|
|
30918
|
+
router$h.post("/webhook/blrec", async (ctx) => {
|
|
30919
30919
|
const webhook = exports.appConfig.get("webhook");
|
|
30920
30920
|
index.logObj.info("blrec webhook:", ctx.request.body);
|
|
30921
30921
|
const event = ctx.request.body;
|
|
@@ -30950,7 +30950,7 @@ router$g.post("/webhook/blrec", async (ctx) => {
|
|
|
30950
30950
|
* OneLiveRec webhook事件处理
|
|
30951
30951
|
* 由于只有在结束后才能从文件的备注中获取到,只处理结束事件获取信息后模拟开始和结束事件
|
|
30952
30952
|
*/
|
|
30953
|
-
router$
|
|
30953
|
+
router$h.post("/webhook/oneliverec", async (ctx) => {
|
|
30954
30954
|
const webhook = exports.appConfig.get("webhook");
|
|
30955
30955
|
index.logObj.info("oneliverec webhook:", ctx.request.body);
|
|
30956
30956
|
const event = ctx.request.body;
|
|
@@ -30986,7 +30986,7 @@ router$g.post("/webhook/oneliverec", async (ctx) => {
|
|
|
30986
30986
|
}
|
|
30987
30987
|
ctx.body = "ok";
|
|
30988
30988
|
});
|
|
30989
|
-
router$
|
|
30989
|
+
router$h.post("/webhook/ddtv", async (ctx) => {
|
|
30990
30990
|
const webhook = exports.appConfig.get("webhook");
|
|
30991
30991
|
const event = ctx.request.body;
|
|
30992
30992
|
if (webhook?.open && (event.cmd === "RecordingEnd" || event.cmd === "StartRecording")) {
|
|
@@ -31044,7 +31044,7 @@ const getDDTVTrueFile = (event) => {
|
|
|
31044
31044
|
danmuFile: danmuFileTruePath,
|
|
31045
31045
|
};
|
|
31046
31046
|
};
|
|
31047
|
-
router$
|
|
31047
|
+
router$h.post("/webhook/custom", async (ctx) => {
|
|
31048
31048
|
const webhook = exports.appConfig.get("webhook");
|
|
31049
31049
|
index.logObj.info("custom: webhook", ctx.request.body);
|
|
31050
31050
|
const event = ctx.request.body;
|
|
@@ -31093,7 +31093,7 @@ async function checkFileInterval() {
|
|
|
31093
31093
|
}
|
|
31094
31094
|
}, 1000 * 60);
|
|
31095
31095
|
}
|
|
31096
|
-
router$
|
|
31096
|
+
router$h.get("/bili/stream", async (ctx) => {
|
|
31097
31097
|
const { id } = ctx.query;
|
|
31098
31098
|
try {
|
|
31099
31099
|
const m3u8Content = await recorderService.getBiliStream(id);
|
|
@@ -49108,21 +49108,21 @@ function makePromise(multer, name) {
|
|
|
49108
49108
|
multer.diskStorage = originalMulter.diskStorage;
|
|
49109
49109
|
multer.memoryStorage = originalMulter.memoryStorage;
|
|
49110
49110
|
|
|
49111
|
-
const router$
|
|
49111
|
+
const router$g = new Router$1({
|
|
49112
49112
|
prefix: "/config",
|
|
49113
49113
|
});
|
|
49114
49114
|
const upload$1 = multer({ dest: os$1.tmpdir() });
|
|
49115
|
-
router$
|
|
49115
|
+
router$g.get("/", async (ctx) => {
|
|
49116
49116
|
const config = exports.appConfig.getAll();
|
|
49117
49117
|
ctx.body = config;
|
|
49118
49118
|
});
|
|
49119
|
-
router$
|
|
49119
|
+
router$g.post("/", async (ctx) => {
|
|
49120
49120
|
const data = ctx.request.body;
|
|
49121
49121
|
// @ts-ignore
|
|
49122
49122
|
exports.appConfig.setAll(data);
|
|
49123
49123
|
ctx.body = "success";
|
|
49124
49124
|
});
|
|
49125
|
-
router$
|
|
49125
|
+
router$g.post("/set", async (ctx) => {
|
|
49126
49126
|
const data = ctx.request.body;
|
|
49127
49127
|
if (!data.key || !data.value) {
|
|
49128
49128
|
ctx.body = "key and value is required";
|
|
@@ -49132,7 +49132,7 @@ router$f.post("/set", async (ctx) => {
|
|
|
49132
49132
|
exports.appConfig.set(data.key, data.value);
|
|
49133
49133
|
ctx.body = "success";
|
|
49134
49134
|
});
|
|
49135
|
-
router$
|
|
49135
|
+
router$g.post("/verifyBiliKey", async (ctx) => {
|
|
49136
49136
|
try {
|
|
49137
49137
|
const serverKey = process.env.BILILIVE_TOOLS_BILIKEY;
|
|
49138
49138
|
const configured = typeof serverKey === "string" && serverKey.trim().length > 0;
|
|
@@ -49176,7 +49176,7 @@ router$f.post("/verifyBiliKey", async (ctx) => {
|
|
|
49176
49176
|
ctx.body = response;
|
|
49177
49177
|
}
|
|
49178
49178
|
});
|
|
49179
|
-
router$
|
|
49179
|
+
router$g.post("/resetBin", async (ctx) => {
|
|
49180
49180
|
const data = ctx.request.body;
|
|
49181
49181
|
const type = data.type;
|
|
49182
49182
|
if (!type) {
|
|
@@ -49233,7 +49233,7 @@ async function exportConfig(opts) {
|
|
|
49233
49233
|
const content = zip.generateNodeStream({ type: "nodebuffer" });
|
|
49234
49234
|
return content;
|
|
49235
49235
|
}
|
|
49236
|
-
router$
|
|
49236
|
+
router$g.get("/export", async (ctx) => {
|
|
49237
49237
|
try {
|
|
49238
49238
|
const globalConfig = exports.container.resolve("globalConfig");
|
|
49239
49239
|
const { configPath, videoPresetPath, danmuPresetPath, ffmpegPresetPath, userDataPath } = globalConfig;
|
|
@@ -49266,7 +49266,7 @@ router$f.get("/export", async (ctx) => {
|
|
|
49266
49266
|
ctx.body = "export error";
|
|
49267
49267
|
}
|
|
49268
49268
|
});
|
|
49269
|
-
router$
|
|
49269
|
+
router$g.post("/import", upload$1.single("file"), async (ctx) => {
|
|
49270
49270
|
const file = ctx.request?.file?.path;
|
|
49271
49271
|
if (!file) {
|
|
49272
49272
|
ctx.status = 400;
|
|
@@ -49325,7 +49325,7 @@ router$f.post("/import", upload$1.single("file"), async (ctx) => {
|
|
|
49325
49325
|
}));
|
|
49326
49326
|
ctx.body = "success";
|
|
49327
49327
|
});
|
|
49328
|
-
router$
|
|
49328
|
+
router$g.post("/notifyTest", async (ctx) => {
|
|
49329
49329
|
const { title, desp, options, notifyType } = ctx.request.body;
|
|
49330
49330
|
await index._send(title, desp, options, notifyType);
|
|
49331
49331
|
ctx.body = "success";
|
|
@@ -54117,15 +54117,15 @@ async function handleSrt(input, output) {
|
|
|
54117
54117
|
return nodes;
|
|
54118
54118
|
}
|
|
54119
54119
|
|
|
54120
|
-
const router$
|
|
54120
|
+
const router$f = new Router$1({
|
|
54121
54121
|
prefix: "/llm",
|
|
54122
54122
|
});
|
|
54123
|
-
router$
|
|
54123
|
+
router$f.get("/ollama/modelList", async (ctx) => {
|
|
54124
54124
|
const data = ctx.request.query;
|
|
54125
54125
|
const models = (await ollama.getModelList(data.baseUrl)).models.map((item) => item.name);
|
|
54126
54126
|
ctx.body = models;
|
|
54127
54127
|
});
|
|
54128
|
-
router$
|
|
54128
|
+
router$f.post("/translate", async (ctx) => {
|
|
54129
54129
|
const data = ctx.request.body;
|
|
54130
54130
|
console.log(data);
|
|
54131
54131
|
const content = await addTranslateTask(data.input, data.output);
|
|
@@ -55050,55 +55050,47 @@ const coerce$1 = (version, options) => {
|
|
|
55050
55050
|
};
|
|
55051
55051
|
var coerce_1 = coerce$1;
|
|
55052
55052
|
|
|
55053
|
-
|
|
55054
|
-
|
|
55055
|
-
|
|
55056
|
-
|
|
55057
|
-
|
|
55058
|
-
hasRequiredLrucache = 1;
|
|
55059
|
-
class LRUCache {
|
|
55060
|
-
constructor () {
|
|
55061
|
-
this.max = 1000;
|
|
55062
|
-
this.map = new Map();
|
|
55063
|
-
}
|
|
55064
|
-
|
|
55065
|
-
get (key) {
|
|
55066
|
-
const value = this.map.get(key);
|
|
55067
|
-
if (value === undefined) {
|
|
55068
|
-
return undefined
|
|
55069
|
-
} else {
|
|
55070
|
-
// Remove the key from the map and add it to the end
|
|
55071
|
-
this.map.delete(key);
|
|
55072
|
-
this.map.set(key, value);
|
|
55073
|
-
return value
|
|
55074
|
-
}
|
|
55075
|
-
}
|
|
55053
|
+
class LRUCache {
|
|
55054
|
+
constructor () {
|
|
55055
|
+
this.max = 1000;
|
|
55056
|
+
this.map = new Map();
|
|
55057
|
+
}
|
|
55076
55058
|
|
|
55077
|
-
|
|
55078
|
-
|
|
55079
|
-
|
|
55059
|
+
get (key) {
|
|
55060
|
+
const value = this.map.get(key);
|
|
55061
|
+
if (value === undefined) {
|
|
55062
|
+
return undefined
|
|
55063
|
+
} else {
|
|
55064
|
+
// Remove the key from the map and add it to the end
|
|
55065
|
+
this.map.delete(key);
|
|
55066
|
+
this.map.set(key, value);
|
|
55067
|
+
return value
|
|
55068
|
+
}
|
|
55069
|
+
}
|
|
55080
55070
|
|
|
55081
|
-
|
|
55082
|
-
|
|
55071
|
+
delete (key) {
|
|
55072
|
+
return this.map.delete(key)
|
|
55073
|
+
}
|
|
55083
55074
|
|
|
55084
|
-
|
|
55085
|
-
|
|
55086
|
-
if (this.map.size >= this.max) {
|
|
55087
|
-
const firstKey = this.map.keys().next().value;
|
|
55088
|
-
this.delete(firstKey);
|
|
55089
|
-
}
|
|
55075
|
+
set (key, value) {
|
|
55076
|
+
const deleted = this.delete(key);
|
|
55090
55077
|
|
|
55091
|
-
|
|
55092
|
-
|
|
55078
|
+
if (!deleted && value !== undefined) {
|
|
55079
|
+
// If cache is full, delete the least recently used item
|
|
55080
|
+
if (this.map.size >= this.max) {
|
|
55081
|
+
const firstKey = this.map.keys().next().value;
|
|
55082
|
+
this.delete(firstKey);
|
|
55083
|
+
}
|
|
55093
55084
|
|
|
55094
|
-
|
|
55095
|
-
|
|
55096
|
-
}
|
|
55085
|
+
this.map.set(key, value);
|
|
55086
|
+
}
|
|
55097
55087
|
|
|
55098
|
-
|
|
55099
|
-
|
|
55088
|
+
return this
|
|
55089
|
+
}
|
|
55100
55090
|
}
|
|
55101
55091
|
|
|
55092
|
+
var lrucache = LRUCache;
|
|
55093
|
+
|
|
55102
55094
|
var range;
|
|
55103
55095
|
var hasRequiredRange;
|
|
55104
55096
|
|
|
@@ -55319,7 +55311,7 @@ function requireRange () {
|
|
|
55319
55311
|
|
|
55320
55312
|
range = Range;
|
|
55321
55313
|
|
|
55322
|
-
const LRU =
|
|
55314
|
+
const LRU = lrucache;
|
|
55323
55315
|
const cache = new LRU();
|
|
55324
55316
|
|
|
55325
55317
|
const parseOptions = parseOptions_1;
|
|
@@ -56444,11 +56436,10 @@ var semver = {
|
|
|
56444
56436
|
|
|
56445
56437
|
var semver$1 = /*@__PURE__*/index.getDefaultExportFromCjs(semver);
|
|
56446
56438
|
|
|
56447
|
-
const router$
|
|
56439
|
+
const router$e = new Router$1({
|
|
56448
56440
|
prefix: "/common",
|
|
56449
56441
|
});
|
|
56450
|
-
|
|
56451
|
-
router$d.get("/version", (ctx) => {
|
|
56442
|
+
router$e.get("/version", (ctx) => {
|
|
56452
56443
|
ctx.body = exports.config.version;
|
|
56453
56444
|
});
|
|
56454
56445
|
function getDriveLetters() {
|
|
@@ -56470,7 +56461,7 @@ function getDriveLetters() {
|
|
|
56470
56461
|
function isDriveLetter(letter) {
|
|
56471
56462
|
return /^[a-zA-Z]:\\$/.test(letter);
|
|
56472
56463
|
}
|
|
56473
|
-
router$
|
|
56464
|
+
router$e.get("/files", async (ctx) => {
|
|
56474
56465
|
const params = ctx.request.query;
|
|
56475
56466
|
let root = params.path;
|
|
56476
56467
|
const filterExts = (params.exts || "")
|
|
@@ -56526,56 +56517,26 @@ router$d.get("/files", async (ctx) => {
|
|
|
56526
56517
|
return;
|
|
56527
56518
|
}
|
|
56528
56519
|
});
|
|
56529
|
-
router$
|
|
56530
|
-
const { dir, name } = ctx.request.body;
|
|
56531
|
-
if (!index.fs.existsSync(dir)) {
|
|
56532
|
-
ctx.status = 400;
|
|
56533
|
-
ctx.body = "文件夹不存在";
|
|
56534
|
-
return;
|
|
56535
|
-
}
|
|
56536
|
-
const filePath = path$7.join(dir, name);
|
|
56537
|
-
ctx.body = filePath;
|
|
56538
|
-
});
|
|
56539
|
-
router$d.post("/danma/timestamp", async (ctx) => {
|
|
56520
|
+
router$e.post("/danma/timestamp", async (ctx) => {
|
|
56540
56521
|
const { filepath } = ctx.request.body;
|
|
56541
56522
|
ctx.body = await index.readXmlTimestamp(filepath);
|
|
56542
56523
|
});
|
|
56543
|
-
router$
|
|
56524
|
+
router$e.post("/parseVideoMetadata", async (ctx) => {
|
|
56544
56525
|
const files = ctx.request.body;
|
|
56545
56526
|
ctx.body = await index.parseMeta(files);
|
|
56546
56527
|
});
|
|
56547
56528
|
/**
|
|
56548
56529
|
* @api {get} /common/fonts 获取系统字体列表
|
|
56549
56530
|
*/
|
|
56550
|
-
router$
|
|
56531
|
+
router$e.get("/fonts", async (ctx) => {
|
|
56551
56532
|
const { getFontsList } = await Promise.resolve().then(function () { return require('./fonts-DxTEygXH.cjs'); });
|
|
56552
56533
|
ctx.body = await getFontsList();
|
|
56553
56534
|
});
|
|
56554
|
-
router$
|
|
56555
|
-
const file = ctx.request?.file?.path;
|
|
56556
|
-
if (!file) {
|
|
56557
|
-
ctx.status = 400;
|
|
56558
|
-
ctx.body = "No file selected";
|
|
56559
|
-
return;
|
|
56560
|
-
}
|
|
56561
|
-
const originalname = ctx.request?.file?.originalname;
|
|
56562
|
-
const ext = path$7.extname(originalname);
|
|
56563
|
-
const coverPath = path$7.join(exports.config.userDataPath, "cover");
|
|
56564
|
-
const outputName = `${index.uuid()}${ext}`;
|
|
56565
|
-
// 将图片复制到指定目录
|
|
56566
|
-
await index.fs.ensureDir(coverPath);
|
|
56567
|
-
await index.fs.copyFile(file, path$7.join(coverPath, outputName));
|
|
56568
|
-
await index.fs.remove(file).catch(() => { });
|
|
56569
|
-
ctx.body = {
|
|
56570
|
-
name: outputName,
|
|
56571
|
-
path: `/assets/cover/${outputName}`,
|
|
56572
|
-
};
|
|
56573
|
-
});
|
|
56574
|
-
router$d.get("/appStartTime", async (ctx) => {
|
|
56535
|
+
router$e.get("/appStartTime", async (ctx) => {
|
|
56575
56536
|
const data = index.statisticsService.query("start_time");
|
|
56576
56537
|
ctx.body = data?.value;
|
|
56577
56538
|
});
|
|
56578
|
-
router$
|
|
56539
|
+
router$e.get("/statistics", async (ctx) => {
|
|
56579
56540
|
const startTime = index.statisticsService.query("start_time");
|
|
56580
56541
|
const videoTotalDuaration = index.recordHistoryService.getTotalDuration();
|
|
56581
56542
|
const recordingNum = recorderService.getRecorderNum(true);
|
|
@@ -56587,16 +56548,16 @@ router$d.get("/statistics", async (ctx) => {
|
|
|
56587
56548
|
recorderNum,
|
|
56588
56549
|
};
|
|
56589
56550
|
});
|
|
56590
|
-
router$
|
|
56551
|
+
router$e.get("/exportLogs", async (ctx) => {
|
|
56591
56552
|
const logFilePath = exports.config.logPath;
|
|
56592
56553
|
ctx.body = index.fs.createReadStream(logFilePath);
|
|
56593
56554
|
});
|
|
56594
|
-
router$
|
|
56555
|
+
router$e.get("/getLogContent", async (ctx) => {
|
|
56595
56556
|
const logFilePath = exports.config.logPath;
|
|
56596
56557
|
const content = await index.fs.readFile(logFilePath, "utf-8");
|
|
56597
56558
|
ctx.body = content;
|
|
56598
56559
|
});
|
|
56599
|
-
router$
|
|
56560
|
+
router$e.post("/readDanma", async (ctx) => {
|
|
56600
56561
|
const { filepath } = ctx.request.body;
|
|
56601
56562
|
// 只允许读取ass或xml文件
|
|
56602
56563
|
if (!filepath.endsWith(".ass") && !filepath.endsWith(".xml") && !filepath.endsWith(".srt")) {
|
|
@@ -56612,7 +56573,7 @@ router$d.post("/readDanma", async (ctx) => {
|
|
|
56612
56573
|
const content = await index.fs.readFile(filepath, "utf-8");
|
|
56613
56574
|
ctx.body = content;
|
|
56614
56575
|
});
|
|
56615
|
-
router$
|
|
56576
|
+
router$e.post("/readLLC", async (ctx) => {
|
|
56616
56577
|
const { filepath } = ctx.request.body;
|
|
56617
56578
|
if (!(await index.fs.pathExists(filepath))) {
|
|
56618
56579
|
ctx.status = 400;
|
|
@@ -56627,7 +56588,7 @@ router$d.post("/readLLC", async (ctx) => {
|
|
|
56627
56588
|
}
|
|
56628
56589
|
ctx.body = content;
|
|
56629
56590
|
});
|
|
56630
|
-
router$
|
|
56591
|
+
router$e.post("/writeLLC", async (ctx) => {
|
|
56631
56592
|
const { filepath, content } = ctx.request.body;
|
|
56632
56593
|
if (!content.includes("cutSegments")) {
|
|
56633
56594
|
ctx.status = 400;
|
|
@@ -56637,18 +56598,13 @@ router$d.post("/writeLLC", async (ctx) => {
|
|
|
56637
56598
|
await index.fs.writeFile(filepath, content, "utf-8");
|
|
56638
56599
|
ctx.body = "success";
|
|
56639
56600
|
});
|
|
56640
|
-
router$
|
|
56641
|
-
const { filepath } = ctx.request.body;
|
|
56642
|
-
const exists = await index.fs.pathExists(filepath);
|
|
56643
|
-
ctx.body = exists;
|
|
56644
|
-
});
|
|
56645
|
-
router$d.post("/genTimeData", async (ctx) => {
|
|
56601
|
+
router$e.post("/genTimeData", async (ctx) => {
|
|
56646
56602
|
const { filepath } = ctx.request.body;
|
|
56647
56603
|
const data = await index.genTimeData(filepath);
|
|
56648
56604
|
ctx.body = data;
|
|
56649
56605
|
});
|
|
56650
56606
|
// 申请视频ID接口
|
|
56651
|
-
router$
|
|
56607
|
+
router$e.post("/applyVideoId", async (ctx) => {
|
|
56652
56608
|
const { videoPath } = ctx.request.body;
|
|
56653
56609
|
if (!(await index.fs.pathExists(videoPath))) {
|
|
56654
56610
|
ctx.status = 404;
|
|
@@ -56690,6 +56646,7 @@ router$d.post("/apply-video-id", async (ctx) => {
|
|
|
56690
56646
|
const expireAt = Date.now() + 24 * 60 * 60 * 1000;
|
|
56691
56647
|
// 存储ID和视频路径的映射关系
|
|
56692
56648
|
fileCache.set(videoId, { path: videoPath, expireAt });
|
|
56649
|
+
// 这玩意不能轻易改,空就是默认值
|
|
56693
56650
|
let type = "";
|
|
56694
56651
|
switch (extname) {
|
|
56695
56652
|
case ".flv":
|
|
@@ -56705,7 +56662,7 @@ router$d.post("/apply-video-id", async (ctx) => {
|
|
|
56705
56662
|
type,
|
|
56706
56663
|
};
|
|
56707
56664
|
});
|
|
56708
|
-
router$
|
|
56665
|
+
router$e.get("/video/:videoId", async (ctx) => {
|
|
56709
56666
|
const videoId = ctx.params.videoId;
|
|
56710
56667
|
// 从映射表中获取视频路径
|
|
56711
56668
|
const videoInfo = fileCache.get(videoId);
|
|
@@ -56774,12 +56731,12 @@ router$d.get("/video/:videoId", async (ctx) => {
|
|
|
56774
56731
|
ctx.body = index.fs.createReadStream(videoPath);
|
|
56775
56732
|
}
|
|
56776
56733
|
});
|
|
56777
|
-
router$
|
|
56734
|
+
router$e.post("/parseDanmu", async (ctx) => {
|
|
56778
56735
|
const { filepath } = ctx.request.body;
|
|
56779
56736
|
const data = await index.parseDanmu(filepath);
|
|
56780
56737
|
ctx.body = data;
|
|
56781
56738
|
});
|
|
56782
|
-
router$
|
|
56739
|
+
router$e.post("/testWebhook", async (ctx) => {
|
|
56783
56740
|
const list = [];
|
|
56784
56741
|
// 检查所有live数据,如果存在同一个live中,前一个part还在录制中,但是后面的part已经是其他状态,则返回相关id以及文件
|
|
56785
56742
|
const liveList = exports.handler.liveData;
|
|
@@ -56801,7 +56758,7 @@ router$d.post("/testWebhook", async (ctx) => {
|
|
|
56801
56758
|
}
|
|
56802
56759
|
ctx.body = list;
|
|
56803
56760
|
});
|
|
56804
|
-
router$
|
|
56761
|
+
router$e.post("/handleWebhook", async (ctx) => {
|
|
56805
56762
|
const { data } = ctx.request.body;
|
|
56806
56763
|
const liveList = exports.handler.liveData;
|
|
56807
56764
|
for (const live of liveList) {
|
|
@@ -56817,7 +56774,7 @@ router$d.post("/handleWebhook", async (ctx) => {
|
|
|
56817
56774
|
}
|
|
56818
56775
|
ctx.body = "success";
|
|
56819
56776
|
});
|
|
56820
|
-
router$
|
|
56777
|
+
router$e.post("/webhook", async (ctx) => {
|
|
56821
56778
|
const liveList = exports.handler.liveData;
|
|
56822
56779
|
ctx.body = liveList;
|
|
56823
56780
|
});
|
|
@@ -56827,7 +56784,7 @@ router$d.post("/webhook", async (ctx) => {
|
|
|
56827
56784
|
* 如果不是,检查全局webhook配置,判断是否开启全局开关,判断是否在黑名单,判断配置是否配置了上传预设,上传账号
|
|
56828
56785
|
* 返回{hasError:boolean,errorInfo:string}
|
|
56829
56786
|
*/
|
|
56830
|
-
router$
|
|
56787
|
+
router$e.get("/whyUploadFailed", async (ctx) => {
|
|
56831
56788
|
const { roomId } = ctx.request.query;
|
|
56832
56789
|
if (!roomId) {
|
|
56833
56790
|
ctx.status = 400;
|
|
@@ -56984,7 +56941,7 @@ router$d.get("/whyUploadFailed", async (ctx) => {
|
|
|
56984
56941
|
* @apiSuccess {boolean} needUpdate 是否需要更新
|
|
56985
56942
|
* @apiSuccess {string} [downloadUrl] 下载地址
|
|
56986
56943
|
*/
|
|
56987
|
-
router$
|
|
56944
|
+
router$e.get("/checkUpdate", async (ctx) => {
|
|
56988
56945
|
try {
|
|
56989
56946
|
const res = await fetch("https://githubraw.irenmu.com/renmu123/biliLive-tools/master/package.json");
|
|
56990
56947
|
const data = await res.json();
|
|
@@ -57009,31 +56966,15 @@ router$d.get("/checkUpdate", async (ctx) => {
|
|
|
57009
56966
|
};
|
|
57010
56967
|
}
|
|
57011
56968
|
});
|
|
57012
|
-
/**
|
|
57013
|
-
* @api {get} /common/tempPath 获取缓存文件夹路径
|
|
57014
|
-
* @apiDescription 获取当前配置的缓存文件夹路径
|
|
57015
|
-
* @apiSuccess {string} path 缓存文件夹路径
|
|
57016
|
-
*/
|
|
57017
|
-
router$d.get("/tempPath", async (ctx) => {
|
|
57018
|
-
try {
|
|
57019
|
-
const tempPath = index.getTempPath();
|
|
57020
|
-
ctx.body = tempPath;
|
|
57021
|
-
}
|
|
57022
|
-
catch (error) {
|
|
57023
|
-
console.error("获取缓存路径失败:", error);
|
|
57024
|
-
ctx.status = 500;
|
|
57025
|
-
ctx.body = "获取缓存路径失败";
|
|
57026
|
-
}
|
|
57027
|
-
});
|
|
57028
56969
|
/**
|
|
57029
56970
|
* @api {get} /common/diskSpace 获取磁盘空间信息
|
|
57030
|
-
* @apiDescription
|
|
56971
|
+
* @apiDescription 获取录制文件夹所在磁盘的空间信息
|
|
57031
56972
|
* @apiSuccess {number} total 总空间(GB)
|
|
57032
56973
|
* @apiSuccess {number} free 可用空间(GB)
|
|
57033
56974
|
* @apiSuccess {number} used 已用空间(GB)
|
|
57034
56975
|
* @apiSuccess {number} usedPercentage 使用百分比
|
|
57035
56976
|
*/
|
|
57036
|
-
router$
|
|
56977
|
+
router$e.get("/diskSpace", async (ctx) => {
|
|
57037
56978
|
try {
|
|
57038
56979
|
const config = exports.appConfig.getAll();
|
|
57039
56980
|
const recoderFolder = config?.recorder?.savePath;
|
|
@@ -57067,10 +57008,10 @@ router$d.get("/diskSpace", async (ctx) => {
|
|
|
57067
57008
|
}
|
|
57068
57009
|
});
|
|
57069
57010
|
|
|
57070
|
-
const router$
|
|
57011
|
+
const router$d = new Router$1({
|
|
57071
57012
|
prefix: "/user",
|
|
57072
57013
|
});
|
|
57073
|
-
router$
|
|
57014
|
+
router$d.get("/list", async (ctx) => {
|
|
57074
57015
|
const list = index.biliApi.readUserList();
|
|
57075
57016
|
ctx.body = list.map((item) => {
|
|
57076
57017
|
return {
|
|
@@ -57081,22 +57022,22 @@ router$c.get("/list", async (ctx) => {
|
|
|
57081
57022
|
};
|
|
57082
57023
|
});
|
|
57083
57024
|
});
|
|
57084
|
-
router$
|
|
57025
|
+
router$d.post("/delete", async (ctx) => {
|
|
57085
57026
|
const { uid } = ctx.request.body;
|
|
57086
57027
|
await index.biliApi.deleteUser(uid);
|
|
57087
57028
|
ctx.status = 200;
|
|
57088
57029
|
});
|
|
57089
|
-
router$
|
|
57030
|
+
router$d.post("/update", async (ctx) => {
|
|
57090
57031
|
const { uid } = ctx.request.body;
|
|
57091
57032
|
await index.biliApi.updateUserInfo(uid);
|
|
57092
57033
|
ctx.status = 200;
|
|
57093
57034
|
});
|
|
57094
|
-
router$
|
|
57035
|
+
router$d.post("/update_auth", async (ctx) => {
|
|
57095
57036
|
const { uid } = ctx.request.body;
|
|
57096
57037
|
await index.biliApi.updateAuth(uid);
|
|
57097
57038
|
ctx.status = 200;
|
|
57098
57039
|
});
|
|
57099
|
-
router$
|
|
57040
|
+
router$d.post("/get_cookie", async (ctx) => {
|
|
57100
57041
|
const { uid, timestamp, signature } = ctx.request.body;
|
|
57101
57042
|
const currentTimestamp = Math.floor(Date.now() / 1000);
|
|
57102
57043
|
if (Math.abs(currentTimestamp - timestamp) > 10) {
|
|
@@ -57127,11 +57068,11 @@ router$c.post("/get_cookie", async (ctx) => {
|
|
|
57127
57068
|
ctx.body = "获取失败,请重试";
|
|
57128
57069
|
}
|
|
57129
57070
|
});
|
|
57130
|
-
router$
|
|
57071
|
+
router$d.get("/export", async (ctx) => {
|
|
57131
57072
|
const list = index.biliApi.readUserList();
|
|
57132
57073
|
ctx.body = list;
|
|
57133
57074
|
});
|
|
57134
|
-
router$
|
|
57075
|
+
router$d.post("/export_single", async (ctx) => {
|
|
57135
57076
|
const { uid } = ctx.request.body;
|
|
57136
57077
|
const user = index.biliApi.readUser(uid);
|
|
57137
57078
|
if (!user) {
|
|
@@ -57141,7 +57082,7 @@ router$c.post("/export_single", async (ctx) => {
|
|
|
57141
57082
|
}
|
|
57142
57083
|
ctx.body = user;
|
|
57143
57084
|
});
|
|
57144
|
-
router$
|
|
57085
|
+
router$d.post("/import", async (ctx) => {
|
|
57145
57086
|
const { users } = ctx.request.body;
|
|
57146
57087
|
if (!Array.isArray(users)) {
|
|
57147
57088
|
ctx.status = 400;
|
|
@@ -57158,7 +57099,7 @@ router$c.post("/import", async (ctx) => {
|
|
|
57158
57099
|
}
|
|
57159
57100
|
ctx.status = 200;
|
|
57160
57101
|
});
|
|
57161
|
-
router$
|
|
57102
|
+
router$d.post("/import_single", async (ctx) => {
|
|
57162
57103
|
const { user } = ctx.request.body;
|
|
57163
57104
|
if (!user?.mid || !user?.accessToken || !user?.refreshToken || !user?.cookie) {
|
|
57164
57105
|
ctx.status = 400;
|
|
@@ -57169,103 +57110,103 @@ router$c.post("/import_single", async (ctx) => {
|
|
|
57169
57110
|
ctx.status = 200;
|
|
57170
57111
|
});
|
|
57171
57112
|
|
|
57172
|
-
const router$
|
|
57113
|
+
const router$c = new Router$1({
|
|
57173
57114
|
prefix: "/preset",
|
|
57174
57115
|
});
|
|
57175
57116
|
////////////////// 弹幕预设 ///////////////////////////////
|
|
57176
|
-
router$
|
|
57117
|
+
router$c.get("/danmu", async (ctx) => {
|
|
57177
57118
|
const danmuPreset = exports.container.resolve("danmuPreset");
|
|
57178
57119
|
ctx.body = await danmuPreset.list();
|
|
57179
57120
|
});
|
|
57180
|
-
router$
|
|
57121
|
+
router$c.get("/danmu/:id", async (ctx) => {
|
|
57181
57122
|
const danmuPreset = exports.container.resolve("danmuPreset");
|
|
57182
57123
|
ctx.body = await danmuPreset.get(ctx.params.id);
|
|
57183
57124
|
});
|
|
57184
|
-
router$
|
|
57125
|
+
router$c.post("/danmu", async (ctx) => {
|
|
57185
57126
|
const danmuPreset = exports.container.resolve("danmuPreset");
|
|
57186
57127
|
const data = ctx.request.body;
|
|
57187
57128
|
ctx.body = await danmuPreset.save(data);
|
|
57188
57129
|
});
|
|
57189
|
-
router$
|
|
57130
|
+
router$c.del("/danmu/:id", async (ctx) => {
|
|
57190
57131
|
const danmuPreset = exports.container.resolve("danmuPreset");
|
|
57191
57132
|
ctx.body = await danmuPreset.delete(ctx.params.id);
|
|
57192
57133
|
});
|
|
57193
|
-
router$
|
|
57134
|
+
router$c.put("/danmu/:id", async (ctx) => {
|
|
57194
57135
|
const danmuPreset = exports.container.resolve("danmuPreset");
|
|
57195
57136
|
const data = ctx.request.body;
|
|
57196
57137
|
ctx.body = await danmuPreset.save({ ...data, id: ctx.params.id });
|
|
57197
57138
|
});
|
|
57198
57139
|
////////////////// 视频上传预设 ///////////////////////////////
|
|
57199
|
-
router$
|
|
57140
|
+
router$c.get("/video", async (ctx) => {
|
|
57200
57141
|
const preset = exports.container.resolve("videoPreset");
|
|
57201
57142
|
ctx.body = await preset.list();
|
|
57202
57143
|
});
|
|
57203
|
-
router$
|
|
57144
|
+
router$c.get("/video/:id", async (ctx) => {
|
|
57204
57145
|
const preset = exports.container.resolve("videoPreset");
|
|
57205
57146
|
ctx.body = await preset.get(ctx.params.id);
|
|
57206
57147
|
});
|
|
57207
|
-
router$
|
|
57148
|
+
router$c.post("/video", async (ctx) => {
|
|
57208
57149
|
const preset = exports.container.resolve("videoPreset");
|
|
57209
57150
|
const data = ctx.request.body;
|
|
57210
57151
|
data.config = index.omit(data.config, ["dtime"]);
|
|
57211
57152
|
ctx.body = await preset.save(data);
|
|
57212
57153
|
});
|
|
57213
|
-
router$
|
|
57154
|
+
router$c.del("/video/:id", async (ctx) => {
|
|
57214
57155
|
const preset = exports.container.resolve("videoPreset");
|
|
57215
57156
|
ctx.body = await preset.delete(ctx.params.id);
|
|
57216
57157
|
});
|
|
57217
|
-
router$
|
|
57158
|
+
router$c.put("/video/:id", async (ctx) => {
|
|
57218
57159
|
const preset = exports.container.resolve("videoPreset");
|
|
57219
57160
|
const data = ctx.request.body;
|
|
57220
57161
|
data.config = index.omit(data.config, ["dtime"]);
|
|
57221
57162
|
ctx.body = await preset.save({ ...data, id: ctx.params.id });
|
|
57222
57163
|
});
|
|
57223
57164
|
////////////////// ffmpeg预设 ///////////////////////////////
|
|
57224
|
-
router$
|
|
57165
|
+
router$c.get("/ffmpeg", async (ctx) => {
|
|
57225
57166
|
const preset = exports.container.resolve("ffmpegPreset");
|
|
57226
57167
|
ctx.body = await preset.list();
|
|
57227
57168
|
});
|
|
57228
|
-
router$
|
|
57169
|
+
router$c.get("/ffmpeg/options", async (ctx) => {
|
|
57229
57170
|
const preset = exports.container.resolve("ffmpegPreset");
|
|
57230
57171
|
ctx.body = await preset.getFfmpegPresetOptions();
|
|
57231
57172
|
});
|
|
57232
|
-
router$
|
|
57173
|
+
router$c.get("/ffmpeg/:id", async (ctx) => {
|
|
57233
57174
|
const preset = exports.container.resolve("ffmpegPreset");
|
|
57234
57175
|
ctx.body = await preset.get(ctx.params.id);
|
|
57235
57176
|
});
|
|
57236
|
-
router$
|
|
57177
|
+
router$c.post("/ffmpeg", async (ctx) => {
|
|
57237
57178
|
const preset = exports.container.resolve("ffmpegPreset");
|
|
57238
57179
|
const data = ctx.request.body;
|
|
57239
57180
|
ctx.body = await preset.save(data);
|
|
57240
57181
|
});
|
|
57241
|
-
router$
|
|
57182
|
+
router$c.del("/ffmpeg/:id", async (ctx) => {
|
|
57242
57183
|
const preset = exports.container.resolve("ffmpegPreset");
|
|
57243
57184
|
ctx.body = await preset.delete(ctx.params.id);
|
|
57244
57185
|
});
|
|
57245
|
-
router$
|
|
57186
|
+
router$c.put("/ffmpeg/:id", async (ctx) => {
|
|
57246
57187
|
const preset = exports.container.resolve("ffmpegPreset");
|
|
57247
57188
|
const data = ctx.request.body;
|
|
57248
57189
|
ctx.body = await preset.save({ ...data, id: ctx.params.id });
|
|
57249
57190
|
});
|
|
57250
57191
|
////////////////// 字幕样式预设 ///////////////////////////////
|
|
57251
|
-
router$
|
|
57192
|
+
router$c.get("/subtitle-style", async (ctx) => {
|
|
57252
57193
|
const preset = exports.container.resolve("subtitleStylePreset");
|
|
57253
57194
|
ctx.body = await preset.list();
|
|
57254
57195
|
});
|
|
57255
|
-
router$
|
|
57196
|
+
router$c.get("/subtitle-style/:id", async (ctx) => {
|
|
57256
57197
|
const preset = exports.container.resolve("subtitleStylePreset");
|
|
57257
57198
|
ctx.body = await preset.get(ctx.params.id);
|
|
57258
57199
|
});
|
|
57259
|
-
router$
|
|
57200
|
+
router$c.post("/subtitle-style", async (ctx) => {
|
|
57260
57201
|
const preset = exports.container.resolve("subtitleStylePreset");
|
|
57261
57202
|
const data = ctx.request.body;
|
|
57262
57203
|
ctx.body = await preset.save(data);
|
|
57263
57204
|
});
|
|
57264
|
-
router$
|
|
57205
|
+
router$c.del("/subtitle-style/:id", async (ctx) => {
|
|
57265
57206
|
const preset = exports.container.resolve("subtitleStylePreset");
|
|
57266
57207
|
ctx.body = await preset.delete(ctx.params.id);
|
|
57267
57208
|
});
|
|
57268
|
-
router$
|
|
57209
|
+
router$c.put("/subtitle-style/:id", async (ctx) => {
|
|
57269
57210
|
const preset = exports.container.resolve("subtitleStylePreset");
|
|
57270
57211
|
const data = ctx.request.body;
|
|
57271
57212
|
ctx.body = await preset.save({ ...data, id: ctx.params.id });
|
|
@@ -61706,7 +61647,7 @@ var picomatch$1 = picomatch_1;
|
|
|
61706
61647
|
* Released under the MIT License.
|
|
61707
61648
|
*/
|
|
61708
61649
|
|
|
61709
|
-
var normalizePath$
|
|
61650
|
+
var normalizePath$3 = function(path, stripTrailing) {
|
|
61710
61651
|
if (typeof path !== 'string') {
|
|
61711
61652
|
throw new TypeError('expected path to be a string');
|
|
61712
61653
|
}
|
|
@@ -61740,7 +61681,7 @@ var anymatch_1 = anymatch$2.exports;
|
|
|
61740
61681
|
Object.defineProperty(anymatch_1, "__esModule", { value: true });
|
|
61741
61682
|
|
|
61742
61683
|
const picomatch = picomatch$1;
|
|
61743
|
-
const normalizePath$
|
|
61684
|
+
const normalizePath$2 = normalizePath$3;
|
|
61744
61685
|
|
|
61745
61686
|
/**
|
|
61746
61687
|
* @typedef {(testString: string) => boolean} AnymatchFn
|
|
@@ -61784,7 +61725,7 @@ const matchPatterns = (patterns, negPatterns, args, returnIndex) => {
|
|
|
61784
61725
|
throw new TypeError('anymatch: second argument must be a string: got ' +
|
|
61785
61726
|
Object.prototype.toString.call(_path))
|
|
61786
61727
|
}
|
|
61787
|
-
const path = normalizePath$
|
|
61728
|
+
const path = normalizePath$2(_path, false);
|
|
61788
61729
|
|
|
61789
61730
|
for (let index = 0; index < negPatterns.length; index++) {
|
|
61790
61731
|
const nglob = negPatterns[index];
|
|
@@ -63372,7 +63313,7 @@ const anymatch = anymatchExports.default;
|
|
|
63372
63313
|
const globParent = index.globParent;
|
|
63373
63314
|
const isGlob = index.isGlob;
|
|
63374
63315
|
const braces = index.braces_1;
|
|
63375
|
-
const normalizePath = normalizePath$
|
|
63316
|
+
const normalizePath$1 = normalizePath$3;
|
|
63376
63317
|
|
|
63377
63318
|
const NodeFsHandler = nodefsHandler;
|
|
63378
63319
|
const FsEventsHandler = fseventsHandlerExports;
|
|
@@ -63780,7 +63721,7 @@ add(paths_, _origAdd, _internal) {
|
|
|
63780
63721
|
if (disableGlobbing || !isGlob(path)) {
|
|
63781
63722
|
return absPath;
|
|
63782
63723
|
}
|
|
63783
|
-
return normalizePath(absPath);
|
|
63724
|
+
return normalizePath$1(absPath);
|
|
63784
63725
|
});
|
|
63785
63726
|
}
|
|
63786
63727
|
|
|
@@ -65098,19 +65039,23 @@ class BCutASRAdapter {
|
|
|
65098
65039
|
async recognize() {
|
|
65099
65040
|
throw new Error("B接口 ASR 不支持识别 URL,请使用 recognizeLocalFile");
|
|
65100
65041
|
}
|
|
65101
|
-
async recognizeLocalFile(filePath) {
|
|
65042
|
+
async recognizeLocalFile(filePath, opts) {
|
|
65102
65043
|
// 这里直接返回一个模拟结果,实际使用时需要替换为调用 B接口 ASR 的代码
|
|
65103
65044
|
const asr = new index.BcutASR(filePath);
|
|
65104
65045
|
const result = await asr.recognize();
|
|
65105
65046
|
const data = result.getRawData();
|
|
65106
|
-
return this.transformBCutResult(data);
|
|
65047
|
+
return this.transformBCutResult(data, opts);
|
|
65107
65048
|
}
|
|
65108
65049
|
/**
|
|
65109
65050
|
* 转换 B接口 ASR 格式为标准格式
|
|
65110
65051
|
*/
|
|
65111
|
-
transformBCutResult(data) {
|
|
65112
|
-
|
|
65113
|
-
|
|
65052
|
+
transformBCutResult(data, opts) {
|
|
65053
|
+
let list = data.utterances;
|
|
65054
|
+
if (opts?.filterMusic) {
|
|
65055
|
+
// @ts-expect-error
|
|
65056
|
+
list = list.filter((s) => s.music <= 0.9); // 过滤掉标记为音乐的段落
|
|
65057
|
+
}
|
|
65058
|
+
let segments = list.map((utterance, index) => ({
|
|
65114
65059
|
id: index,
|
|
65115
65060
|
start: utterance.start_time / 1000,
|
|
65116
65061
|
end: utterance.end_time / 1000,
|
|
@@ -65268,9 +65213,9 @@ function createASRProvider(modelId) {
|
|
|
65268
65213
|
* @param modelId 模型id
|
|
65269
65214
|
* @returns
|
|
65270
65215
|
*/
|
|
65271
|
-
function recognize$1(file, modelId) {
|
|
65216
|
+
function recognize$1(file, modelId, opts) {
|
|
65272
65217
|
const asrProvider = createASRProvider(modelId);
|
|
65273
|
-
return asrProvider.recognizeLocalFile(file);
|
|
65218
|
+
return asrProvider.recognizeLocalFile(file, opts);
|
|
65274
65219
|
}
|
|
65275
65220
|
|
|
65276
65221
|
const default_format = 'RFC3986';
|
|
@@ -76665,13 +76610,13 @@ async function songRecognize(file, audioStartTime = 0) {
|
|
|
76665
76610
|
};
|
|
76666
76611
|
}
|
|
76667
76612
|
|
|
76668
|
-
const router$
|
|
76613
|
+
const router$b = new Router$1({
|
|
76669
76614
|
prefix: "/sse",
|
|
76670
76615
|
});
|
|
76671
76616
|
/**
|
|
76672
76617
|
* 流式查询日志
|
|
76673
76618
|
*/
|
|
76674
|
-
router$
|
|
76619
|
+
router$b.get("/streamLogs", sse({
|
|
76675
76620
|
maxClients: 5000,
|
|
76676
76621
|
pingInterval: 60 * 60 * 1000,
|
|
76677
76622
|
}), async (ctx) => {
|
|
@@ -76710,7 +76655,7 @@ router$a.get("/streamLogs", sse({
|
|
|
76710
76655
|
/**
|
|
76711
76656
|
* 获取弹幕流
|
|
76712
76657
|
*/
|
|
76713
|
-
router$
|
|
76658
|
+
router$b.get("/recorder/danma", sse({
|
|
76714
76659
|
maxClients: 5000,
|
|
76715
76660
|
pingInterval: 30000,
|
|
76716
76661
|
}), async (ctx) => {
|
|
@@ -76723,7 +76668,7 @@ router$a.get("/recorder/danma", sse({
|
|
|
76723
76668
|
}
|
|
76724
76669
|
});
|
|
76725
76670
|
});
|
|
76726
|
-
router$
|
|
76671
|
+
router$b.get("/task/runningNum", sse({
|
|
76727
76672
|
maxClients: 5000,
|
|
76728
76673
|
pingInterval: 30000,
|
|
76729
76674
|
}), async (ctx) => {
|
|
@@ -76756,7 +76701,7 @@ router$a.get("/task/runningNum", sse({
|
|
|
76756
76701
|
/**
|
|
76757
76702
|
* 波形分析进度流
|
|
76758
76703
|
*/
|
|
76759
|
-
router$
|
|
76704
|
+
router$b.get("/analyzerWaveform", sse({
|
|
76760
76705
|
maxClients: 100,
|
|
76761
76706
|
pingInterval: 30000,
|
|
76762
76707
|
}), async (ctx) => {
|
|
@@ -76815,7 +76760,7 @@ router$a.get("/analyzerWaveform", sse({
|
|
|
76815
76760
|
});
|
|
76816
76761
|
});
|
|
76817
76762
|
|
|
76818
|
-
const router$
|
|
76763
|
+
const router$a = new Router$1({
|
|
76819
76764
|
prefix: "/recorder",
|
|
76820
76765
|
});
|
|
76821
76766
|
/**
|
|
@@ -76831,12 +76776,12 @@ const router$9 = new Router$1({
|
|
|
76831
76776
|
* @param sortDirection 排序方向 asc: 升序 desc: 降序
|
|
76832
76777
|
* @returns 录制任务列表
|
|
76833
76778
|
*/
|
|
76834
|
-
router$
|
|
76779
|
+
router$a.get("/list", async (ctx) => {
|
|
76835
76780
|
const query = ctx.request.query;
|
|
76836
76781
|
ctx.body = { payload: await recorderService.getRecorders(query) };
|
|
76837
76782
|
});
|
|
76838
|
-
router$
|
|
76839
|
-
const args = index.pick((ctx.request.body ?? {}), "providerId", "channelId", "remarks", "disableAutoCheck", "quality", "streamPriorities", "sourcePriorities", "extra", "noGlobalFollowFields", "line", "disableProvideCommentsWhenRecording", "saveGiftDanma", "saveSCDanma", "segment", "sendToWebhook", "uid", "saveCover", "qualityRetry", "formatName", "useM3U8Proxy", "customHost", "codecName", "titleKeywords", "liveStartNotification", "liveEndNotification", "weight", "source", "videoFormat", "recorderType", "cookie", "doubleScreen", "onlyAudio", "useServerTimestamp", "handleTime", "debugLevel", "api");
|
|
76783
|
+
router$a.post("/add", async (ctx) => {
|
|
76784
|
+
const args = index.pick((ctx.request.body ?? {}), "providerId", "channelId", "remarks", "disableAutoCheck", "quality", "streamPriorities", "sourcePriorities", "extra", "noGlobalFollowFields", "line", "disableProvideCommentsWhenRecording", "saveGiftDanma", "saveSCDanma", "segment", "sendToWebhook", "uid", "saveCover", "convert2Mp4", "qualityRetry", "formatName", "useM3U8Proxy", "customHost", "codecName", "titleKeywords", "liveStartNotification", "liveEndNotification", "weight", "source", "videoFormat", "recorderType", "cookie", "doubleScreen", "onlyAudio", "useServerTimestamp", "handleTime", "debugLevel", "api");
|
|
76840
76785
|
const data = await recorderService.addRecorder(args);
|
|
76841
76786
|
ctx.body = { payload: data };
|
|
76842
76787
|
});
|
|
@@ -76846,13 +76791,13 @@ router$9.post("/add", async (ctx) => {
|
|
|
76846
76791
|
* @param recorderId 直播间ID
|
|
76847
76792
|
* @returns 录制器配置信息
|
|
76848
76793
|
*/
|
|
76849
|
-
router$
|
|
76794
|
+
router$a.get("/:id", (ctx) => {
|
|
76850
76795
|
const { id } = ctx.params;
|
|
76851
76796
|
ctx.body = { payload: recorderService.getRecorder({ id }) };
|
|
76852
76797
|
});
|
|
76853
|
-
router$
|
|
76798
|
+
router$a.put("/:id", (ctx) => {
|
|
76854
76799
|
const { id } = ctx.params;
|
|
76855
|
-
const patch = index.pick(ctx.request.body, "remarks", "disableAutoCheck", "quality", "streamPriorities", "sourcePriorities", "noGlobalFollowFields", "line", "disableProvideCommentsWhenRecording", "saveGiftDanma", "saveSCDanma", "saveCover", "segment", "sendToWebhook", "uid", "qualityRetry", "formatName", "useM3U8Proxy", "customHost", "codecName", "titleKeywords", "liveStartNotification", "liveEndNotification", "weight", "source", "videoFormat", "recorderType", "cookie", "doubleScreen", "onlyAudio", "useServerTimestamp", "handleTime", "debugLevel", "api");
|
|
76800
|
+
const patch = index.pick(ctx.request.body, "remarks", "disableAutoCheck", "quality", "streamPriorities", "sourcePriorities", "noGlobalFollowFields", "line", "disableProvideCommentsWhenRecording", "saveGiftDanma", "saveSCDanma", "saveCover", "segment", "sendToWebhook", "uid", "qualityRetry", "formatName", "useM3U8Proxy", "customHost", "codecName", "titleKeywords", "liveStartNotification", "liveEndNotification", "weight", "source", "videoFormat", "recorderType", "cookie", "doubleScreen", "onlyAudio", "useServerTimestamp", "handleTime", "debugLevel", "convert2Mp4", "api");
|
|
76856
76801
|
ctx.body = { payload: recorderService.updateRecorder({ id, ...patch }) };
|
|
76857
76802
|
});
|
|
76858
76803
|
/**
|
|
@@ -76862,7 +76807,7 @@ router$9.put("/:id", (ctx) => {
|
|
|
76862
76807
|
* @param removeHistory 是否删除录制历史,默认false
|
|
76863
76808
|
* @returns null
|
|
76864
76809
|
*/
|
|
76865
|
-
router$
|
|
76810
|
+
router$a.delete("/:id", (ctx) => {
|
|
76866
76811
|
const { id } = ctx.params;
|
|
76867
76812
|
const { removeHistory } = ctx.request.query;
|
|
76868
76813
|
ctx.body = {
|
|
@@ -76875,7 +76820,7 @@ router$9.delete("/:id", (ctx) => {
|
|
|
76875
76820
|
* @param recorderId 直播间ID
|
|
76876
76821
|
* @returns 录制任务信息
|
|
76877
76822
|
*/
|
|
76878
|
-
router$
|
|
76823
|
+
router$a.post("/:id/start_record", async (ctx) => {
|
|
76879
76824
|
const { id } = ctx.params;
|
|
76880
76825
|
ctx.body = { payload: await recorderService.startRecord({ id }) };
|
|
76881
76826
|
});
|
|
@@ -76885,7 +76830,7 @@ router$9.post("/:id/start_record", async (ctx) => {
|
|
|
76885
76830
|
* @param recorderId 直播间ID
|
|
76886
76831
|
* @returns 录制任务信息
|
|
76887
76832
|
*/
|
|
76888
|
-
router$
|
|
76833
|
+
router$a.post("/:id/stop_record", async (ctx) => {
|
|
76889
76834
|
const { id } = ctx.params;
|
|
76890
76835
|
ctx.body = { payload: await recorderService.stopRecord({ id }) };
|
|
76891
76836
|
});
|
|
@@ -76895,7 +76840,7 @@ router$9.post("/:id/stop_record", async (ctx) => {
|
|
|
76895
76840
|
* @param recorderId 直播间ID
|
|
76896
76841
|
* @returns 录制任务信息
|
|
76897
76842
|
*/
|
|
76898
|
-
router$
|
|
76843
|
+
router$a.post("/:id/cut", async (ctx) => {
|
|
76899
76844
|
const { id } = ctx.params;
|
|
76900
76845
|
ctx.body = { payload: await recorderService.cutRecord({ id }) };
|
|
76901
76846
|
});
|
|
@@ -76905,7 +76850,7 @@ router$9.post("/:id/cut", async (ctx) => {
|
|
|
76905
76850
|
* @param ids 直播间ID列表
|
|
76906
76851
|
* @returns 批量操作结果
|
|
76907
76852
|
*/
|
|
76908
|
-
router$
|
|
76853
|
+
router$a.post("/manager/batch_start_record", async (ctx) => {
|
|
76909
76854
|
const { ids } = ctx.request.body;
|
|
76910
76855
|
ctx.body = { payload: await recorderService.batchStartRecord(ids) };
|
|
76911
76856
|
});
|
|
@@ -76915,7 +76860,7 @@ router$9.post("/manager/batch_start_record", async (ctx) => {
|
|
|
76915
76860
|
* @param ids 直播间ID列表
|
|
76916
76861
|
* @returns 批量操作结果
|
|
76917
76862
|
*/
|
|
76918
|
-
router$
|
|
76863
|
+
router$a.post("/manager/batch_stop_record", async (ctx) => {
|
|
76919
76864
|
const { ids } = ctx.request.body;
|
|
76920
76865
|
ctx.body = { payload: await recorderService.batchStopRecord(ids) };
|
|
76921
76866
|
});
|
|
@@ -76925,7 +76870,7 @@ router$9.post("/manager/batch_stop_record", async (ctx) => {
|
|
|
76925
76870
|
* @param url 直播间地址
|
|
76926
76871
|
* @returns 直播间信息
|
|
76927
76872
|
*/
|
|
76928
|
-
router$
|
|
76873
|
+
router$a.get("/manager/resolveChannel", async (ctx) => {
|
|
76929
76874
|
const { url } = ctx.query;
|
|
76930
76875
|
const data = await recorderService.resolveChannel(url);
|
|
76931
76876
|
ctx.body = { payload: data };
|
|
@@ -76936,7 +76881,7 @@ router$9.get("/manager/resolveChannel", async (ctx) => {
|
|
|
76936
76881
|
* @param url 直播间地址
|
|
76937
76882
|
* @returns 直播间信息
|
|
76938
76883
|
*/
|
|
76939
|
-
router$
|
|
76884
|
+
router$a.get("/manager/resolve", async (ctx) => {
|
|
76940
76885
|
const { url } = ctx.query;
|
|
76941
76886
|
const data = await recorderService.resolve(url);
|
|
76942
76887
|
ctx.body = { payload: data };
|
|
@@ -76947,7 +76892,7 @@ router$9.get("/manager/resolve", async (ctx) => {
|
|
|
76947
76892
|
* @param channelURLs 直播间地址数组
|
|
76948
76893
|
* @returns 批量解析结果
|
|
76949
76894
|
*/
|
|
76950
|
-
router$
|
|
76895
|
+
router$a.post("/manager/batchResolveChannel", async (ctx) => {
|
|
76951
76896
|
const { channelURLs } = ctx.request.body;
|
|
76952
76897
|
const data = await recorderService.batchResolveChannel(channelURLs);
|
|
76953
76898
|
ctx.body = { payload: data };
|
|
@@ -76959,7 +76904,7 @@ router$9.post("/manager/batchResolveChannel", async (ctx) => {
|
|
|
76959
76904
|
* @param forceRequest 强制查询直播间信息,不受配置限制,默认true
|
|
76960
76905
|
* @returns 直播间实时信息列表
|
|
76961
76906
|
*/
|
|
76962
|
-
router$
|
|
76907
|
+
router$a.post("/manager/liveInfo", async (ctx) => {
|
|
76963
76908
|
const { ids } = ctx.request.body;
|
|
76964
76909
|
const forceRequest = ctx.request.body.forceRequest ?? true;
|
|
76965
76910
|
let requestInfoForRecord = true;
|
|
@@ -76975,11 +76920,11 @@ router$9.post("/manager/liveInfo", async (ctx) => {
|
|
|
76975
76920
|
};
|
|
76976
76921
|
});
|
|
76977
76922
|
|
|
76978
|
-
const router$
|
|
76923
|
+
const router$9 = new Router$1({
|
|
76979
76924
|
prefix: "/bili",
|
|
76980
76925
|
});
|
|
76981
76926
|
// 验证视频上传参数
|
|
76982
|
-
router$
|
|
76927
|
+
router$9.post("/validUploadParams", async (ctx) => {
|
|
76983
76928
|
const params = ctx.request.body;
|
|
76984
76929
|
// @ts-ignore
|
|
76985
76930
|
const [status, msg] = await index.validateBiliupConfig(params);
|
|
@@ -76993,7 +76938,7 @@ router$8.post("/validUploadParams", async (ctx) => {
|
|
|
76993
76938
|
/**
|
|
76994
76939
|
* 投稿中心视频列表
|
|
76995
76940
|
*/
|
|
76996
|
-
router$
|
|
76941
|
+
router$9.get("/archives", async (ctx) => {
|
|
76997
76942
|
const params = ctx.request.query;
|
|
76998
76943
|
const { uid } = params;
|
|
76999
76944
|
const data = await index.biliApi.getArchives(params, uid);
|
|
@@ -77002,45 +76947,45 @@ router$8.get("/archives", async (ctx) => {
|
|
|
77002
76947
|
/**
|
|
77003
76948
|
* 用户视频详情
|
|
77004
76949
|
*/
|
|
77005
|
-
router$
|
|
76950
|
+
router$9.get("/user/archive/:bvid", async (ctx) => {
|
|
77006
76951
|
const params = ctx.request.query;
|
|
77007
76952
|
const { uid } = params;
|
|
77008
76953
|
const { bvid } = ctx.params;
|
|
77009
76954
|
const data = await index.biliApi.getArchiveDetail(bvid, uid);
|
|
77010
76955
|
ctx.body = data;
|
|
77011
76956
|
});
|
|
77012
|
-
router$
|
|
76957
|
+
router$9.post("/checkTag", async (ctx) => {
|
|
77013
76958
|
const { tag, uid, } = ctx.request.body;
|
|
77014
76959
|
const data = await index.biliApi.checkTag(tag, uid);
|
|
77015
76960
|
ctx.body = data;
|
|
77016
76961
|
});
|
|
77017
|
-
router$
|
|
76962
|
+
router$9.get("/searchTopic", async (ctx) => {
|
|
77018
76963
|
const { keyword, uid } = ctx.request.query;
|
|
77019
76964
|
const data = await index.biliApi.searchTopic(keyword, uid);
|
|
77020
76965
|
ctx.body = data;
|
|
77021
76966
|
});
|
|
77022
|
-
router$
|
|
76967
|
+
router$9.get("/seasons", async (ctx) => {
|
|
77023
76968
|
const { uid } = ctx.request.query;
|
|
77024
76969
|
const data = await index.biliApi.getSeasonList(uid);
|
|
77025
76970
|
ctx.body = data;
|
|
77026
76971
|
});
|
|
77027
|
-
router$
|
|
76972
|
+
router$9.get("/season/:aid", async (ctx) => {
|
|
77028
76973
|
const { uid } = ctx.request.query;
|
|
77029
76974
|
const { aid } = ctx.params;
|
|
77030
76975
|
const data = await index.biliApi.getSessionId(Number(aid), uid);
|
|
77031
76976
|
ctx.body = data;
|
|
77032
76977
|
});
|
|
77033
|
-
router$
|
|
76978
|
+
router$9.get("/platformArchiveDetail", async (ctx) => {
|
|
77034
76979
|
const { aid, uid } = ctx.request.query;
|
|
77035
76980
|
const data = await index.biliApi.getPlatformArchiveDetail(aid, uid);
|
|
77036
76981
|
ctx.body = data;
|
|
77037
76982
|
});
|
|
77038
|
-
router$
|
|
76983
|
+
router$9.get("/platformPre", async (ctx) => {
|
|
77039
76984
|
const { uid } = ctx.request.query;
|
|
77040
76985
|
const data = await index.biliApi.getPlatformPre(uid);
|
|
77041
76986
|
ctx.body = data;
|
|
77042
76987
|
});
|
|
77043
|
-
router$
|
|
76988
|
+
router$9.get("/typeDesc", async (ctx) => {
|
|
77044
76989
|
const { tid, uid } = ctx.request.query;
|
|
77045
76990
|
const data = await index.biliApi.getTypeDesc(tid, uid);
|
|
77046
76991
|
ctx.body = data;
|
|
@@ -77048,7 +76993,7 @@ router$8.get("/typeDesc", async (ctx) => {
|
|
|
77048
76993
|
/**
|
|
77049
76994
|
* 上传以及续传视频
|
|
77050
76995
|
*/
|
|
77051
|
-
router$
|
|
76996
|
+
router$9.post("/upload", async (ctx) => {
|
|
77052
76997
|
const data = ctx.request.body;
|
|
77053
76998
|
if (!data.uid) {
|
|
77054
76999
|
ctx.body = "uid required";
|
|
@@ -77088,7 +77033,7 @@ router$8.post("/upload", async (ctx) => {
|
|
|
77088
77033
|
});
|
|
77089
77034
|
// 登录相关
|
|
77090
77035
|
const loginObj = {};
|
|
77091
|
-
router$
|
|
77036
|
+
router$9.post("/login", async (ctx) => {
|
|
77092
77037
|
const tv = new index.TvQrcodeLogin();
|
|
77093
77038
|
const id = index.uuid();
|
|
77094
77039
|
loginObj[id] = {
|
|
@@ -77120,7 +77065,7 @@ router$8.post("/login", async (ctx) => {
|
|
|
77120
77065
|
id,
|
|
77121
77066
|
};
|
|
77122
77067
|
});
|
|
77123
|
-
router$
|
|
77068
|
+
router$9.post("/login/cancel", async (ctx) => {
|
|
77124
77069
|
const { id } = ctx.request.body;
|
|
77125
77070
|
if (!id) {
|
|
77126
77071
|
ctx.body = "id required";
|
|
@@ -77137,7 +77082,7 @@ router$8.post("/login/cancel", async (ctx) => {
|
|
|
77137
77082
|
tv.interrupt();
|
|
77138
77083
|
ctx.body = "success";
|
|
77139
77084
|
});
|
|
77140
|
-
router$
|
|
77085
|
+
router$9.get("/login/poll", async (ctx) => {
|
|
77141
77086
|
const { id } = ctx.request.query;
|
|
77142
77087
|
if (!id) {
|
|
77143
77088
|
ctx.body = "id required";
|
|
@@ -77152,13 +77097,13 @@ router$8.get("/login/poll", async (ctx) => {
|
|
|
77152
77097
|
}
|
|
77153
77098
|
ctx.body = index.omit(loginInfo, ["client"]);
|
|
77154
77099
|
});
|
|
77155
|
-
router$
|
|
77100
|
+
router$9.post("/formatTitle", async (ctx) => {
|
|
77156
77101
|
const data = ctx.request.body;
|
|
77157
77102
|
const template = (data.template || "");
|
|
77158
77103
|
const title = index.formatTitle(data.options, template);
|
|
77159
77104
|
ctx.body = title;
|
|
77160
77105
|
});
|
|
77161
|
-
router$
|
|
77106
|
+
router$9.post("/formatPartTitle", async (ctx) => {
|
|
77162
77107
|
const data = ctx.request.body;
|
|
77163
77108
|
const template = (data.template || "");
|
|
77164
77109
|
const title = index.formatPartTitle(data.options ?? {
|
|
@@ -77171,7 +77116,7 @@ router$8.post("/formatPartTitle", async (ctx) => {
|
|
|
77171
77116
|
}, template);
|
|
77172
77117
|
ctx.body = title;
|
|
77173
77118
|
});
|
|
77174
|
-
router$
|
|
77119
|
+
router$9.post("/formatDesc", async (ctx) => {
|
|
77175
77120
|
const data = ctx.request.body;
|
|
77176
77121
|
const template = (data.template || "");
|
|
77177
77122
|
const desc = index.formatDesc(data.options ?? {
|
|
@@ -77442,10 +77387,10 @@ const generateWaveformData = async (videoFilePath) => {
|
|
|
77442
77387
|
}
|
|
77443
77388
|
};
|
|
77444
77389
|
|
|
77445
|
-
const router$
|
|
77390
|
+
const router$8 = new Router$1({
|
|
77446
77391
|
prefix: "/task",
|
|
77447
77392
|
});
|
|
77448
|
-
router$
|
|
77393
|
+
router$8.get("/", async (ctx) => {
|
|
77449
77394
|
const type = ctx.query.type;
|
|
77450
77395
|
let data = index.handleListTask();
|
|
77451
77396
|
if (type) {
|
|
@@ -77456,42 +77401,42 @@ router$7.get("/", async (ctx) => {
|
|
|
77456
77401
|
runningTaskNum: data.filter((item) => item.status === "running").length,
|
|
77457
77402
|
};
|
|
77458
77403
|
});
|
|
77459
|
-
router$
|
|
77404
|
+
router$8.get("/:id", async (ctx) => {
|
|
77460
77405
|
const { id } = ctx.params;
|
|
77461
77406
|
ctx.body = index.handleQueryTask(id);
|
|
77462
77407
|
});
|
|
77463
|
-
router$
|
|
77408
|
+
router$8.post("/:id/pause", async (ctx) => {
|
|
77464
77409
|
const { id } = ctx.params;
|
|
77465
77410
|
console.log(id);
|
|
77466
77411
|
index.handlePauseTask(id);
|
|
77467
77412
|
ctx.body = { code: 0 };
|
|
77468
77413
|
});
|
|
77469
|
-
router$
|
|
77414
|
+
router$8.post("/:id/resume", async (ctx) => {
|
|
77470
77415
|
const { id } = ctx.params;
|
|
77471
77416
|
index.handleResumeTask(id);
|
|
77472
77417
|
ctx.body = { code: 0 };
|
|
77473
77418
|
});
|
|
77474
|
-
router$
|
|
77419
|
+
router$8.post("/:id/kill", async (ctx) => {
|
|
77475
77420
|
const { id } = ctx.params;
|
|
77476
77421
|
index.handleKillTask(id);
|
|
77477
77422
|
ctx.body = { code: 0 };
|
|
77478
77423
|
});
|
|
77479
|
-
router$
|
|
77424
|
+
router$8.post("/:id/interrupt", async (ctx) => {
|
|
77480
77425
|
const { id } = ctx.params;
|
|
77481
77426
|
index.hanldeInterruptTask(id);
|
|
77482
77427
|
ctx.body = { code: 0 };
|
|
77483
77428
|
});
|
|
77484
|
-
router$
|
|
77429
|
+
router$8.post("/:id/removeRecord", async (ctx) => {
|
|
77485
77430
|
const { id } = ctx.params;
|
|
77486
77431
|
index.handleRemoveTask(id);
|
|
77487
77432
|
ctx.body = { code: 0 };
|
|
77488
77433
|
});
|
|
77489
|
-
router$
|
|
77434
|
+
router$8.post("/:id/restart", async (ctx) => {
|
|
77490
77435
|
const { id } = ctx.params;
|
|
77491
77436
|
index.handleRestartTask(id);
|
|
77492
77437
|
ctx.body = { code: 0 };
|
|
77493
77438
|
});
|
|
77494
|
-
router$
|
|
77439
|
+
router$8.post("/:id/removeFile", async (ctx) => {
|
|
77495
77440
|
const { id } = ctx.params;
|
|
77496
77441
|
const task = index.taskQueue.queryTask(id);
|
|
77497
77442
|
if (!task) {
|
|
@@ -77509,17 +77454,17 @@ router$7.post("/:id/removeFile", async (ctx) => {
|
|
|
77509
77454
|
await index.trashItem(task.output);
|
|
77510
77455
|
ctx.body = { code: 0 };
|
|
77511
77456
|
});
|
|
77512
|
-
router$
|
|
77457
|
+
router$8.post("/:id/start", async (ctx) => {
|
|
77513
77458
|
const { id } = ctx.params;
|
|
77514
77459
|
index.handleStartTask(id);
|
|
77515
77460
|
ctx.body = { code: 0 };
|
|
77516
77461
|
});
|
|
77517
|
-
router$
|
|
77462
|
+
router$8.post("/removeBatch", async (ctx) => {
|
|
77518
77463
|
const { ids } = ctx.request.body;
|
|
77519
77464
|
ids.forEach((id) => index.handleRemoveTask(id));
|
|
77520
77465
|
ctx.body = { code: 0 };
|
|
77521
77466
|
});
|
|
77522
|
-
router$
|
|
77467
|
+
router$8.post("/videoMeta", async (ctx) => {
|
|
77523
77468
|
const { file } = ctx.request.body;
|
|
77524
77469
|
console.log(ctx.params);
|
|
77525
77470
|
if (!file) {
|
|
@@ -77530,7 +77475,7 @@ router$7.post("/videoMeta", async (ctx) => {
|
|
|
77530
77475
|
const data = await index.readVideoMeta(file, {});
|
|
77531
77476
|
ctx.body = data;
|
|
77532
77477
|
});
|
|
77533
|
-
router$
|
|
77478
|
+
router$8.post("/convertXml2Ass", async (ctx) => {
|
|
77534
77479
|
const { input, output, preset, options } = ctx.request.body;
|
|
77535
77480
|
if (!input || !output) {
|
|
77536
77481
|
ctx.status = 400;
|
|
@@ -77564,12 +77509,12 @@ router$7.post("/convertXml2Ass", async (ctx) => {
|
|
|
77564
77509
|
ctx.body = { taskId: task.taskId, output: task.output };
|
|
77565
77510
|
}
|
|
77566
77511
|
});
|
|
77567
|
-
router$
|
|
77512
|
+
router$8.post("/checkMergeVideos", async (ctx) => {
|
|
77568
77513
|
const { inputVideos } = ctx.request.body;
|
|
77569
77514
|
const result = await index.checkMergeVideos(inputVideos);
|
|
77570
77515
|
ctx.body = result;
|
|
77571
77516
|
});
|
|
77572
|
-
router$
|
|
77517
|
+
router$8.post("/mergeVideo", async (ctx) => {
|
|
77573
77518
|
const { inputVideos, options } = ctx.request.body;
|
|
77574
77519
|
if (!inputVideos || inputVideos.length < 2) {
|
|
77575
77520
|
ctx.status = 400;
|
|
@@ -77587,7 +77532,7 @@ router$7.post("/mergeVideo", async (ctx) => {
|
|
|
77587
77532
|
});
|
|
77588
77533
|
ctx.body = { taskId: task.taskId };
|
|
77589
77534
|
});
|
|
77590
|
-
router$
|
|
77535
|
+
router$8.post("/transcode", async (ctx) => {
|
|
77591
77536
|
const { input, outputName, ffmpegOptions, options } = ctx.request.body;
|
|
77592
77537
|
if (!input) {
|
|
77593
77538
|
ctx.status = 400;
|
|
@@ -77605,7 +77550,7 @@ router$7.post("/transcode", async (ctx) => {
|
|
|
77605
77550
|
/**
|
|
77606
77551
|
* 烧录
|
|
77607
77552
|
*/
|
|
77608
|
-
router$
|
|
77553
|
+
router$8.post("/burn", async (ctx) => {
|
|
77609
77554
|
const { files, output, options } = ctx.request.body;
|
|
77610
77555
|
if (options?.uploadOptions?.upload && !options?.uploadOptions?.aid) {
|
|
77611
77556
|
const [status, msg] = index.validateBiliupConfig(options?.uploadOptions?.config || {});
|
|
@@ -77634,7 +77579,7 @@ router$7.post("/burn", async (ctx) => {
|
|
|
77634
77579
|
/**
|
|
77635
77580
|
* flv修复
|
|
77636
77581
|
*/
|
|
77637
|
-
router$
|
|
77582
|
+
router$8.post("/flvRepair", async (ctx) => {
|
|
77638
77583
|
const { input, output, options } = ctx.request.body;
|
|
77639
77584
|
const task = await flvRepair(input, output, options);
|
|
77640
77585
|
ctx.body = { taskId: task.taskId };
|
|
@@ -77642,7 +77587,7 @@ router$7.post("/flvRepair", async (ctx) => {
|
|
|
77642
77587
|
/**
|
|
77643
77588
|
* 切片
|
|
77644
77589
|
*/
|
|
77645
|
-
router$
|
|
77590
|
+
router$8.post("/cut", async (ctx) => {
|
|
77646
77591
|
const { files, output, options, ffmpegOptions } = ctx.request.body;
|
|
77647
77592
|
// 处理srt字幕切割
|
|
77648
77593
|
const srtContent = files.srtContent;
|
|
@@ -77687,7 +77632,7 @@ router$7.post("/cut", async (ctx) => {
|
|
|
77687
77632
|
* 字幕分割
|
|
77688
77633
|
* 输入:srt字幕内容
|
|
77689
77634
|
*/
|
|
77690
|
-
router$
|
|
77635
|
+
router$8.post("/cutSubtitle", async (ctx) => {
|
|
77691
77636
|
const data = ctx.request.body;
|
|
77692
77637
|
const nodeList = parseSync(data.srtContent);
|
|
77693
77638
|
// console.log("解析后的节点数量:", nodeList.length, nodeList);
|
|
@@ -77726,22 +77671,22 @@ router$7.post("/cutSubtitle", async (ctx) => {
|
|
|
77726
77671
|
}
|
|
77727
77672
|
ctx.body = "success";
|
|
77728
77673
|
});
|
|
77729
|
-
router$
|
|
77674
|
+
router$8.post("/addExtraVideoTask", async (ctx) => {
|
|
77730
77675
|
const { taskId, filePath, partName } = ctx.request.body;
|
|
77731
77676
|
index.biliApi.addExtraVideoTask(taskId, filePath, partName);
|
|
77732
77677
|
ctx.body = { code: 0 };
|
|
77733
77678
|
});
|
|
77734
|
-
router$
|
|
77679
|
+
router$8.post("/editVideoPartName", async (ctx) => {
|
|
77735
77680
|
const { taskId, partName } = ctx.request.body;
|
|
77736
77681
|
index.biliApi.editVideoPartName(taskId, partName);
|
|
77737
77682
|
ctx.body = { code: 0 };
|
|
77738
77683
|
});
|
|
77739
|
-
router$
|
|
77684
|
+
router$8.post("/queryVideoStatus", async (ctx) => {
|
|
77740
77685
|
const { taskId } = ctx.request.body;
|
|
77741
77686
|
const res = await index.biliApi.queryVideoStatus(taskId);
|
|
77742
77687
|
ctx.body = res;
|
|
77743
77688
|
});
|
|
77744
|
-
router$
|
|
77689
|
+
router$8.get("/:id/download", async (ctx) => {
|
|
77745
77690
|
const { id } = ctx.params;
|
|
77746
77691
|
const task = index.taskQueue.queryTask(id);
|
|
77747
77692
|
if (!task) {
|
|
@@ -77762,7 +77707,7 @@ router$7.get("/:id/download", async (ctx) => {
|
|
|
77762
77707
|
const fileId = fileCache.setFile(task.output);
|
|
77763
77708
|
ctx.body = fileId;
|
|
77764
77709
|
});
|
|
77765
|
-
router$
|
|
77710
|
+
router$8.post("/testVirtualRecord", async (ctx) => {
|
|
77766
77711
|
const { config, folderPath, startTime } = ctx.request.body;
|
|
77767
77712
|
if (!config) {
|
|
77768
77713
|
ctx.status = 400;
|
|
@@ -77803,7 +77748,7 @@ router$7.post("/testVirtualRecord", async (ctx) => {
|
|
|
77803
77748
|
ctx.body = error instanceof Error ? error.message : "Internal server error";
|
|
77804
77749
|
}
|
|
77805
77750
|
});
|
|
77806
|
-
router$
|
|
77751
|
+
router$8.post("/executeVirtualRecord", async (ctx) => {
|
|
77807
77752
|
const { config, folderPath, startTime } = ctx.request.body;
|
|
77808
77753
|
if (!config) {
|
|
77809
77754
|
ctx.status = 400;
|
|
@@ -77847,7 +77792,7 @@ router$7.post("/executeVirtualRecord", async (ctx) => {
|
|
|
77847
77792
|
/**
|
|
77848
77793
|
* 生成waveform数据
|
|
77849
77794
|
*/
|
|
77850
|
-
router$
|
|
77795
|
+
router$8.post("/extractPeaks", async (ctx) => {
|
|
77851
77796
|
const { input } = ctx.request.body;
|
|
77852
77797
|
if (!input) {
|
|
77853
77798
|
ctx.status = 400;
|
|
@@ -77865,7 +77810,7 @@ router$7.post("/extractPeaks", async (ctx) => {
|
|
|
77865
77810
|
/**
|
|
77866
77811
|
* 分析波形数据,主要用于检测唱歌边界点
|
|
77867
77812
|
*/
|
|
77868
|
-
router$
|
|
77813
|
+
router$8.post("/analyzerWaveform", async (ctx) => {
|
|
77869
77814
|
const { input, config } = ctx.request.body;
|
|
77870
77815
|
if (!input) {
|
|
77871
77816
|
ctx.status = 400;
|
|
@@ -77876,10 +77821,10 @@ router$7.post("/analyzerWaveform", async (ctx) => {
|
|
|
77876
77821
|
ctx.body = { output: data };
|
|
77877
77822
|
});
|
|
77878
77823
|
|
|
77879
|
-
const router$
|
|
77824
|
+
const router$7 = new Router$1({
|
|
77880
77825
|
prefix: "/assets",
|
|
77881
77826
|
});
|
|
77882
|
-
router$
|
|
77827
|
+
router$7.get("/cover/:filename", async (ctx) => {
|
|
77883
77828
|
const { filename } = ctx.params;
|
|
77884
77829
|
const coverPath = path$7.join(exports.config.userDataPath, "cover", filename);
|
|
77885
77830
|
if (await index.fs.pathExists(coverPath)) {
|
|
@@ -77891,7 +77836,7 @@ router$6.get("/cover/:filename", async (ctx) => {
|
|
|
77891
77836
|
ctx.body = "Cover not found";
|
|
77892
77837
|
}
|
|
77893
77838
|
});
|
|
77894
|
-
router$
|
|
77839
|
+
router$7.get("/download/:id", async (ctx) => {
|
|
77895
77840
|
const { id } = ctx.params;
|
|
77896
77841
|
const file = fileCache.get(id);
|
|
77897
77842
|
if (!file) {
|
|
@@ -78025,10 +77970,10 @@ var douyin = {
|
|
|
78025
77970
|
download,
|
|
78026
77971
|
};
|
|
78027
77972
|
|
|
78028
|
-
const router$
|
|
77973
|
+
const router$6 = new Router$1({
|
|
78029
77974
|
prefix: "/video",
|
|
78030
77975
|
});
|
|
78031
|
-
router$
|
|
77976
|
+
router$6.post("/parse", async (ctx) => {
|
|
78032
77977
|
let url = ctx.request.body.url;
|
|
78033
77978
|
if (!url) {
|
|
78034
77979
|
throw new Error("url is required");
|
|
@@ -78036,11 +77981,11 @@ router$5.post("/parse", async (ctx) => {
|
|
|
78036
77981
|
url = url.trim();
|
|
78037
77982
|
ctx.body = await parseVideo({ url });
|
|
78038
77983
|
});
|
|
78039
|
-
router$
|
|
77984
|
+
router$6.post("/download", async (ctx) => {
|
|
78040
77985
|
let options = ctx.request.body;
|
|
78041
77986
|
ctx.body = await downloadVideo(options);
|
|
78042
77987
|
});
|
|
78043
|
-
router$
|
|
77988
|
+
router$6.post("/sub/parse", async (ctx) => {
|
|
78044
77989
|
let data = ctx.request.body;
|
|
78045
77990
|
if (!data.url) {
|
|
78046
77991
|
throw new Error("url is required");
|
|
@@ -78048,12 +77993,12 @@ router$5.post("/sub/parse", async (ctx) => {
|
|
|
78048
77993
|
const res = await index.videoSub.parse(data.url);
|
|
78049
77994
|
ctx.body = res;
|
|
78050
77995
|
});
|
|
78051
|
-
router$
|
|
77996
|
+
router$6.post("/sub/add", async (ctx) => {
|
|
78052
77997
|
let data = ctx.request.body;
|
|
78053
77998
|
const res = index.videoSub.add(data);
|
|
78054
77999
|
ctx.body = res;
|
|
78055
78000
|
});
|
|
78056
|
-
router$
|
|
78001
|
+
router$6.post("/sub/remove", async (ctx) => {
|
|
78057
78002
|
let data = ctx.request.body;
|
|
78058
78003
|
if (!data.id) {
|
|
78059
78004
|
throw new Error("id is required");
|
|
@@ -78061,7 +78006,7 @@ router$5.post("/sub/remove", async (ctx) => {
|
|
|
78061
78006
|
const res = index.videoSub.remove(data.id);
|
|
78062
78007
|
ctx.body = res;
|
|
78063
78008
|
});
|
|
78064
|
-
router$
|
|
78009
|
+
router$6.post("/sub/update", async (ctx) => {
|
|
78065
78010
|
let data = ctx.request.body;
|
|
78066
78011
|
if (!data.id || !data.name || !data.platform || !data.subId) {
|
|
78067
78012
|
throw new Error("id, name, platform, subId is required");
|
|
@@ -78069,11 +78014,11 @@ router$5.post("/sub/update", async (ctx) => {
|
|
|
78069
78014
|
const res = index.videoSub.update(data);
|
|
78070
78015
|
ctx.body = res;
|
|
78071
78016
|
});
|
|
78072
|
-
router$
|
|
78017
|
+
router$6.get("/sub/list", async (ctx) => {
|
|
78073
78018
|
const res = index.videoSub.list();
|
|
78074
78019
|
ctx.body = res;
|
|
78075
78020
|
});
|
|
78076
|
-
router$
|
|
78021
|
+
router$6.post("/sub/check", async (ctx) => {
|
|
78077
78022
|
const data = ctx.request.body;
|
|
78078
78023
|
const res = await index.videoSub.check(data.id);
|
|
78079
78024
|
ctx.body = res;
|
|
@@ -78396,7 +78341,7 @@ function extractBVNumber(videoUrl) {
|
|
|
78396
78341
|
}
|
|
78397
78342
|
}
|
|
78398
78343
|
|
|
78399
|
-
const router$
|
|
78344
|
+
const router$5 = new Router$1({
|
|
78400
78345
|
prefix: "/record-history",
|
|
78401
78346
|
});
|
|
78402
78347
|
/**
|
|
@@ -78410,7 +78355,7 @@ const router$4 = new Router$1({
|
|
|
78410
78355
|
* @param {number} [endTime] - 结束时间(时间戳)
|
|
78411
78356
|
* @returns
|
|
78412
78357
|
*/
|
|
78413
|
-
router$
|
|
78358
|
+
router$5.get("/list", async (ctx) => {
|
|
78414
78359
|
const { room_id, platform, page, pageSize, startTime, endTime } = ctx.query;
|
|
78415
78360
|
if (!room_id || !platform) {
|
|
78416
78361
|
ctx.status = 400;
|
|
@@ -78456,7 +78401,7 @@ router$4.get("/list", async (ctx) => {
|
|
|
78456
78401
|
* @route DELETE /record-history/:id
|
|
78457
78402
|
* @param {number} id - 记录ID
|
|
78458
78403
|
*/
|
|
78459
|
-
router$
|
|
78404
|
+
router$5.delete("/:id", async (ctx) => {
|
|
78460
78405
|
const { id } = ctx.params;
|
|
78461
78406
|
if (!id || isNaN(parseInt(id))) {
|
|
78462
78407
|
ctx.status = 400;
|
|
@@ -78529,12 +78474,24 @@ const getDanmaFile = async (videoFile) => {
|
|
|
78529
78474
|
}
|
|
78530
78475
|
return null;
|
|
78531
78476
|
};
|
|
78477
|
+
const createDanmaFileResponse = async (videoFile) => {
|
|
78478
|
+
const danmaFile = await getDanmaFile(videoFile);
|
|
78479
|
+
let danmaFileId = null;
|
|
78480
|
+
if (danmaFile) {
|
|
78481
|
+
danmaFileId = fileCache.setFile(danmaFile.file);
|
|
78482
|
+
}
|
|
78483
|
+
return {
|
|
78484
|
+
danmaFilePath: danmaFile?.file || null,
|
|
78485
|
+
danmaFileId,
|
|
78486
|
+
danmaFileExt: danmaFile?.ext || null,
|
|
78487
|
+
};
|
|
78488
|
+
};
|
|
78532
78489
|
/**
|
|
78533
|
-
*
|
|
78490
|
+
* 获取历史记录文件信息
|
|
78534
78491
|
* @route GET /record-history/file/:id
|
|
78535
78492
|
* @param {number} id - 记录ID
|
|
78536
78493
|
*/
|
|
78537
|
-
router$
|
|
78494
|
+
router$5.get("/file/:id", async (ctx) => {
|
|
78538
78495
|
const { id } = ctx.params;
|
|
78539
78496
|
if (!id || isNaN(parseInt(id))) {
|
|
78540
78497
|
ctx.status = 400;
|
|
@@ -78557,18 +78514,276 @@ router$4.get("/file/:id", async (ctx) => {
|
|
|
78557
78514
|
videoFileExt = "ts";
|
|
78558
78515
|
break;
|
|
78559
78516
|
}
|
|
78560
|
-
const
|
|
78561
|
-
let danmaFileId = null;
|
|
78562
|
-
if (danmaFile) {
|
|
78563
|
-
danmaFileId = fileCache.setFile(danmaFile.file);
|
|
78564
|
-
}
|
|
78517
|
+
const danmaInfo = await createDanmaFileResponse(videoFile);
|
|
78565
78518
|
ctx.body = {
|
|
78566
78519
|
videoFilePath: videoFile,
|
|
78567
78520
|
videoFileId,
|
|
78568
78521
|
videoFileExt,
|
|
78569
|
-
|
|
78570
|
-
|
|
78571
|
-
|
|
78522
|
+
...danmaInfo,
|
|
78523
|
+
};
|
|
78524
|
+
});
|
|
78525
|
+
router$5.post("/danma-file", async (ctx) => {
|
|
78526
|
+
const { videoFilePath } = ctx.request.body;
|
|
78527
|
+
if (!videoFilePath) {
|
|
78528
|
+
ctx.status = 400;
|
|
78529
|
+
ctx.body = {
|
|
78530
|
+
code: 400,
|
|
78531
|
+
message: "videoFilePath不能为空",
|
|
78532
|
+
};
|
|
78533
|
+
return;
|
|
78534
|
+
}
|
|
78535
|
+
if (!(await index.fs.pathExists(videoFilePath))) {
|
|
78536
|
+
ctx.status = 404;
|
|
78537
|
+
ctx.body = {
|
|
78538
|
+
code: 404,
|
|
78539
|
+
message: "视频文件不存在",
|
|
78540
|
+
};
|
|
78541
|
+
return;
|
|
78542
|
+
}
|
|
78543
|
+
ctx.body = await createDanmaFileResponse(videoFilePath);
|
|
78544
|
+
});
|
|
78545
|
+
|
|
78546
|
+
const upload = multer({ dest: os$1.tmpdir() });
|
|
78547
|
+
const router$4 = new Router$1({
|
|
78548
|
+
prefix: "/files",
|
|
78549
|
+
});
|
|
78550
|
+
const DELETE_DIRS_ENV = "BILILIVE_TOOLS_DELETE_DIRS";
|
|
78551
|
+
const videoExts = new Set([".flv", ".mp4", ".ts", ".mkv", ".webm", ".m4v", ".m4s"]);
|
|
78552
|
+
const danmakuExts = new Set([".ass", ".xml", ".srt"]);
|
|
78553
|
+
function normalizePath(inputPath) {
|
|
78554
|
+
return path$7.resolve(inputPath);
|
|
78555
|
+
}
|
|
78556
|
+
function normalizeForCompare(inputPath) {
|
|
78557
|
+
const resolved = normalizePath(inputPath);
|
|
78558
|
+
return process.platform === "win32" ? resolved.toLowerCase() : resolved;
|
|
78559
|
+
}
|
|
78560
|
+
function isSubPath(targetPath, rootPath) {
|
|
78561
|
+
const normalizedTarget = normalizeForCompare(targetPath);
|
|
78562
|
+
const normalizedRoot = normalizeForCompare(rootPath);
|
|
78563
|
+
if (normalizedTarget === normalizedRoot) {
|
|
78564
|
+
return true;
|
|
78565
|
+
}
|
|
78566
|
+
const relative = path$7.relative(normalizedRoot, normalizedTarget);
|
|
78567
|
+
return relative !== "" && !relative.startsWith("..") && !path$7.isAbsolute(relative);
|
|
78568
|
+
}
|
|
78569
|
+
function getRootPath() {
|
|
78570
|
+
const webhookConfig = exports.appConfig.get("webhook");
|
|
78571
|
+
const recorderConfig = exports.appConfig.get("recorder");
|
|
78572
|
+
const rootPath = webhookConfig?.recoderFolder || recorderConfig?.savePath;
|
|
78573
|
+
if (!rootPath) {
|
|
78574
|
+
throw new Error("未配置录制目录");
|
|
78575
|
+
}
|
|
78576
|
+
return normalizePath(rootPath);
|
|
78577
|
+
}
|
|
78578
|
+
function getAllowedDeleteDirs() {
|
|
78579
|
+
const envValue = process.env[DELETE_DIRS_ENV] || "";
|
|
78580
|
+
return envValue
|
|
78581
|
+
.split(",")
|
|
78582
|
+
.map((item) => item.trim())
|
|
78583
|
+
.filter(Boolean)
|
|
78584
|
+
.map((item) => normalizePath(item));
|
|
78585
|
+
}
|
|
78586
|
+
function getFileKind(filePath) {
|
|
78587
|
+
const ext = path$7.extname(filePath).toLowerCase();
|
|
78588
|
+
if (videoExts.has(ext)) {
|
|
78589
|
+
return "video";
|
|
78590
|
+
}
|
|
78591
|
+
if (danmakuExts.has(ext)) {
|
|
78592
|
+
return "danmaku";
|
|
78593
|
+
}
|
|
78594
|
+
return null;
|
|
78595
|
+
}
|
|
78596
|
+
function canDeleteFile(filePath) {
|
|
78597
|
+
const fileKind = getFileKind(filePath);
|
|
78598
|
+
if (!fileKind) {
|
|
78599
|
+
return false;
|
|
78600
|
+
}
|
|
78601
|
+
const allowedDeleteDirs = getAllowedDeleteDirs();
|
|
78602
|
+
if (allowedDeleteDirs.length === 0) {
|
|
78603
|
+
return false;
|
|
78604
|
+
}
|
|
78605
|
+
return allowedDeleteDirs.some((dir) => isSubPath(filePath, dir));
|
|
78606
|
+
}
|
|
78607
|
+
async function ensureDirectory(dirPath) {
|
|
78608
|
+
if (!(await index.fs.pathExists(dirPath))) {
|
|
78609
|
+
throw new Error("录制目录不存在");
|
|
78610
|
+
}
|
|
78611
|
+
const stat = await index.fs.stat(dirPath);
|
|
78612
|
+
if (!stat.isDirectory()) {
|
|
78613
|
+
throw new Error("录制目录无效");
|
|
78614
|
+
}
|
|
78615
|
+
}
|
|
78616
|
+
async function resolveBrowsePath(inputPath) {
|
|
78617
|
+
const rootPath = getRootPath();
|
|
78618
|
+
await ensureDirectory(rootPath);
|
|
78619
|
+
const currentPath = inputPath ? normalizePath(inputPath) : rootPath;
|
|
78620
|
+
if (!isSubPath(currentPath, rootPath)) {
|
|
78621
|
+
throw new Error("访问路径超出录制目录范围");
|
|
78622
|
+
}
|
|
78623
|
+
const stat = await index.fs.stat(currentPath).catch(() => null);
|
|
78624
|
+
if (!stat || !stat.isDirectory()) {
|
|
78625
|
+
throw new Error("目录不存在");
|
|
78626
|
+
}
|
|
78627
|
+
return {
|
|
78628
|
+
rootPath,
|
|
78629
|
+
currentPath,
|
|
78630
|
+
};
|
|
78631
|
+
}
|
|
78632
|
+
router$4.get("/list", async (ctx) => {
|
|
78633
|
+
const inputPath = ctx.query.path;
|
|
78634
|
+
const { rootPath, currentPath } = await resolveBrowsePath(inputPath);
|
|
78635
|
+
const names = await index.fs.readdir(currentPath);
|
|
78636
|
+
const items = [];
|
|
78637
|
+
for (const name of names) {
|
|
78638
|
+
const filePath = path$7.join(currentPath, name);
|
|
78639
|
+
const stat = await index.fs.stat(filePath).catch(() => null);
|
|
78640
|
+
if (!stat) {
|
|
78641
|
+
continue;
|
|
78642
|
+
}
|
|
78643
|
+
if (stat.isDirectory()) {
|
|
78644
|
+
items.push({
|
|
78645
|
+
name,
|
|
78646
|
+
path: filePath,
|
|
78647
|
+
type: "directory",
|
|
78648
|
+
mtimeMs: stat.mtimeMs,
|
|
78649
|
+
canDelete: false,
|
|
78650
|
+
});
|
|
78651
|
+
continue;
|
|
78652
|
+
}
|
|
78653
|
+
const fileKind = getFileKind(filePath);
|
|
78654
|
+
if (!fileKind) {
|
|
78655
|
+
continue;
|
|
78656
|
+
}
|
|
78657
|
+
items.push({
|
|
78658
|
+
name,
|
|
78659
|
+
path: filePath,
|
|
78660
|
+
type: "file",
|
|
78661
|
+
size: stat.size,
|
|
78662
|
+
mtimeMs: stat.mtimeMs,
|
|
78663
|
+
canDelete: canDeleteFile(filePath),
|
|
78664
|
+
fileKind,
|
|
78665
|
+
});
|
|
78666
|
+
}
|
|
78667
|
+
items.sort((left, right) => {
|
|
78668
|
+
if (left.type !== right.type) {
|
|
78669
|
+
return left.type === "directory" ? -1 : 1;
|
|
78670
|
+
}
|
|
78671
|
+
return left.name.localeCompare(right.name, "zh-CN");
|
|
78672
|
+
});
|
|
78673
|
+
ctx.body = {
|
|
78674
|
+
rootPath,
|
|
78675
|
+
currentPath,
|
|
78676
|
+
parentPath: currentPath === rootPath ? null : path$7.dirname(currentPath),
|
|
78677
|
+
deleteEnabled: getAllowedDeleteDirs().length > 0,
|
|
78678
|
+
list: items,
|
|
78679
|
+
};
|
|
78680
|
+
});
|
|
78681
|
+
router$4.post("/download", async (ctx) => {
|
|
78682
|
+
const { path: filePath } = ctx.request.body;
|
|
78683
|
+
if (!filePath) {
|
|
78684
|
+
ctx.status = 400;
|
|
78685
|
+
ctx.body = { message: "文件路径不能为空" };
|
|
78686
|
+
return;
|
|
78687
|
+
}
|
|
78688
|
+
const { rootPath } = await resolveBrowsePath(path$7.dirname(filePath));
|
|
78689
|
+
const resolvedFilePath = normalizePath(filePath);
|
|
78690
|
+
if (!isSubPath(resolvedFilePath, rootPath)) {
|
|
78691
|
+
throw new Error("访问路径超出录制目录范围");
|
|
78692
|
+
}
|
|
78693
|
+
const stat = await index.fs.stat(resolvedFilePath).catch(() => null);
|
|
78694
|
+
if (!stat || !stat.isFile()) {
|
|
78695
|
+
throw new Error("文件不存在");
|
|
78696
|
+
}
|
|
78697
|
+
const fileKind = getFileKind(resolvedFilePath);
|
|
78698
|
+
if (!fileKind) {
|
|
78699
|
+
throw new Error("不支持下载该文件类型");
|
|
78700
|
+
}
|
|
78701
|
+
const fileId = fileCache.setFile(resolvedFilePath);
|
|
78702
|
+
ctx.body = {
|
|
78703
|
+
fileId,
|
|
78704
|
+
fileName: path$7.basename(resolvedFilePath),
|
|
78705
|
+
fileKind,
|
|
78706
|
+
};
|
|
78707
|
+
});
|
|
78708
|
+
router$4.post("/delete", async (ctx) => {
|
|
78709
|
+
const { path: filePath } = ctx.request.body;
|
|
78710
|
+
if (!filePath) {
|
|
78711
|
+
ctx.status = 400;
|
|
78712
|
+
ctx.body = { message: "文件路径不能为空" };
|
|
78713
|
+
return;
|
|
78714
|
+
}
|
|
78715
|
+
const resolvedFilePath = normalizePath(filePath);
|
|
78716
|
+
const { rootPath } = await resolveBrowsePath(path$7.dirname(resolvedFilePath));
|
|
78717
|
+
if (!isSubPath(resolvedFilePath, rootPath)) {
|
|
78718
|
+
throw new Error("访问路径超出录制目录范围");
|
|
78719
|
+
}
|
|
78720
|
+
const stat = await index.fs.stat(resolvedFilePath).catch(() => null);
|
|
78721
|
+
if (!stat || !stat.isFile()) {
|
|
78722
|
+
throw new Error("文件不存在");
|
|
78723
|
+
}
|
|
78724
|
+
const fileKind = getFileKind(resolvedFilePath);
|
|
78725
|
+
if (!fileKind) {
|
|
78726
|
+
throw new Error("仅支持删除视频和弹幕文件");
|
|
78727
|
+
}
|
|
78728
|
+
if (!canDeleteFile(resolvedFilePath)) {
|
|
78729
|
+
throw new Error(`当前未开启删除,或文件不在 ${DELETE_DIRS_ENV} 白名单目录中`);
|
|
78730
|
+
}
|
|
78731
|
+
await index.trashItem(resolvedFilePath);
|
|
78732
|
+
ctx.body = {
|
|
78733
|
+
message: "删除成功",
|
|
78734
|
+
path: resolvedFilePath,
|
|
78735
|
+
fileKind,
|
|
78736
|
+
};
|
|
78737
|
+
});
|
|
78738
|
+
router$4.post("/exists", async (ctx) => {
|
|
78739
|
+
const { filepath } = ctx.request.body;
|
|
78740
|
+
const exists = await index.fs.pathExists(filepath);
|
|
78741
|
+
ctx.body = exists;
|
|
78742
|
+
});
|
|
78743
|
+
router$4.post("/join", async (ctx) => {
|
|
78744
|
+
const { dir, name } = ctx.request.body;
|
|
78745
|
+
if (!index.fs.existsSync(dir)) {
|
|
78746
|
+
ctx.status = 400;
|
|
78747
|
+
ctx.body = "文件夹不存在";
|
|
78748
|
+
return;
|
|
78749
|
+
}
|
|
78750
|
+
const filePath = path$7.join(dir, name);
|
|
78751
|
+
ctx.body = filePath;
|
|
78752
|
+
});
|
|
78753
|
+
/**
|
|
78754
|
+
* @api {get} /files/temp 获取缓存文件夹路径
|
|
78755
|
+
* @apiDescription 获取当前配置的缓存文件夹路径
|
|
78756
|
+
* @apiSuccess {string} path 缓存文件夹路径
|
|
78757
|
+
*/
|
|
78758
|
+
router$4.get("/temp", async (ctx) => {
|
|
78759
|
+
try {
|
|
78760
|
+
const tempPath = index.getTempPath();
|
|
78761
|
+
ctx.body = tempPath;
|
|
78762
|
+
}
|
|
78763
|
+
catch (error) {
|
|
78764
|
+
console.error("获取缓存路径失败:", error);
|
|
78765
|
+
ctx.status = 500;
|
|
78766
|
+
ctx.body = "获取缓存路径失败";
|
|
78767
|
+
}
|
|
78768
|
+
});
|
|
78769
|
+
router$4.post("/cover/upload", upload.single("file"), async (ctx) => {
|
|
78770
|
+
const file = ctx.request?.file?.path;
|
|
78771
|
+
if (!file) {
|
|
78772
|
+
ctx.status = 400;
|
|
78773
|
+
ctx.body = "No file selected";
|
|
78774
|
+
return;
|
|
78775
|
+
}
|
|
78776
|
+
const originalname = ctx.request?.file?.originalname;
|
|
78777
|
+
const ext = path$7.extname(originalname);
|
|
78778
|
+
const coverPath = path$7.join(exports.config.userDataPath, "cover");
|
|
78779
|
+
const outputName = `${index.uuid()}${ext}`;
|
|
78780
|
+
// 将图片复制到指定目录
|
|
78781
|
+
await index.fs.ensureDir(coverPath);
|
|
78782
|
+
await index.fs.copyFile(file, path$7.join(coverPath, outputName));
|
|
78783
|
+
await index.fs.remove(file).catch(() => { });
|
|
78784
|
+
ctx.body = {
|
|
78785
|
+
name: outputName,
|
|
78786
|
+
path: `/assets/cover/${outputName}`,
|
|
78572
78787
|
};
|
|
78573
78788
|
});
|
|
78574
78789
|
|
|
@@ -78587,8 +78802,7 @@ function int2HexColor(color) {
|
|
|
78587
78802
|
}
|
|
78588
78803
|
return `#${hex}`;
|
|
78589
78804
|
}
|
|
78590
|
-
|
|
78591
|
-
const { filepath } = ctx.request.body;
|
|
78805
|
+
async function parseForArtPlayerData(filepath) {
|
|
78592
78806
|
const data = await index.parseDanmu(filepath);
|
|
78593
78807
|
const danmuList = [];
|
|
78594
78808
|
for (const item of data.danmu) {
|
|
@@ -78622,7 +78836,42 @@ router$3.post("/parseForArtPlayer", async (ctx) => {
|
|
|
78622
78836
|
style: {},
|
|
78623
78837
|
});
|
|
78624
78838
|
}
|
|
78625
|
-
|
|
78839
|
+
return danmuList;
|
|
78840
|
+
}
|
|
78841
|
+
router$3.get("/content/:id", async (ctx) => {
|
|
78842
|
+
const { id } = ctx.params;
|
|
78843
|
+
const file = fileCache.get(id);
|
|
78844
|
+
if (!file) {
|
|
78845
|
+
ctx.status = 404;
|
|
78846
|
+
ctx.body = { message: "弹幕文件不存在" };
|
|
78847
|
+
return;
|
|
78848
|
+
}
|
|
78849
|
+
if (!(await index.fs.pathExists(file.path))) {
|
|
78850
|
+
ctx.status = 404;
|
|
78851
|
+
ctx.body = { message: "弹幕文件不存在" };
|
|
78852
|
+
return;
|
|
78853
|
+
}
|
|
78854
|
+
const ext = path$7.extname(file.path).toLowerCase();
|
|
78855
|
+
if (ext === ".ass") {
|
|
78856
|
+
ctx.body = {
|
|
78857
|
+
danmaType: "ass",
|
|
78858
|
+
content: await index.fs.readFile(file.path, "utf-8"),
|
|
78859
|
+
};
|
|
78860
|
+
return;
|
|
78861
|
+
}
|
|
78862
|
+
if (ext === ".xml") {
|
|
78863
|
+
ctx.body = {
|
|
78864
|
+
danmaType: "xml",
|
|
78865
|
+
content: await parseForArtPlayerData(file.path),
|
|
78866
|
+
};
|
|
78867
|
+
return;
|
|
78868
|
+
}
|
|
78869
|
+
ctx.status = 400;
|
|
78870
|
+
ctx.body = { message: "不支持的弹幕格式" };
|
|
78871
|
+
});
|
|
78872
|
+
router$3.post("/parseForArtPlayer", async (ctx) => {
|
|
78873
|
+
const { filepath } = ctx.request.body;
|
|
78874
|
+
ctx.body = await parseForArtPlayerData(filepath);
|
|
78626
78875
|
});
|
|
78627
78876
|
|
|
78628
78877
|
const getConfig = (type) => {
|
|
@@ -79052,20 +79301,23 @@ async function subtitleRecognize(file, modelId, options) {
|
|
|
79052
79301
|
timeGapThreshold,
|
|
79053
79302
|
fillGap,
|
|
79054
79303
|
disableCache,
|
|
79304
|
+
song: options?.song,
|
|
79055
79305
|
});
|
|
79056
79306
|
try {
|
|
79057
79307
|
// 生成缓存路径
|
|
79058
79308
|
const cachePath = index.getTempPath();
|
|
79059
79309
|
const fileHash = await index.calculateFileQuickHash(file);
|
|
79060
|
-
// TODO:缓存有bug
|
|
79310
|
+
// TODO:缓存有bug,第二个是不同参数热词参数不同
|
|
79061
79311
|
const cacheFileName = `asr_subtitle_cache_${fileHash}_${modelId}.json`;
|
|
79062
79312
|
const cacheFilePath = path$7.join(cachePath, cacheFileName);
|
|
79063
79313
|
let asrResult = null;
|
|
79064
79314
|
// 尝试从缓存读取
|
|
79065
79315
|
if (!disableCache && (await index.fs.pathExists(cacheFilePath))) ;
|
|
79066
79316
|
if (!asrResult) {
|
|
79067
|
-
// 调用 ASR
|
|
79068
|
-
asrResult = await recognize$1(file, modelId
|
|
79317
|
+
// 调用 ASR 识别
|
|
79318
|
+
asrResult = await recognize$1(file, modelId, {
|
|
79319
|
+
filterMusic: options?.song ? false : true, // 启用音乐过滤
|
|
79320
|
+
});
|
|
79069
79321
|
// 保存到缓存(如果未禁用缓存)
|
|
79070
79322
|
if (!disableCache) ;
|
|
79071
79323
|
}
|
|
@@ -79194,6 +79446,7 @@ router$1.post("/subtitle", async (ctx) => {
|
|
|
79194
79446
|
const srt = await subtitleRecognize(audioFile, asrModelId, {
|
|
79195
79447
|
offset: data.offset,
|
|
79196
79448
|
disableCache: true,
|
|
79449
|
+
song: data.song,
|
|
79197
79450
|
});
|
|
79198
79451
|
// 清理临时音频文件
|
|
79199
79452
|
if (needCleanup) {
|
|
@@ -80326,11 +80579,12 @@ class WebhookHandler {
|
|
|
80326
80579
|
index.logObj.info(`[EventBuffer] 处理匹配的事件对: ${pair.open.filePath}`);
|
|
80327
80580
|
const config = this.configManager.getConfig(pair.open.roomId);
|
|
80328
80581
|
if (!config.open) {
|
|
80329
|
-
index.logObj.
|
|
80582
|
+
index.logObj.warn(`${pair.open.roomId} is not open`);
|
|
80330
80583
|
return;
|
|
80331
80584
|
}
|
|
80332
80585
|
// 检查文件大小
|
|
80333
80586
|
if (!(await this.validateFileSize(config, pair.close))) {
|
|
80587
|
+
index.logObj.warn("文件大小不符合要求,跳过处理", pair.close.filePath);
|
|
80334
80588
|
return;
|
|
80335
80589
|
}
|
|
80336
80590
|
// 先处理 open 事件
|
|
@@ -80464,6 +80718,12 @@ class WebhookHandler {
|
|
|
80464
80718
|
* 验证文件大小
|
|
80465
80719
|
*/
|
|
80466
80720
|
async validateFileSize(config, options) {
|
|
80721
|
+
if (!config.minSize)
|
|
80722
|
+
return true;
|
|
80723
|
+
if (!(await index.fs.pathExists(options.filePath))) {
|
|
80724
|
+
index.logObj.warn(`文件不存在: ${options.filePath}`);
|
|
80725
|
+
return true;
|
|
80726
|
+
}
|
|
80467
80727
|
const fileSize = await index.getFileSize(options.filePath);
|
|
80468
80728
|
const fileSizeMB = fileSize / 1024 / 1024;
|
|
80469
80729
|
if (fileSizeMB >= config.minSize) {
|
|
@@ -81473,7 +81733,7 @@ exports.handler = void 0;
|
|
|
81473
81733
|
exports.appConfig = void 0;
|
|
81474
81734
|
exports.container = void 0;
|
|
81475
81735
|
const fileCache = createFileCache();
|
|
81476
|
-
path$7.dirname(require$$1$2.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index-
|
|
81736
|
+
path$7.dirname(require$$1$2.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index-BxJPCbAG.cjs', document.baseURI).href))));
|
|
81477
81737
|
const authMiddleware = (passKey) => {
|
|
81478
81738
|
return async (ctx, next) => {
|
|
81479
81739
|
const authHeader = ctx.headers["authorization"] || ctx.request.query.auth;
|
|
@@ -81510,8 +81770,8 @@ app.use(errorMiddleware);
|
|
|
81510
81770
|
app.use(cors$1());
|
|
81511
81771
|
app.use(bodyParserWrapper());
|
|
81512
81772
|
app.use(router.routes());
|
|
81513
|
-
app.use(router$
|
|
81514
|
-
app.use(router$
|
|
81773
|
+
app.use(router$h.routes());
|
|
81774
|
+
app.use(router$7.routes());
|
|
81515
81775
|
async function serverStart(options, axContainer) {
|
|
81516
81776
|
exports.container = axContainer;
|
|
81517
81777
|
exports.config = exports.container.resolve("globalConfig");
|
|
@@ -81522,20 +81782,21 @@ async function serverStart(options, axContainer) {
|
|
|
81522
81782
|
const auth = authMiddleware(passKey);
|
|
81523
81783
|
app.use(auth);
|
|
81524
81784
|
}
|
|
81785
|
+
app.use(router$g.routes());
|
|
81525
81786
|
app.use(router$f.routes());
|
|
81787
|
+
app.use(router$d.routes());
|
|
81526
81788
|
app.use(router$e.routes());
|
|
81527
81789
|
app.use(router$c.routes());
|
|
81528
|
-
app.use(router$
|
|
81529
|
-
app.use(router$b.routes());
|
|
81790
|
+
app.use(router$a.routes());
|
|
81530
81791
|
app.use(router$9.routes());
|
|
81531
81792
|
app.use(router$8.routes());
|
|
81532
|
-
app.use(router$
|
|
81793
|
+
app.use(router$6.routes());
|
|
81533
81794
|
app.use(router$5.routes());
|
|
81534
81795
|
app.use(router$4.routes());
|
|
81535
81796
|
app.use(router$3.routes());
|
|
81536
81797
|
app.use(router$2.routes());
|
|
81537
81798
|
app.use(router$1.routes());
|
|
81538
|
-
app.use(router$
|
|
81799
|
+
app.use(router$b.routes());
|
|
81539
81800
|
app.use(router.allowedMethods());
|
|
81540
81801
|
await createServer(options);
|
|
81541
81802
|
return app;
|