bililive-cli 3.22.1 → 3.22.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,7 +4,7 @@ var path$3 = require('node:path');
4
4
  var http$4 = require('node:http');
5
5
  var urlLib = require('node:url');
6
6
  var https = require('node:https');
7
- var index$1 = require('./index-CmRhhp3m.cjs');
7
+ var index$1 = require('./index-Bqpkb00O.cjs');
8
8
  var require$$0$5 = require('tty');
9
9
  var require$$1$4 = require('util');
10
10
  var require$$0$b = require('assert');
@@ -13491,9 +13491,9 @@ for (const method of methods$1) {
13491
13491
 
13492
13492
  Router.prototype.del = Router.prototype['delete'];
13493
13493
 
13494
- var router$i = Router;
13494
+ var router$j = Router;
13495
13495
 
13496
- var Router$1 = /*@__PURE__*/index$1.getDefaultExportFromCjs(router$i);
13496
+ var Router$1 = /*@__PURE__*/index$1.getDefaultExportFromCjs(router$j);
13497
13497
 
13498
13498
  const vary = varyExports;
13499
13499
 
@@ -30025,11 +30025,11 @@ var recorderService = {
30025
30025
  getStreamUrl,
30026
30026
  };
30027
30027
 
30028
- const router$h = new Router$1();
30029
- router$h.get("/webhook", async (ctx) => {
30028
+ const router$i = new Router$1();
30029
+ router$i.get("/webhook", async (ctx) => {
30030
30030
  ctx.body = "webhook 服务器已启动";
30031
30031
  });
30032
- router$h.post("/webhook/bililiverecorder", async (ctx) => {
30032
+ router$i.post("/webhook/bililiverecorder", async (ctx) => {
30033
30033
  const config = appConfig.getAll();
30034
30034
  index$1.logObj.info("录播姬:", ctx.request.body);
30035
30035
  const event = ctx.request.body;
@@ -30061,7 +30061,7 @@ router$h.post("/webhook/bililiverecorder", async (ctx) => {
30061
30061
  }
30062
30062
  ctx.body = "ok";
30063
30063
  });
30064
- router$h.post("/webhook/blrec", async (ctx) => {
30064
+ router$i.post("/webhook/blrec", async (ctx) => {
30065
30065
  const webhook = appConfig.get("webhook");
30066
30066
  index$1.logObj.info("blrec webhook:", ctx.request.body);
30067
30067
  const event = ctx.request.body;
@@ -30096,7 +30096,7 @@ router$h.post("/webhook/blrec", async (ctx) => {
30096
30096
  * OneLiveRec webhook事件处理
30097
30097
  * 由于只有在结束后才能从文件的备注中获取到,只处理结束事件获取信息后模拟开始和结束事件
30098
30098
  */
30099
- router$h.post("/webhook/oneliverec", async (ctx) => {
30099
+ router$i.post("/webhook/oneliverec", async (ctx) => {
30100
30100
  const webhook = appConfig.get("webhook");
30101
30101
  index$1.logObj.info("oneliverec webhook:", ctx.request.body);
30102
30102
  const event = ctx.request.body;
@@ -30132,7 +30132,7 @@ router$h.post("/webhook/oneliverec", async (ctx) => {
30132
30132
  }
30133
30133
  ctx.body = "ok";
30134
30134
  });
30135
- router$h.post("/webhook/ddtv", async (ctx) => {
30135
+ router$i.post("/webhook/ddtv", async (ctx) => {
30136
30136
  const webhook = appConfig.get("webhook");
30137
30137
  const event = ctx.request.body;
30138
30138
  if (webhook?.open && (event.cmd === "RecordingEnd" || event.cmd === "StartRecording")) {
@@ -30190,7 +30190,7 @@ const getDDTVTrueFile = (event) => {
30190
30190
  danmuFile: danmuFileTruePath,
30191
30191
  };
30192
30192
  };
30193
- router$h.post("/webhook/custom", async (ctx) => {
30193
+ router$i.post("/webhook/custom", async (ctx) => {
30194
30194
  const webhook = appConfig.get("webhook");
30195
30195
  index$1.logObj.info("custom: webhook", ctx.request.body);
30196
30196
  const event = ctx.request.body;
@@ -30239,7 +30239,7 @@ async function checkFileInterval() {
30239
30239
  }
30240
30240
  }, 1000 * 60);
30241
30241
  }
30242
- router$h.get("/bili/stream", async (ctx) => {
30242
+ router$i.get("/bili/stream", async (ctx) => {
30243
30243
  const { id } = ctx.query;
30244
30244
  try {
30245
30245
  const m3u8Content = await recorderService.getBiliStream(id);
@@ -48104,21 +48104,21 @@ function makePromise(multer, name) {
48104
48104
  multer.diskStorage = originalMulter.diskStorage;
48105
48105
  multer.memoryStorage = originalMulter.memoryStorage;
48106
48106
 
48107
- const router$g = new Router$1({
48107
+ const router$h = new Router$1({
48108
48108
  prefix: "/config",
48109
48109
  });
48110
48110
  const upload$1 = multer({ dest: os$1.tmpdir() });
48111
- router$g.get("/", async (ctx) => {
48111
+ router$h.get("/", async (ctx) => {
48112
48112
  const config = appConfig.getAll();
48113
48113
  ctx.body = config;
48114
48114
  });
48115
- router$g.post("/", async (ctx) => {
48115
+ router$h.post("/", async (ctx) => {
48116
48116
  const data = ctx.request.body;
48117
48117
  // @ts-ignore
48118
48118
  appConfig.setAll(data);
48119
48119
  ctx.body = "success";
48120
48120
  });
48121
- router$g.get("/get", async (ctx) => {
48121
+ router$h.get("/get", async (ctx) => {
48122
48122
  const key = ctx.query.key;
48123
48123
  if (!key) {
48124
48124
  ctx.body = "key is required";
@@ -48127,7 +48127,7 @@ router$g.get("/get", async (ctx) => {
48127
48127
  const value = appConfig.get(key);
48128
48128
  ctx.body = value;
48129
48129
  });
48130
- router$g.post("/set", async (ctx) => {
48130
+ router$h.post("/set", async (ctx) => {
48131
48131
  const data = ctx.request.body;
48132
48132
  if (!data.key || !data.value) {
48133
48133
  ctx.body = "key and value is required";
@@ -48137,7 +48137,7 @@ router$g.post("/set", async (ctx) => {
48137
48137
  appConfig.set(data.key, data.value);
48138
48138
  ctx.body = "success";
48139
48139
  });
48140
- router$g.post("/verifyBiliKey", async (ctx) => {
48140
+ router$h.post("/verifyBiliKey", async (ctx) => {
48141
48141
  try {
48142
48142
  const serverKey = process.env.BILILIVE_TOOLS_BILIKEY;
48143
48143
  const configured = typeof serverKey === "string" && serverKey.trim().length > 0;
@@ -48181,7 +48181,7 @@ router$g.post("/verifyBiliKey", async (ctx) => {
48181
48181
  ctx.body = response;
48182
48182
  }
48183
48183
  });
48184
- router$g.post("/reset-bin", async (ctx) => {
48184
+ router$h.post("/reset-bin", async (ctx) => {
48185
48185
  const data = ctx.request.body;
48186
48186
  const type = data.type;
48187
48187
  if (!type) {
@@ -48238,7 +48238,7 @@ async function exportConfig(opts) {
48238
48238
  const content = zip.generateNodeStream({ type: "nodebuffer" });
48239
48239
  return content;
48240
48240
  }
48241
- router$g.get("/export", async (ctx) => {
48241
+ router$h.get("/export", async (ctx) => {
48242
48242
  try {
48243
48243
  const globalConfig = container.resolve("globalConfig");
48244
48244
  const { configPath, videoPresetPath, danmuPresetPath, ffmpegPresetPath, userDataPath } = globalConfig;
@@ -48271,7 +48271,7 @@ router$g.get("/export", async (ctx) => {
48271
48271
  ctx.body = "export error";
48272
48272
  }
48273
48273
  });
48274
- router$g.post("/import", upload$1.single("file"), async (ctx) => {
48274
+ router$h.post("/import", upload$1.single("file"), async (ctx) => {
48275
48275
  const file = ctx.request?.file?.path;
48276
48276
  if (!file) {
48277
48277
  ctx.status = 400;
@@ -48330,7 +48330,7 @@ router$g.post("/import", upload$1.single("file"), async (ctx) => {
48330
48330
  }));
48331
48331
  ctx.body = "success";
48332
48332
  });
48333
- router$g.post("/notifyTest", async (ctx) => {
48333
+ router$h.post("/notifyTest", async (ctx) => {
48334
48334
  const { title, desp, options, notifyType } = ctx.request.body;
48335
48335
  await index$1._send(title, desp, options, notifyType, {
48336
48336
  context: {
@@ -53146,15 +53146,15 @@ async function handleSrt(input, output) {
53146
53146
  return nodes;
53147
53147
  }
53148
53148
 
53149
- const router$f = new Router$1({
53149
+ const router$g = new Router$1({
53150
53150
  prefix: "/llm",
53151
53151
  });
53152
- router$f.get("/ollama/modelList", async (ctx) => {
53152
+ router$g.get("/ollama/modelList", async (ctx) => {
53153
53153
  const data = ctx.request.query;
53154
53154
  const models = (await ollama.getModelList(data.baseUrl)).models.map((item) => item.name);
53155
53155
  ctx.body = models;
53156
53156
  });
53157
- router$f.post("/translate", async (ctx) => {
53157
+ router$g.post("/translate", async (ctx) => {
53158
53158
  const data = ctx.request.body;
53159
53159
  console.log(data);
53160
53160
  const content = await addTranslateTask(data.input, data.output);
@@ -55499,10 +55499,10 @@ var semver = {
55499
55499
 
55500
55500
  var semver$1 = /*@__PURE__*/index$1.getDefaultExportFromCjs(semver);
55501
55501
 
55502
- const router$e = new Router$1({
55502
+ const router$f = new Router$1({
55503
55503
  prefix: "/common",
55504
55504
  });
55505
- router$e.get("/version", (ctx) => {
55505
+ router$f.get("/version", (ctx) => {
55506
55506
  ctx.body = config.version;
55507
55507
  });
55508
55508
  function getDriveLetters() {
@@ -55524,7 +55524,7 @@ function getDriveLetters() {
55524
55524
  function isDriveLetter(letter) {
55525
55525
  return /^[a-zA-Z]:\\$/.test(letter);
55526
55526
  }
55527
- router$e.get("/files", async (ctx) => {
55527
+ router$f.get("/files", async (ctx) => {
55528
55528
  const params = ctx.request.query;
55529
55529
  let root = params.path;
55530
55530
  const filterExts = (params.exts || "")
@@ -55580,26 +55580,26 @@ router$e.get("/files", async (ctx) => {
55580
55580
  return;
55581
55581
  }
55582
55582
  });
55583
- router$e.post("/danma/timestamp", async (ctx) => {
55583
+ router$f.post("/danma/timestamp", async (ctx) => {
55584
55584
  const { filepath } = ctx.request.body;
55585
55585
  ctx.body = await index$1.readXmlTimestamp(filepath);
55586
55586
  });
55587
- router$e.post("/parse-video-metadata", async (ctx) => {
55587
+ router$f.post("/parse-video-metadata", async (ctx) => {
55588
55588
  const files = ctx.request.body;
55589
55589
  ctx.body = await index$1.parseMeta(files);
55590
55590
  });
55591
55591
  /**
55592
55592
  * @api {get} /common/fonts 获取系统字体列表
55593
55593
  */
55594
- router$e.get("/fonts", async (ctx) => {
55594
+ router$f.get("/fonts", async (ctx) => {
55595
55595
  const { getFontsList } = await Promise.resolve().then(function () { return require('./fonts-DxTEygXH.cjs'); });
55596
55596
  ctx.body = await getFontsList();
55597
55597
  });
55598
- router$e.get("/appStartTime", async (ctx) => {
55598
+ router$f.get("/appStartTime", async (ctx) => {
55599
55599
  const data = index$1.statisticsService.query("start_time");
55600
55600
  ctx.body = data?.value;
55601
55601
  });
55602
- router$e.get("/statistics", async (ctx) => {
55602
+ router$f.get("/statistics", async (ctx) => {
55603
55603
  const startTime = index$1.statisticsService.query("start_time");
55604
55604
  const videoTotalDuaration = index$1.recordHistoryService.getTotalDuration();
55605
55605
  const recordingNum = recorderService.getRecorderNum(true);
@@ -55611,16 +55611,16 @@ router$e.get("/statistics", async (ctx) => {
55611
55611
  recorderNum,
55612
55612
  };
55613
55613
  });
55614
- router$e.get("/exportLogs", async (ctx) => {
55614
+ router$f.get("/exportLogs", async (ctx) => {
55615
55615
  const logFilePath = config.logPath;
55616
55616
  ctx.body = index$1.fs.createReadStream(logFilePath);
55617
55617
  });
55618
- router$e.get("/getLogContent", async (ctx) => {
55618
+ router$f.get("/getLogContent", async (ctx) => {
55619
55619
  const logFilePath = config.logPath;
55620
55620
  const content = await index$1.fs.readFile(logFilePath, "utf-8");
55621
55621
  ctx.body = content;
55622
55622
  });
55623
- router$e.post("/readDanma", async (ctx) => {
55623
+ router$f.post("/readDanma", async (ctx) => {
55624
55624
  const { filepath } = ctx.request.body;
55625
55625
  // 只允许读取ass或xml文件
55626
55626
  if (!filepath.endsWith(".ass") && !filepath.endsWith(".xml") && !filepath.endsWith(".srt")) {
@@ -55636,7 +55636,7 @@ router$e.post("/readDanma", async (ctx) => {
55636
55636
  const content = await index$1.fs.readFile(filepath, "utf-8");
55637
55637
  ctx.body = content;
55638
55638
  });
55639
- router$e.post("/readLLC", async (ctx) => {
55639
+ router$f.post("/readLLC", async (ctx) => {
55640
55640
  const { filepath } = ctx.request.body;
55641
55641
  if (!(await index$1.fs.pathExists(filepath))) {
55642
55642
  ctx.status = 400;
@@ -55651,7 +55651,7 @@ router$e.post("/readLLC", async (ctx) => {
55651
55651
  }
55652
55652
  ctx.body = content;
55653
55653
  });
55654
- router$e.post("/writeLLC", async (ctx) => {
55654
+ router$f.post("/writeLLC", async (ctx) => {
55655
55655
  const { filepath, content } = ctx.request.body;
55656
55656
  if (!content.includes("cutSegments")) {
55657
55657
  ctx.status = 400;
@@ -55661,13 +55661,13 @@ router$e.post("/writeLLC", async (ctx) => {
55661
55661
  await index$1.fs.writeFile(filepath, content, "utf-8");
55662
55662
  ctx.body = "success";
55663
55663
  });
55664
- router$e.post("/genTimeData", async (ctx) => {
55664
+ router$f.post("/genTimeData", async (ctx) => {
55665
55665
  const { filepath } = ctx.request.body;
55666
55666
  const data = await index$1.genTimeData(filepath);
55667
55667
  ctx.body = data;
55668
55668
  });
55669
55669
  // 申请视频ID接口
55670
- router$e.post("/applyVideoId", async (ctx) => {
55670
+ router$f.post("/applyVideoId", async (ctx) => {
55671
55671
  const { videoPath } = ctx.request.body;
55672
55672
  if (!(await index$1.fs.pathExists(videoPath))) {
55673
55673
  ctx.status = 404;
@@ -55725,7 +55725,7 @@ router$e.post("/applyVideoId", async (ctx) => {
55725
55725
  type,
55726
55726
  };
55727
55727
  });
55728
- router$e.get("/video/:videoId", async (ctx) => {
55728
+ router$f.get("/video/:videoId", async (ctx) => {
55729
55729
  const videoId = ctx.params.videoId;
55730
55730
  // 从映射表中获取视频路径
55731
55731
  const videoInfo = fileCache.get(videoId);
@@ -55800,12 +55800,12 @@ router$e.get("/video/:videoId", async (ctx) => {
55800
55800
  ctx.body = file;
55801
55801
  }
55802
55802
  });
55803
- router$e.post("/parseDanmu", async (ctx) => {
55803
+ router$f.post("/parseDanmu", async (ctx) => {
55804
55804
  const { filepath } = ctx.request.body;
55805
55805
  const data = await index$1.parseDanmu(filepath);
55806
55806
  ctx.body = data;
55807
55807
  });
55808
- router$e.post("/testWebhook", async (ctx) => {
55808
+ router$f.post("/testWebhook", async (ctx) => {
55809
55809
  const list = [];
55810
55810
  // 检查所有live数据,如果存在同一个live中,前一个part还在录制中,但是后面的part已经是其他状态,则返回相关id以及文件
55811
55811
  const liveList = handler.liveData;
@@ -55827,7 +55827,7 @@ router$e.post("/testWebhook", async (ctx) => {
55827
55827
  }
55828
55828
  ctx.body = list;
55829
55829
  });
55830
- router$e.post("/handleWebhook", async (ctx) => {
55830
+ router$f.post("/handleWebhook", async (ctx) => {
55831
55831
  const { data } = ctx.request.body;
55832
55832
  const liveList = handler.liveData;
55833
55833
  for (const live of liveList) {
@@ -55843,7 +55843,7 @@ router$e.post("/handleWebhook", async (ctx) => {
55843
55843
  }
55844
55844
  ctx.body = "success";
55845
55845
  });
55846
- router$e.post("/webhook", async (ctx) => {
55846
+ router$f.post("/webhook", async (ctx) => {
55847
55847
  const liveList = handler.liveData;
55848
55848
  ctx.body = liveList;
55849
55849
  });
@@ -55853,7 +55853,7 @@ router$e.post("/webhook", async (ctx) => {
55853
55853
  * 如果不是,检查全局webhook配置,判断是否开启全局开关,判断是否在黑名单,判断配置是否配置了上传预设,上传账号
55854
55854
  * 返回{hasError:boolean,errorInfo:string}
55855
55855
  */
55856
- router$e.get("/whyUploadFailed", async (ctx) => {
55856
+ router$f.get("/whyUploadFailed", async (ctx) => {
55857
55857
  const { roomId } = ctx.request.query;
55858
55858
  if (!roomId) {
55859
55859
  ctx.status = 400;
@@ -56010,7 +56010,7 @@ router$e.get("/whyUploadFailed", async (ctx) => {
56010
56010
  * @apiSuccess {boolean} needUpdate 是否需要更新
56011
56011
  * @apiSuccess {string} [downloadUrl] 下载地址
56012
56012
  */
56013
- router$e.get("/checkUpdate", async (ctx) => {
56013
+ router$f.get("/checkUpdate", async (ctx) => {
56014
56014
  try {
56015
56015
  const res = await fetch("https://githubraw.irenmu.com/renmu123/biliLive-tools/master/package.json");
56016
56016
  const data = await res.json();
@@ -56043,7 +56043,7 @@ router$e.get("/checkUpdate", async (ctx) => {
56043
56043
  * @apiSuccess {number} used 已用空间(GB)
56044
56044
  * @apiSuccess {number} usedPercentage 使用百分比
56045
56045
  */
56046
- router$e.get("/diskSpace", async (ctx) => {
56046
+ router$f.get("/diskSpace", async (ctx) => {
56047
56047
  try {
56048
56048
  const config = appConfig.getAll();
56049
56049
  const recoderFolder = config?.recorder?.savePath;
@@ -56077,10 +56077,10 @@ router$e.get("/diskSpace", async (ctx) => {
56077
56077
  }
56078
56078
  });
56079
56079
 
56080
- const router$d = new Router$1({
56080
+ const router$e = new Router$1({
56081
56081
  prefix: "/user",
56082
56082
  });
56083
- router$d.get("/list", async (ctx) => {
56083
+ router$e.get("/list", async (ctx) => {
56084
56084
  const list = index$1.biliApi.readUserList();
56085
56085
  ctx.body = list.map((item) => {
56086
56086
  return {
@@ -56091,22 +56091,22 @@ router$d.get("/list", async (ctx) => {
56091
56091
  };
56092
56092
  });
56093
56093
  });
56094
- router$d.post("/delete", async (ctx) => {
56094
+ router$e.post("/delete", async (ctx) => {
56095
56095
  const { uid } = ctx.request.body;
56096
56096
  await index$1.biliApi.deleteUser(uid);
56097
56097
  ctx.status = 200;
56098
56098
  });
56099
- router$d.post("/update", async (ctx) => {
56099
+ router$e.post("/update", async (ctx) => {
56100
56100
  const { uid } = ctx.request.body;
56101
56101
  await index$1.biliApi.updateUserInfo(uid);
56102
56102
  ctx.status = 200;
56103
56103
  });
56104
- router$d.post("/update_auth", async (ctx) => {
56104
+ router$e.post("/update_auth", async (ctx) => {
56105
56105
  const { uid } = ctx.request.body;
56106
56106
  await index$1.biliApi.updateAuth(uid);
56107
56107
  ctx.status = 200;
56108
56108
  });
56109
- router$d.post("/get_cookie", async (ctx) => {
56109
+ router$e.post("/get_cookie", async (ctx) => {
56110
56110
  const { uid, timestamp, signature } = ctx.request.body;
56111
56111
  const currentTimestamp = Math.floor(Date.now() / 1000);
56112
56112
  if (Math.abs(currentTimestamp - timestamp) > 10) {
@@ -56137,11 +56137,11 @@ router$d.post("/get_cookie", async (ctx) => {
56137
56137
  ctx.body = "获取失败,请重试";
56138
56138
  }
56139
56139
  });
56140
- router$d.get("/export", async (ctx) => {
56140
+ router$e.get("/export", async (ctx) => {
56141
56141
  const list = index$1.biliApi.readUserList();
56142
56142
  ctx.body = list;
56143
56143
  });
56144
- router$d.post("/export_single", async (ctx) => {
56144
+ router$e.post("/export_single", async (ctx) => {
56145
56145
  const { uid } = ctx.request.body;
56146
56146
  const user = index$1.biliApi.readUser(uid);
56147
56147
  if (!user) {
@@ -56151,7 +56151,7 @@ router$d.post("/export_single", async (ctx) => {
56151
56151
  }
56152
56152
  ctx.body = user;
56153
56153
  });
56154
- router$d.post("/import", async (ctx) => {
56154
+ router$e.post("/import", async (ctx) => {
56155
56155
  const { users } = ctx.request.body;
56156
56156
  if (!Array.isArray(users)) {
56157
56157
  ctx.status = 400;
@@ -56168,7 +56168,7 @@ router$d.post("/import", async (ctx) => {
56168
56168
  }
56169
56169
  ctx.status = 200;
56170
56170
  });
56171
- router$d.post("/import_single", async (ctx) => {
56171
+ router$e.post("/import_single", async (ctx) => {
56172
56172
  const { user } = ctx.request.body;
56173
56173
  if (!user?.mid || !user?.accessToken || !user?.refreshToken || !user?.cookie) {
56174
56174
  ctx.status = 400;
@@ -56179,42 +56179,42 @@ router$d.post("/import_single", async (ctx) => {
56179
56179
  ctx.status = 200;
56180
56180
  });
56181
56181
 
56182
- const router$c = new Router$1({
56182
+ const router$d = new Router$1({
56183
56183
  prefix: "/preset",
56184
56184
  });
56185
56185
  ////////////////// 弹幕预设 ///////////////////////////////
56186
- router$c.get("/danmu", async (ctx) => {
56186
+ router$d.get("/danmu", async (ctx) => {
56187
56187
  const danmuPreset = container.resolve("danmuPreset");
56188
56188
  ctx.body = await danmuPreset.list();
56189
56189
  });
56190
- router$c.get("/danmu/:id", async (ctx) => {
56190
+ router$d.get("/danmu/:id", async (ctx) => {
56191
56191
  const danmuPreset = container.resolve("danmuPreset");
56192
56192
  ctx.body = await danmuPreset.get(ctx.params.id);
56193
56193
  });
56194
- router$c.post("/danmu", async (ctx) => {
56194
+ router$d.post("/danmu", async (ctx) => {
56195
56195
  const danmuPreset = container.resolve("danmuPreset");
56196
56196
  const data = ctx.request.body;
56197
56197
  ctx.body = await danmuPreset.save({ ...data, id: index$1.uuid() });
56198
56198
  });
56199
- router$c.del("/danmu/:id", async (ctx) => {
56199
+ router$d.del("/danmu/:id", async (ctx) => {
56200
56200
  const danmuPreset = container.resolve("danmuPreset");
56201
56201
  ctx.body = await danmuPreset.delete(ctx.params.id);
56202
56202
  });
56203
- router$c.put("/danmu/:id", async (ctx) => {
56203
+ router$d.put("/danmu/:id", async (ctx) => {
56204
56204
  const danmuPreset = container.resolve("danmuPreset");
56205
56205
  const data = ctx.request.body;
56206
56206
  ctx.body = await danmuPreset.save({ ...data, id: ctx.params.id });
56207
56207
  });
56208
56208
  ////////////////// 视频上传预设 ///////////////////////////////
56209
- router$c.get("/video", async (ctx) => {
56209
+ router$d.get("/video", async (ctx) => {
56210
56210
  const preset = container.resolve("videoPreset");
56211
56211
  ctx.body = await preset.list();
56212
56212
  });
56213
- router$c.get("/video/:id", async (ctx) => {
56213
+ router$d.get("/video/:id", async (ctx) => {
56214
56214
  const preset = container.resolve("videoPreset");
56215
56215
  ctx.body = await preset.get(ctx.params.id);
56216
56216
  });
56217
- router$c.post("/video", async (ctx) => {
56217
+ router$d.post("/video", async (ctx) => {
56218
56218
  const preset = container.resolve("videoPreset");
56219
56219
  const data = ctx.request.body;
56220
56220
  data.config = index$1.omit(data.config, ["dtime", "staffs"]);
@@ -56224,11 +56224,11 @@ router$c.post("/video", async (ctx) => {
56224
56224
  }
56225
56225
  ctx.body = await preset.save({ ...data, id: index$1.uuid() });
56226
56226
  });
56227
- router$c.del("/video/:id", async (ctx) => {
56227
+ router$d.del("/video/:id", async (ctx) => {
56228
56228
  const preset = container.resolve("videoPreset");
56229
56229
  ctx.body = await preset.delete(ctx.params.id);
56230
56230
  });
56231
- router$c.put("/video/:id", async (ctx) => {
56231
+ router$d.put("/video/:id", async (ctx) => {
56232
56232
  const preset = container.resolve("videoPreset");
56233
56233
  const data = ctx.request.body;
56234
56234
  data.config = index$1.omit(data.config, ["dtime", "staffs"]);
@@ -56239,51 +56239,51 @@ router$c.put("/video/:id", async (ctx) => {
56239
56239
  ctx.body = await preset.save({ ...data, id: ctx.params.id });
56240
56240
  });
56241
56241
  ////////////////// ffmpeg预设 ///////////////////////////////
56242
- router$c.get("/ffmpeg", async (ctx) => {
56242
+ router$d.get("/ffmpeg", async (ctx) => {
56243
56243
  const preset = container.resolve("ffmpegPreset");
56244
56244
  ctx.body = await preset.list();
56245
56245
  });
56246
- router$c.get("/ffmpeg/options", async (ctx) => {
56246
+ router$d.get("/ffmpeg/options", async (ctx) => {
56247
56247
  const preset = container.resolve("ffmpegPreset");
56248
56248
  ctx.body = await preset.getFfmpegPresetOptions();
56249
56249
  });
56250
- router$c.get("/ffmpeg/:id", async (ctx) => {
56250
+ router$d.get("/ffmpeg/:id", async (ctx) => {
56251
56251
  const preset = container.resolve("ffmpegPreset");
56252
56252
  ctx.body = await preset.get(ctx.params.id);
56253
56253
  });
56254
- router$c.post("/ffmpeg", async (ctx) => {
56254
+ router$d.post("/ffmpeg", async (ctx) => {
56255
56255
  const preset = container.resolve("ffmpegPreset");
56256
56256
  const data = ctx.request.body;
56257
56257
  ctx.body = await preset.save({ ...data, id: index$1.uuid() });
56258
56258
  });
56259
- router$c.del("/ffmpeg/:id", async (ctx) => {
56259
+ router$d.del("/ffmpeg/:id", async (ctx) => {
56260
56260
  const preset = container.resolve("ffmpegPreset");
56261
56261
  ctx.body = await preset.delete(ctx.params.id);
56262
56262
  });
56263
- router$c.put("/ffmpeg/:id", async (ctx) => {
56263
+ router$d.put("/ffmpeg/:id", async (ctx) => {
56264
56264
  const preset = container.resolve("ffmpegPreset");
56265
56265
  const data = ctx.request.body;
56266
56266
  ctx.body = await preset.save({ ...data, id: ctx.params.id });
56267
56267
  });
56268
56268
  ////////////////// 字幕样式预设 ///////////////////////////////
56269
- router$c.get("/subtitle-style", async (ctx) => {
56269
+ router$d.get("/subtitle-style", async (ctx) => {
56270
56270
  const preset = container.resolve("subtitleStylePreset");
56271
56271
  ctx.body = await preset.list();
56272
56272
  });
56273
- router$c.get("/subtitle-style/:id", async (ctx) => {
56273
+ router$d.get("/subtitle-style/:id", async (ctx) => {
56274
56274
  const preset = container.resolve("subtitleStylePreset");
56275
56275
  ctx.body = await preset.get(ctx.params.id);
56276
56276
  });
56277
- router$c.post("/subtitle-style", async (ctx) => {
56277
+ router$d.post("/subtitle-style", async (ctx) => {
56278
56278
  const preset = container.resolve("subtitleStylePreset");
56279
56279
  const data = ctx.request.body;
56280
56280
  ctx.body = await preset.save({ ...data, id: index$1.uuid() });
56281
56281
  });
56282
- router$c.del("/subtitle-style/:id", async (ctx) => {
56282
+ router$d.del("/subtitle-style/:id", async (ctx) => {
56283
56283
  const preset = container.resolve("subtitleStylePreset");
56284
56284
  ctx.body = await preset.delete(ctx.params.id);
56285
56285
  });
56286
- router$c.put("/subtitle-style/:id", async (ctx) => {
56286
+ router$d.put("/subtitle-style/:id", async (ctx) => {
56287
56287
  const preset = container.resolve("subtitleStylePreset");
56288
56288
  const data = ctx.request.body;
56289
56289
  ctx.body = await preset.save({ ...data, id: ctx.params.id });
@@ -62606,7 +62606,7 @@ class MultipartBody {
62606
62606
  let fileFromPathWarned = false;
62607
62607
  async function fileFromPath(path, ...args) {
62608
62608
  // this import fails in environments that don't handle export maps correctly, like old versions of Jest
62609
- const { fileFromPath: _fileFromPath } = await Promise.resolve().then(function () { return require('./fileFromPath-D1rsnNRo.cjs'); });
62609
+ const { fileFromPath: _fileFromPath } = await Promise.resolve().then(function () { return require('./fileFromPath-BycXkXgu.cjs'); });
62610
62610
  if (!fileFromPathWarned) {
62611
62611
  console.warn(`fileFromPath is deprecated; use fs.createReadStream(${JSON.stringify(path)}) instead`);
62612
62612
  fileFromPathWarned = true;
@@ -73576,13 +73576,13 @@ async function songRecognize(file, audioStartTime = 0) {
73576
73576
  };
73577
73577
  }
73578
73578
 
73579
- const router$b = new Router$1({
73579
+ const router$c = new Router$1({
73580
73580
  prefix: "/sse",
73581
73581
  });
73582
73582
  /**
73583
73583
  * 流式查询日志
73584
73584
  */
73585
- router$b.get("/streamLogs", sse({
73585
+ router$c.get("/streamLogs", sse({
73586
73586
  maxClients: 5000,
73587
73587
  pingInterval: 60 * 60 * 1000,
73588
73588
  }), async (ctx) => {
@@ -73621,7 +73621,7 @@ router$b.get("/streamLogs", sse({
73621
73621
  /**
73622
73622
  * 获取弹幕流
73623
73623
  */
73624
- router$b.get("/recorder/danma", sse({
73624
+ router$c.get("/recorder/danma", sse({
73625
73625
  maxClients: 5000,
73626
73626
  pingInterval: 30000,
73627
73627
  }), async (ctx) => {
@@ -73634,7 +73634,7 @@ router$b.get("/recorder/danma", sse({
73634
73634
  }
73635
73635
  });
73636
73636
  });
73637
- router$b.get("/task/runningNum", sse({
73637
+ router$c.get("/task/runningNum", sse({
73638
73638
  maxClients: 5000,
73639
73639
  pingInterval: 30000,
73640
73640
  }), async (ctx) => {
@@ -73667,7 +73667,7 @@ router$b.get("/task/runningNum", sse({
73667
73667
  /**
73668
73668
  * 波形分析进度流
73669
73669
  */
73670
- router$b.get("/analyzerWaveform", sse({
73670
+ router$c.get("/analyzerWaveform", sse({
73671
73671
  maxClients: 100,
73672
73672
  pingInterval: 30000,
73673
73673
  }), async (ctx) => {
@@ -73842,7 +73842,7 @@ var streamerDetailService = {
73842
73842
  queryStreamerDetail,
73843
73843
  };
73844
73844
 
73845
- const router$a = new Router$1({
73845
+ const router$b = new Router$1({
73846
73846
  prefix: "/recorder",
73847
73847
  });
73848
73848
  const DANMA_TEST_WS_PATH = "/recorder/ws/danma-test";
@@ -73989,11 +73989,11 @@ const getSingleQueryValue$1 = (value) => {
73989
73989
  * @param sortDirection 排序方向 asc: 升序 desc: 降序
73990
73990
  * @returns 录制任务列表
73991
73991
  */
73992
- router$a.get("/list", async (ctx) => {
73992
+ router$b.get("/list", async (ctx) => {
73993
73993
  const query = ctx.request.query;
73994
73994
  ctx.body = { payload: await recorderService.getRecorders(query) };
73995
73995
  });
73996
- router$a.get("/detail", async (ctx) => {
73996
+ router$b.get("/detail", async (ctx) => {
73997
73997
  const recorderId = getSingleQueryValue$1(ctx.request.query.recorderId);
73998
73998
  const page = getSingleQueryValue$1(ctx.request.query.page);
73999
73999
  const pageSize = getSingleQueryValue$1(ctx.request.query.pageSize);
@@ -74030,7 +74030,7 @@ router$a.get("/detail", async (ctx) => {
74030
74030
  },
74031
74031
  };
74032
74032
  });
74033
- router$a.get("/ws/danma-test", async (ctx) => {
74033
+ router$b.get("/ws/danma-test", async (ctx) => {
74034
74034
  ctx.status = 426;
74035
74035
  ctx.body = {
74036
74036
  message: "请使用 WebSocket 连接此地址",
@@ -74045,7 +74045,7 @@ router$a.get("/ws/danma-test", async (ctx) => {
74045
74045
  },
74046
74046
  };
74047
74047
  });
74048
- router$a.post("/add", async (ctx) => {
74048
+ router$b.post("/add", async (ctx) => {
74049
74049
  const args = index$1.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", "segmentOnTitleChange", "liveStartNotification", "chargeLiveNotification", "liveEndNotification", "weight", "source", "videoFormat", "recorderType", "cookie", "doubleScreen", "onlyAudio", "useServerTimestamp", "handleTime", "debugLevel", "api");
74050
74050
  const data = await recorderService.addRecorder(args);
74051
74051
  ctx.body = { payload: data };
@@ -74056,7 +74056,7 @@ router$a.post("/add", async (ctx) => {
74056
74056
  * @param recorderId 直播间ID
74057
74057
  * @returns 录制器配置信息
74058
74058
  */
74059
- router$a.get("/:id", (ctx) => {
74059
+ router$b.get("/:id", (ctx) => {
74060
74060
  const { id } = ctx.params;
74061
74061
  ctx.body = { payload: recorderService.getRecorder({ id }) };
74062
74062
  });
@@ -74066,14 +74066,14 @@ router$a.get("/:id", (ctx) => {
74066
74066
  * @param recorderId 录制器 ID
74067
74067
  * @returns 重写分片地址后的 HLS 播放列表
74068
74068
  */
74069
- router$a.post("/:id/stream", async (ctx) => {
74069
+ router$b.post("/:id/stream", async (ctx) => {
74070
74070
  const { id } = ctx.params;
74071
74071
  const data = await recorderService.getStreamUrl(id);
74072
74072
  ctx.body = {
74073
74073
  payload: data,
74074
74074
  };
74075
74075
  });
74076
- router$a.put("/:id", (ctx) => {
74076
+ router$b.put("/:id", (ctx) => {
74077
74077
  const { id } = ctx.params;
74078
74078
  const patch = index$1.pick(ctx.request.body, "remarks", "disableAutoCheck", "quality", "streamPriorities", "sourcePriorities", "noGlobalFollowFields", "line", "disableProvideCommentsWhenRecording", "saveGiftDanma", "saveSCDanma", "saveCover", "segment", "sendToWebhook", "uid", "qualityRetry", "formatName", "useM3U8Proxy", "customHost", "codecName", "titleKeywords", "segmentOnTitleChange", "liveStartNotification", "chargeLiveNotification", "liveEndNotification", "weight", "source", "videoFormat", "recorderType", "cookie", "doubleScreen", "onlyAudio", "useServerTimestamp", "handleTime", "debugLevel", "convert2Mp4", "api");
74079
74079
  ctx.body = { payload: recorderService.updateRecorder({ id, ...patch }) };
@@ -74085,7 +74085,7 @@ router$a.put("/:id", (ctx) => {
74085
74085
  * @param removeHistory 是否删除录制历史,默认false
74086
74086
  * @returns null
74087
74087
  */
74088
- router$a.delete("/:id", (ctx) => {
74088
+ router$b.delete("/:id", (ctx) => {
74089
74089
  const { id } = ctx.params;
74090
74090
  const { removeHistory } = ctx.request.query;
74091
74091
  ctx.body = {
@@ -74099,7 +74099,7 @@ router$a.delete("/:id", (ctx) => {
74099
74099
  * @param recorderId 录制ID
74100
74100
  * @returns 录制任务信息
74101
74101
  */
74102
- router$a.post("/:id/start_record", async (ctx) => {
74102
+ router$b.post("/:id/start_record", async (ctx) => {
74103
74103
  const { id } = ctx.params;
74104
74104
  ctx.body = { payload: await recorderService.startRecord({ id }) };
74105
74105
  });
@@ -74109,7 +74109,7 @@ router$a.post("/:id/start_record", async (ctx) => {
74109
74109
  * @param recorderId 录制ID
74110
74110
  * @returns 录制任务信息
74111
74111
  */
74112
- router$a.post("/:id/start", async (ctx) => {
74112
+ router$b.post("/:id/start", async (ctx) => {
74113
74113
  const { id } = ctx.params;
74114
74114
  ctx.body = { payload: await recorderService.startRecord({ id }) };
74115
74115
  });
@@ -74120,7 +74120,7 @@ router$a.post("/:id/start", async (ctx) => {
74120
74120
  * @param recorderId 直播间ID
74121
74121
  * @returns 录制任务信息
74122
74122
  */
74123
- router$a.post("/:id/stop_record", async (ctx) => {
74123
+ router$b.post("/:id/stop_record", async (ctx) => {
74124
74124
  const { id } = ctx.params;
74125
74125
  ctx.body = { payload: await recorderService.stopRecord({ id }) };
74126
74126
  });
@@ -74131,7 +74131,7 @@ router$a.post("/:id/stop_record", async (ctx) => {
74131
74131
  * @param recorderId 录制ID
74132
74132
  * @returns 录制任务信息
74133
74133
  */
74134
- router$a.post("/:id/stop", async (ctx) => {
74134
+ router$b.post("/:id/stop", async (ctx) => {
74135
74135
  const { id } = ctx.params;
74136
74136
  ctx.body = { payload: await recorderService.stopRecord({ id }) };
74137
74137
  });
@@ -74141,7 +74141,7 @@ router$a.post("/:id/stop", async (ctx) => {
74141
74141
  * @param recorderId 直播间ID
74142
74142
  * @returns 录制任务信息
74143
74143
  */
74144
- router$a.post("/:id/cut", async (ctx) => {
74144
+ router$b.post("/:id/cut", async (ctx) => {
74145
74145
  const { id } = ctx.params;
74146
74146
  ctx.body = { payload: await recorderService.cutRecord({ id }) };
74147
74147
  });
@@ -74151,7 +74151,7 @@ router$a.post("/:id/cut", async (ctx) => {
74151
74151
  * @param recorderId 直播间ID
74152
74152
  * @returns 最近录制文件目录
74153
74153
  */
74154
- router$a.get("/:id/recent-record-folder", async (ctx) => {
74154
+ router$b.get("/:id/recent-record-folder", async (ctx) => {
74155
74155
  const { id } = ctx.params;
74156
74156
  ctx.body = { payload: await recorderService.getRecentRecordFolder({ id }) };
74157
74157
  });
@@ -74161,7 +74161,7 @@ router$a.get("/:id/recent-record-folder", async (ctx) => {
74161
74161
  * @param ids 直播间ID列表
74162
74162
  * @returns 批量操作结果
74163
74163
  */
74164
- router$a.post("/manager/batch_start_record", async (ctx) => {
74164
+ router$b.post("/manager/batch_start_record", async (ctx) => {
74165
74165
  const { ids } = ctx.request.body;
74166
74166
  ctx.body = { payload: await recorderService.batchStartRecord(ids) };
74167
74167
  });
@@ -74171,7 +74171,7 @@ router$a.post("/manager/batch_start_record", async (ctx) => {
74171
74171
  * @param ids 直播间ID列表
74172
74172
  * @returns 批量操作结果
74173
74173
  */
74174
- router$a.post("/manager/batch_stop_record", async (ctx) => {
74174
+ router$b.post("/manager/batch_stop_record", async (ctx) => {
74175
74175
  const { ids } = ctx.request.body;
74176
74176
  ctx.body = { payload: await recorderService.batchStopRecord(ids) };
74177
74177
  });
@@ -74181,7 +74181,7 @@ router$a.post("/manager/batch_stop_record", async (ctx) => {
74181
74181
  * @param url 直播间地址
74182
74182
  * @returns 直播间信息
74183
74183
  */
74184
- router$a.get("/manager/resolve-channel", async (ctx) => {
74184
+ router$b.get("/manager/resolve-channel", async (ctx) => {
74185
74185
  const { url } = ctx.query;
74186
74186
  const data = await recorderService.resolveChannel(url);
74187
74187
  ctx.body = { payload: data };
@@ -74192,7 +74192,7 @@ router$a.get("/manager/resolve-channel", async (ctx) => {
74192
74192
  * @param url 直播间地址
74193
74193
  * @returns 直播间信息
74194
74194
  */
74195
- router$a.get("/manager/resolve", async (ctx) => {
74195
+ router$b.get("/manager/resolve", async (ctx) => {
74196
74196
  const { url } = ctx.query;
74197
74197
  const data = await recorderService.resolve(url);
74198
74198
  ctx.body = { payload: data };
@@ -74203,7 +74203,7 @@ router$a.get("/manager/resolve", async (ctx) => {
74203
74203
  * @param channelURLs 直播间地址数组
74204
74204
  * @returns 批量解析结果
74205
74205
  */
74206
- router$a.post("/manager/batchResolveChannel", async (ctx) => {
74206
+ router$b.post("/manager/batchResolveChannel", async (ctx) => {
74207
74207
  const { channelURLs } = ctx.request.body;
74208
74208
  const data = await recorderService.batchResolveChannel(channelURLs);
74209
74209
  ctx.body = { payload: data };
@@ -74215,7 +74215,7 @@ router$a.post("/manager/batchResolveChannel", async (ctx) => {
74215
74215
  * @param forceRequest 强制查询直播间信息,不受配置限制,默认true
74216
74216
  * @returns 直播间实时信息列表
74217
74217
  */
74218
- router$a.post("/manager/live-info", async (ctx) => {
74218
+ router$b.post("/manager/live-info", async (ctx) => {
74219
74219
  const { ids } = ctx.request.body;
74220
74220
  const forceRequest = ctx.request.body.forceRequest ?? true;
74221
74221
  let requestInfoForRecord = true;
@@ -74230,7 +74230,7 @@ router$a.post("/manager/live-info", async (ctx) => {
74230
74230
  payload: list,
74231
74231
  };
74232
74232
  });
74233
- router$a.get("/douyin/live-info", async (ctx) => {
74233
+ router$b.get("/douyin/live-info", async (ctx) => {
74234
74234
  const { roomId, platform, dev } = ctx.request.query;
74235
74235
  if (platform !== "douyin") {
74236
74236
  ctx.body = { error: "Platform not supported" };
@@ -74263,7 +74263,7 @@ router$a.get("/douyin/live-info", async (ctx) => {
74263
74263
  * @param dev 是否返回开发信息,默认为false
74264
74264
  * @returns 直播流信息
74265
74265
  */
74266
- router$a.get("/douyin/stream-info", async (ctx) => {
74266
+ router$b.get("/douyin/stream-info", async (ctx) => {
74267
74267
  const { roomId, platform, dev, quality } = ctx.request.query;
74268
74268
  if (platform !== "douyin") {
74269
74269
  ctx.body = { error: "Platform not supported" };
@@ -74312,11 +74312,11 @@ function handleRecorderUpgrade(request, socket, head) {
74312
74312
  return true;
74313
74313
  }
74314
74314
 
74315
- const router$9 = new Router$1({
74315
+ const router$a = new Router$1({
74316
74316
  prefix: "/bili",
74317
74317
  });
74318
74318
  // 验证视频上传参数
74319
- router$9.post("/validUploadParams", async (ctx) => {
74319
+ router$a.post("/validUploadParams", async (ctx) => {
74320
74320
  const params = ctx.request.body;
74321
74321
  // @ts-ignore
74322
74322
  const [status, msg] = await index$1.validateBiliupConfig(params);
@@ -74330,7 +74330,7 @@ router$9.post("/validUploadParams", async (ctx) => {
74330
74330
  /**
74331
74331
  * 投稿中心视频列表
74332
74332
  */
74333
- router$9.get("/archives", async (ctx) => {
74333
+ router$a.get("/archives", async (ctx) => {
74334
74334
  const params = ctx.request.query;
74335
74335
  const { uid } = params;
74336
74336
  const data = await index$1.biliApi.getArchives(params, uid);
@@ -74339,40 +74339,40 @@ router$9.get("/archives", async (ctx) => {
74339
74339
  /**
74340
74340
  * 用户视频详情
74341
74341
  */
74342
- router$9.get("/user/archive/:bvid", async (ctx) => {
74342
+ router$a.get("/user/archive/:bvid", async (ctx) => {
74343
74343
  const params = ctx.request.query;
74344
74344
  const { uid } = params;
74345
74345
  const { bvid } = ctx.params;
74346
74346
  const data = await index$1.biliApi.getArchiveDetail(bvid, uid);
74347
74347
  ctx.body = data;
74348
74348
  });
74349
- router$9.post("/checkTag", async (ctx) => {
74349
+ router$a.post("/checkTag", async (ctx) => {
74350
74350
  const { tag, uid, } = ctx.request.body;
74351
74351
  const data = await index$1.biliApi.checkTag(tag, uid);
74352
74352
  ctx.body = data;
74353
74353
  });
74354
- router$9.get("/searchTopic", async (ctx) => {
74354
+ router$a.get("/searchTopic", async (ctx) => {
74355
74355
  const { keyword, uid } = ctx.request.query;
74356
74356
  const data = await index$1.biliApi.searchTopic(keyword, uid);
74357
74357
  ctx.body = data;
74358
74358
  });
74359
- router$9.get("/seasons", async (ctx) => {
74359
+ router$a.get("/seasons", async (ctx) => {
74360
74360
  const { uid } = ctx.request.query;
74361
74361
  const data = await index$1.biliApi.getSeasonList(uid);
74362
74362
  ctx.body = data;
74363
74363
  });
74364
- router$9.get("/reserveList", async (ctx) => {
74364
+ router$a.get("/reserveList", async (ctx) => {
74365
74365
  const { uid } = ctx.request.query;
74366
74366
  const data = await index$1.biliApi.getReserveList(uid);
74367
74367
  ctx.body = data;
74368
74368
  });
74369
- router$9.get("/season/:aid", async (ctx) => {
74369
+ router$a.get("/season/:aid", async (ctx) => {
74370
74370
  const { uid } = ctx.request.query;
74371
74371
  const { aid } = ctx.params;
74372
74372
  const data = await index$1.biliApi.getSessionId(Number(aid), uid);
74373
74373
  ctx.body = data;
74374
74374
  });
74375
- router$9.get("/platformArchiveDetail", async (ctx) => {
74375
+ router$a.get("/platformArchiveDetail", async (ctx) => {
74376
74376
  const { aid, uid } = ctx.request.query;
74377
74377
  const data = await index$1.biliApi.getPlatformArchiveDetail(aid, uid);
74378
74378
  ctx.body = data;
@@ -74380,7 +74380,7 @@ router$9.get("/platformArchiveDetail", async (ctx) => {
74380
74380
  /**
74381
74381
  * 上传以及续传视频
74382
74382
  */
74383
- router$9.post("/upload", async (ctx) => {
74383
+ router$a.post("/upload", async (ctx) => {
74384
74384
  const data = ctx.request.body;
74385
74385
  if (!data.uid) {
74386
74386
  ctx.body = "uid required";
@@ -74425,7 +74425,7 @@ router$9.post("/upload", async (ctx) => {
74425
74425
  });
74426
74426
  // 登录相关
74427
74427
  const loginObj = {};
74428
- router$9.post("/login", async (ctx) => {
74428
+ router$a.post("/login", async (ctx) => {
74429
74429
  const tv = new index$1.TvQrcodeLogin();
74430
74430
  const id = index$1.uuid();
74431
74431
  loginObj[id] = {
@@ -74457,7 +74457,7 @@ router$9.post("/login", async (ctx) => {
74457
74457
  id,
74458
74458
  };
74459
74459
  });
74460
- router$9.post("/login/cancel", async (ctx) => {
74460
+ router$a.post("/login/cancel", async (ctx) => {
74461
74461
  const { id } = ctx.request.body;
74462
74462
  if (!id) {
74463
74463
  ctx.body = "id required";
@@ -74474,7 +74474,7 @@ router$9.post("/login/cancel", async (ctx) => {
74474
74474
  tv.interrupt();
74475
74475
  ctx.body = "success";
74476
74476
  });
74477
- router$9.get("/login/poll", async (ctx) => {
74477
+ router$a.get("/login/poll", async (ctx) => {
74478
74478
  const { id } = ctx.request.query;
74479
74479
  if (!id) {
74480
74480
  ctx.body = "id required";
@@ -74489,13 +74489,13 @@ router$9.get("/login/poll", async (ctx) => {
74489
74489
  }
74490
74490
  ctx.body = index$1.omit(loginInfo, ["client"]);
74491
74491
  });
74492
- router$9.post("/formatTitle", async (ctx) => {
74492
+ router$a.post("/formatTitle", async (ctx) => {
74493
74493
  const data = ctx.request.body;
74494
74494
  const template = (data.template || "");
74495
74495
  const title = index$1.formatTitle(data.options, template);
74496
74496
  ctx.body = title;
74497
74497
  });
74498
- router$9.post("/formatPartTitle", async (ctx) => {
74498
+ router$a.post("/formatPartTitle", async (ctx) => {
74499
74499
  const data = ctx.request.body;
74500
74500
  const template = (data.template || "");
74501
74501
  const title = index$1.formatPartTitle(data.options ?? {
@@ -74508,7 +74508,7 @@ router$9.post("/formatPartTitle", async (ctx) => {
74508
74508
  }, template);
74509
74509
  ctx.body = title;
74510
74510
  });
74511
- router$9.post("/formatDesc", async (ctx) => {
74511
+ router$a.post("/formatDesc", async (ctx) => {
74512
74512
  const data = ctx.request.body;
74513
74513
  const template = (data.template || "");
74514
74514
  const desc = index$1.formatDesc(data.options ?? {
@@ -74521,18 +74521,116 @@ router$9.post("/formatDesc", async (ctx) => {
74521
74521
  ctx.body = desc;
74522
74522
  });
74523
74523
  // 搜索联合投稿UP主
74524
- router$9.get("/searchStaff", async (ctx) => {
74524
+ router$a.get("/searchStaff", async (ctx) => {
74525
74525
  const { kw, uid } = ctx.request.query;
74526
74526
  const data = await index$1.biliApi.searchStaffUser(Number(uid), kw);
74527
74527
  ctx.body = data;
74528
74528
  });
74529
74529
  // 获取联合投稿剩余次数
74530
- router$9.get("/staffRemaining", async (ctx) => {
74530
+ router$a.get("/staffRemaining", async (ctx) => {
74531
74531
  const { uid } = ctx.request.query;
74532
74532
  const data = await index$1.biliApi.getStaffRemaining(Number(uid));
74533
74533
  ctx.body = data;
74534
74534
  });
74535
74535
 
74536
+ const router$9 = new Router$1({ prefix: "/douyu" });
74537
+ const sessions = new Map();
74538
+ const purgeExpiredSessions = () => {
74539
+ const now = Date.now();
74540
+ for (const [id, session] of sessions) {
74541
+ if (session.expiresAt <= now) {
74542
+ session.cancel();
74543
+ sessions.delete(id);
74544
+ }
74545
+ }
74546
+ };
74547
+ router$9.post("/login", async (ctx) => {
74548
+ purgeExpiredSessions();
74549
+ const session = await index$1.DouyuQrcodeLogin.create();
74550
+ const id = crypto$3.randomUUID();
74551
+ sessions.set(id, session);
74552
+ ctx.body = { id, url: session.url, expiresAt: session.expiresAt };
74553
+ });
74554
+ router$9.get("/login/poll", async (ctx) => {
74555
+ const id = String(ctx.query.id || "");
74556
+ if (!id) {
74557
+ ctx.status = 400;
74558
+ ctx.body = "id required";
74559
+ return;
74560
+ }
74561
+ const session = sessions.get(id);
74562
+ if (!session) {
74563
+ ctx.status = 400;
74564
+ ctx.body = "login info not found";
74565
+ return;
74566
+ }
74567
+ const result = await session.poll();
74568
+ if (result.status === "completed") {
74569
+ index$1.writeDouyuUser(result.user);
74570
+ sessions.delete(id);
74571
+ ctx.body = { status: "completed" };
74572
+ return;
74573
+ }
74574
+ if (result.status === "error")
74575
+ sessions.delete(id);
74576
+ ctx.body = result;
74577
+ });
74578
+ router$9.post("/login/cancel", async (ctx) => {
74579
+ const { id } = ctx.request.body;
74580
+ if (!id) {
74581
+ ctx.status = 400;
74582
+ ctx.body = "id required";
74583
+ return;
74584
+ }
74585
+ const session = sessions.get(id);
74586
+ if (!session) {
74587
+ ctx.status = 400;
74588
+ ctx.body = "login info not found";
74589
+ return;
74590
+ }
74591
+ session.cancel();
74592
+ sessions.delete(id);
74593
+ ctx.body = "success";
74594
+ });
74595
+ router$9.get("/user/list", (ctx) => {
74596
+ ctx.body = index$1.readDouyuUserList().map(({ uid, name, avatar, createdAt, updatedAt }) => ({
74597
+ uid,
74598
+ name,
74599
+ avatar,
74600
+ createdAt,
74601
+ updatedAt,
74602
+ }));
74603
+ });
74604
+ router$9.post("/user/update_auth", async (ctx) => {
74605
+ const uid = Number(ctx.request.body?.uid);
74606
+ if (!Number.isSafeInteger(uid) || uid <= 0) {
74607
+ ctx.status = 400;
74608
+ ctx.body = "valid uid required";
74609
+ return;
74610
+ }
74611
+ await index$1.refreshDouyuUser(uid);
74612
+ ctx.body = "success";
74613
+ });
74614
+ router$9.post("/user/validate", async (ctx) => {
74615
+ const uid = Number(ctx.request.body?.uid);
74616
+ if (!Number.isSafeInteger(uid) || uid <= 0) {
74617
+ ctx.status = 400;
74618
+ ctx.body = "valid uid required";
74619
+ return;
74620
+ }
74621
+ ctx.body = { valid: await index$1.validateDouyuUser(uid) };
74622
+ });
74623
+ router$9.post("/user/delete", (ctx) => {
74624
+ const uid = Number(ctx.request.body.uid);
74625
+ if (!Number.isSafeInteger(uid) || uid <= 0) {
74626
+ ctx.status = 400;
74627
+ ctx.body = "valid uid required";
74628
+ return;
74629
+ }
74630
+ index$1.deleteDouyuUser(uid);
74631
+ ctx.body = "success";
74632
+ });
74633
+
74536
74634
  async function flvRepair(input, output, opts) {
74537
74635
  // 如果不是flv,直接报错
74538
74636
  if (path$3.extname(input).toLowerCase() !== ".flv") {
@@ -79275,7 +79373,7 @@ let handler;
79275
79373
  let appConfig;
79276
79374
  let container;
79277
79375
  const fileCache = createFileCache();
79278
- path$3.dirname(urlLib.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index-B-Cevjk4.cjs', document.baseURI).href))));
79376
+ path$3.dirname(urlLib.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index-yHivC5bo.cjs', document.baseURI).href))));
79279
79377
  const authMiddleware = (passKey) => {
79280
79378
  return async (ctx, next) => {
79281
79379
  const authHeader = ctx.headers["authorization"] || ctx.request.query.auth;
@@ -79312,7 +79410,7 @@ app.use(errorMiddleware);
79312
79410
  app.use(cors$1());
79313
79411
  app.use(bodyParserWrapper());
79314
79412
  app.use(router.routes());
79315
- app.use(router$h.routes());
79413
+ app.use(router$i.routes());
79316
79414
  app.use(router$7.routes());
79317
79415
  async function serverStart(options, axContainer) {
79318
79416
  container = axContainer;
@@ -79324,11 +79422,12 @@ async function serverStart(options, axContainer) {
79324
79422
  const auth = authMiddleware(passKey);
79325
79423
  app.use(auth);
79326
79424
  }
79425
+ app.use(router$h.routes());
79327
79426
  app.use(router$g.routes());
79427
+ app.use(router$e.routes());
79328
79428
  app.use(router$f.routes());
79329
79429
  app.use(router$d.routes());
79330
- app.use(router$e.routes());
79331
- app.use(router$c.routes());
79430
+ app.use(router$b.routes());
79332
79431
  app.use(router$a.routes());
79333
79432
  app.use(router$9.routes());
79334
79433
  app.use(router$8.routes());
@@ -79338,7 +79437,7 @@ async function serverStart(options, axContainer) {
79338
79437
  app.use(router$3.routes());
79339
79438
  app.use(router$2.routes());
79340
79439
  app.use(router$1.routes());
79341
- app.use(router$b.routes());
79440
+ app.use(router$c.routes());
79342
79441
  app.use(router.allowedMethods());
79343
79442
  await createServer(options);
79344
79443
  return app;