floating-live 0.14.7 → 0.14.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "floating-live",
3
- "version": "0.14.7",
3
+ "version": "0.14.9",
4
4
  "type": "commonjs",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -14,7 +14,7 @@ const bilibili = () => {
14
14
  ctx.auth.options.register("bilibili", authConfig);
15
15
  ctx.command.register("auth.bilibili", async (auth) => {
16
16
  const uid = await (0, utils_1.getLoginUid)(auth);
17
- ctx.auth.account["bilibili"] = uid;
17
+ ctx.auth.status["bilibili"] = uid;
18
18
  ctx.auth.set("bilibili", auth);
19
19
  ctx.emit("auth:update", "bilibili", uid);
20
20
  });
@@ -25,7 +25,7 @@ const bilibili = () => {
25
25
  const [code, auth] = await (0, utils_1.checkLoginQRcode)(key);
26
26
  if (auth) {
27
27
  const { SESSDATA, DedeUserID } = (0, utils_1.parseCookieString)(auth);
28
- ctx.auth.account["bilibili"] = DedeUserID;
28
+ ctx.auth.status["bilibili"] = DedeUserID;
29
29
  ctx.auth.set("bilibili", `SESSDATA=${SESSDATA}`);
30
30
  ctx.emit("auth:update", "bilibili", DedeUserID);
31
31
  }
@@ -33,6 +33,8 @@ export declare abstract class LiveRoom extends EventEmitter implements RoomInfo
33
33
  abstract close(): void;
34
34
  /** 从服务器获取信息 */
35
35
  abstract getInfo(): Promise<void>;
36
+ /** 设置用户凭据 */
37
+ setAuth?(auth: string): void;
36
38
  /** 销毁事件 */
37
39
  protected onDestory?(): void;
38
40
  /** 销毁 */
@@ -3,7 +3,7 @@ import { FloatingLive } from "..";
3
3
  import { AuthOptions } from "../types/auth";
4
4
  export declare class ModAuth {
5
5
  options: Reglist<AuthOptions>;
6
- account: Record<string, string | number>;
6
+ status: Record<string, string | number>;
7
7
  main: FloatingLive;
8
8
  constructor(main: FloatingLive);
9
9
  set(name: string, auth: string): void;
@@ -4,7 +4,7 @@ exports.ModAuth = void 0;
4
4
  const Reglist_1 = require("../abstract/Reglist");
5
5
  class ModAuth {
6
6
  constructor(main) {
7
- this.account = {};
7
+ this.status = {};
8
8
  this.options = new Reglist_1.Reglist(main, "auth.options");
9
9
  this.main = main;
10
10
  this.main.state.register("auth", () => {
@@ -14,6 +14,7 @@ class ModAuth {
14
14
  });
15
15
  return {
16
16
  options: options,
17
+ status: this.status,
17
18
  };
18
19
  });
19
20
  this.main.command.batchRegister({
@@ -38,6 +38,11 @@ class ModRoom {
38
38
  /** 设置登录凭据 */
39
39
  setAuth(platform, auth) {
40
40
  this.auths.set(platform, auth);
41
+ this.roomMap.forEach((room) => {
42
+ if (room.platform == platform) {
43
+ room.setAuth?.(auth);
44
+ }
45
+ });
41
46
  }
42
47
  /** 设置房间配置 */
43
48
  setConfig(platform, config) {