bililive-cli 4.0.0 → 4.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,8 +2,8 @@
2
2
 
3
3
  var require$$0 = require('fs');
4
4
  var require$$0$1 = require('path');
5
- var index$1 = require('./index-CWkwaDmT.cjs');
6
- var index = require('./index-DonNRzzv.cjs');
5
+ var index$1 = require('./index-CyQ_VJuq.cjs');
6
+ var index = require('./index-BfVtxagW.cjs');
7
7
  require('node:dns');
8
8
  require('constants');
9
9
  require('stream');
@@ -2,7 +2,7 @@
2
2
 
3
3
  var http$4 = require('node:http');
4
4
  var https = require('node:https');
5
- var index$1 = require('./index-CWkwaDmT.cjs');
5
+ var index$1 = require('./index-CyQ_VJuq.cjs');
6
6
  var require$$0$5 = require('tty');
7
7
  var require$$1$4 = require('util');
8
8
  var require$$0$b = require('assert');
@@ -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-Cl9Q2SkN.cjs'); });
62609
+ const { fileFromPath: _fileFromPath } = await Promise.resolve().then(function () { return require('./fileFromPath-DN6n6hnT.cjs'); });
62610
62610
  if (!fileFromPathWarned) {
62611
62611
  console.warn(`fileFromPath is deprecated; use fs.createReadStream(${JSON.stringify(path)}) instead`);
62612
62612
  fileFromPathWarned = true;
@@ -73861,8 +73861,15 @@ function queryStreamerDetail(args) {
73861
73861
  data: pagedCards,
73862
73862
  };
73863
73863
  }
73864
+ function queryRecordStartTimes(args) {
73865
+ const streamer = index$1.streamerService.query({ room_id: args.room_id, platform: args.platform });
73866
+ if (!streamer || args.startTime === undefined || args.endTime === undefined)
73867
+ return [];
73868
+ return index$1.recordHistoryService.getRecordStartTimes(streamer.id, args.startTime, args.endTime);
73869
+ }
73864
73870
  var streamerDetailService = {
73865
73871
  queryStreamerDetail,
73872
+ queryRecordStartTimes,
73866
73873
  };
73867
73874
 
73868
73875
  const router$b = new Router$1({
@@ -74053,6 +74060,43 @@ router$b.get("/detail", async (ctx) => {
74053
74060
  },
74054
74061
  };
74055
74062
  });
74063
+ router$b.get("/calendar", (ctx) => {
74064
+ const recorderId = getSingleQueryValue$1(ctx.request.query.recorderId);
74065
+ const startTime = Number(getSingleQueryValue$1(ctx.request.query.startTime));
74066
+ const endTime = Number(getSingleQueryValue$1(ctx.request.query.endTime));
74067
+ if (!recorderId ||
74068
+ !Number.isSafeInteger(startTime) ||
74069
+ !Number.isSafeInteger(endTime) ||
74070
+ startTime < 0 ||
74071
+ endTime <= startTime ||
74072
+ endTime - startTime > 32 * 24 * 60 * 60 * 1000) {
74073
+ ctx.status = 400;
74074
+ ctx.body = { message: "录制器和有效的月份时间范围不能为空" };
74075
+ return;
74076
+ }
74077
+ let recorder;
74078
+ try {
74079
+ recorder = recorderService.getRecorder({ id: recorderId });
74080
+ }
74081
+ catch {
74082
+ ctx.status = 404;
74083
+ ctx.body = { message: "录制器不存在" };
74084
+ return;
74085
+ }
74086
+ if (!recorder) {
74087
+ ctx.status = 404;
74088
+ ctx.body = { message: "录制器不存在" };
74089
+ return;
74090
+ }
74091
+ ctx.body = {
74092
+ payload: streamerDetailService.queryRecordStartTimes({
74093
+ room_id: recorder.channelId,
74094
+ platform: recorder.providerId,
74095
+ startTime,
74096
+ endTime,
74097
+ }),
74098
+ };
74099
+ });
74056
74100
  router$b.get("/ws/danma-test", async (ctx) => {
74057
74101
  ctx.status = 426;
74058
74102
  ctx.body = {
@@ -74069,7 +74113,7 @@ router$b.get("/ws/danma-test", async (ctx) => {
74069
74113
  };
74070
74114
  });
74071
74115
  router$b.post("/add", async (ctx) => {
74072
- const args = index$1.pick((ctx.request.body ?? {}), "providerId", "channelId", "remarks", "disableAutoCheck", "quality", "streamPriorities", "sourcePriorities", "extra", "noGlobalFollowFields", "line", "disableProvideCommentsWhenRecording", "saveGiftDanma", "saveSCDanma", "saveDanmaStats2DB", "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");
74116
+ const args = index$1.pick((ctx.request.body ?? {}), "providerId", "channelId", "remarks", "disableAutoCheck", "quality", "streamPriorities", "sourcePriorities", "extra", "noGlobalFollowFields", "line", "disableProvideCommentsWhenRecording", "saveGiftDanma", "saveSCDanma", "saveDanmaStats2DB", "segment", "sendToWebhook", "uid", "saveCover", "convert2Mp4", "qualityRetry", "formatName", "useM3U8Proxy", "customHost", "codecName", "titleKeywords", "segmentOnTitleChange", "liveStartNotification", "chargeLiveNotification", "liveEndNotification", "weight", "source", "videoFormat", "recorderType", "cookie", "doubleScreen", "cookieMode", "onlyAudio", "useServerTimestamp", "handleTime", "debugLevel", "api");
74073
74117
  const data = await recorderService.addRecorder(args);
74074
74118
  ctx.body = { payload: data };
74075
74119
  });
@@ -74098,7 +74142,7 @@ router$b.post("/:id/stream", async (ctx) => {
74098
74142
  });
74099
74143
  router$b.put("/:id", (ctx) => {
74100
74144
  const { id } = ctx.params;
74101
- const patch = index$1.pick(ctx.request.body, "remarks", "disableAutoCheck", "quality", "streamPriorities", "sourcePriorities", "noGlobalFollowFields", "line", "disableProvideCommentsWhenRecording", "saveGiftDanma", "saveSCDanma", "saveDanmaStats2DB", "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");
74145
+ const patch = index$1.pick(ctx.request.body, "remarks", "disableAutoCheck", "quality", "streamPriorities", "sourcePriorities", "noGlobalFollowFields", "line", "disableProvideCommentsWhenRecording", "saveGiftDanma", "saveSCDanma", "saveDanmaStats2DB", "saveCover", "segment", "sendToWebhook", "uid", "qualityRetry", "formatName", "useM3U8Proxy", "customHost", "codecName", "titleKeywords", "segmentOnTitleChange", "liveStartNotification", "chargeLiveNotification", "liveEndNotification", "weight", "source", "videoFormat", "recorderType", "cookie", "doubleScreen", "cookieMode", "onlyAudio", "useServerTimestamp", "handleTime", "debugLevel", "convert2Mp4", "api");
74102
74146
  ctx.body = { payload: recorderService.updateRecorder({ id, ...patch }) };
74103
74147
  });
74104
74148
  /**
@@ -74470,9 +74514,16 @@ router$a.post("/login", async (ctx) => {
74470
74514
  });
74471
74515
  tv.on("completed", async (res) => {
74472
74516
  loginObj[id].res = JSON.stringify(res);
74473
- loginObj[id].status = "completed";
74474
- const data = res.data;
74475
- await index$1.biliApi.addUser(data);
74517
+ try {
74518
+ const data = res.data;
74519
+ await index$1.biliApi.addUser(data);
74520
+ loginObj[id].uid = data.mid;
74521
+ loginObj[id].status = "completed";
74522
+ }
74523
+ catch (error) {
74524
+ loginObj[id].failReason = error instanceof Error ? error.message : String(error);
74525
+ loginObj[id].status = "error";
74526
+ }
74476
74527
  });
74477
74528
  const url = await tv.login();
74478
74529
  ctx.body = {
@@ -74605,7 +74656,7 @@ router$9.get("/login/poll", async (ctx) => {
74605
74656
  if (result.status === "completed") {
74606
74657
  index$1.writeDouyuUser(result.user);
74607
74658
  sessions.delete(id);
74608
- ctx.body = { status: "completed" };
74659
+ ctx.body = { status: "completed", uid: result.user.uid };
74609
74660
  return;
74610
74661
  }
74611
74662
  if (result.status === "error")