@floating-live/bilibili 0.15.1 → 0.15.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.
package/index.d.ts CHANGED
@@ -1,29 +1,5 @@
1
- import type { FloatingLive } from "floating-live";
2
- interface BilibiliLoginInfo {
3
- credentials: string;
4
- tokens: {
5
- /** 用户uid */
6
- userId: number;
7
- /** buvid */
8
- buvid: string;
9
- };
10
- userId: number;
11
- }
12
- declare module "floating-live" {
13
- interface FloatingCommandMap {
14
- "bilibili.credentials.check": (credentials: string) => Promise<BilibiliLoginInfo>;
15
- "bilibili.login.qrcode.get": () => Promise<{
16
- key: string;
17
- url: string;
18
- }>;
19
- "bilibili.login.qrcode.poll": (key: string) => Promise<{
20
- status: number;
21
- credentials?: string;
22
- }>;
23
- }
24
- }
25
- declare class Bilibili {
26
- static pluginName: string;
27
- constructor(main: FloatingLive);
28
- }
29
- export default Bilibili;
1
+ export * from "./plugin";
2
+ export * from "./room";
3
+ export * from "./parser";
4
+ export * from "./types";
5
+ export * from "./utils";
package/index.js CHANGED
@@ -1,65 +1,21 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const room_1 = require("./room");
4
- const utils_1 = require("./utils");
5
- const parser_1 = require("./parser");
6
- const platformInfo = {
7
- name: "bilibili",
8
- membership: {
9
- id: "guard",
10
- name: "大航海",
11
- level: ["", "总督", "提督", "舰长"],
12
- },
13
- gift: {
14
- action: "投喂",
15
- },
16
- currency: {
17
- silver: {
18
- name: "银瓜子",
19
- ratio: 1,
20
- },
21
- gold: {
22
- name: "电池",
23
- ratio: 100,
24
- money: 1000,
25
- },
26
- },
27
- stats: {
28
- view: "看过",
29
- online: "在线",
30
- like: "点赞",
31
- },
32
- };
33
- class Bilibili {
34
- constructor(main) {
35
- main.command.register("bilibili.room.create", (id, options) => {
36
- return new room_1.RoomBilibili(Number(id), options);
37
- });
38
- main.command.register("bilibili.room.info", async (id) => {
39
- const rawInfo = await (0, utils_1.getInfoByRoom)(parseInt("" + id));
40
- return (0, parser_1.parseInfo)(rawInfo);
41
- });
42
- main.command.register("bilibili.credentials.check", async (credentials) => {
43
- const buvid = (await (0, utils_1.getBuvid)(credentials)) || "";
44
- const userId = await (0, utils_1.getLoginUid)(credentials);
45
- return {
46
- credentials,
47
- tokens: {
48
- userId,
49
- buvid,
50
- },
51
- userId,
52
- };
53
- });
54
- main.manifest.register("platform", "bilibili", platformInfo);
55
- main.command.register("bilibili.login.qrcode.get", () => {
56
- return (0, utils_1.generateLoginQRcode)();
57
- });
58
- main.command.register("bilibili.login.qrcode.poll", async (key) => {
59
- const [status, credentials] = await (0, utils_1.checkLoginQRcode)(key);
60
- return { status, credentials };
61
- });
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
62
7
  }
63
- }
64
- Bilibili.pluginName = "bilibili";
65
- exports.default = Bilibili;
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./plugin"), exports);
18
+ __exportStar(require("./room"), exports);
19
+ __exportStar(require("./parser"), exports);
20
+ __exportStar(require("./types"), exports);
21
+ __exportStar(require("./utils"), exports);
package/index.ts CHANGED
@@ -1,103 +1,5 @@
1
- import type { FloatingLive, PlatformInfo } from "floating-live";
2
- import { RoomBilibili, RoomOptions } from "./room";
3
- import {
4
- checkLoginQRcode,
5
- generateLoginQRcode,
6
- getBuvid,
7
- getInfoByRoom,
8
- getLoginUid,
9
- } from "./utils";
10
- import { parseInfo } from "./parser";
11
-
12
- interface BilibiliLoginInfo {
13
- credentials: string;
14
- tokens: {
15
- /** 用户uid */
16
- userId: number;
17
- /** buvid */
18
- buvid: string;
19
- };
20
- userId: number;
21
- }
22
-
23
- declare module "floating-live" {
24
- interface FloatingCommandMap {
25
- "bilibili.credentials.check": (
26
- credentials: string
27
- ) => Promise<BilibiliLoginInfo>;
28
- "bilibili.login.qrcode.get": () => Promise<{ key: string; url: string }>;
29
- "bilibili.login.qrcode.poll": (
30
- key: string
31
- ) => Promise<{ status: number; credentials?: string }>;
32
- }
33
- }
34
-
35
- const platformInfo: PlatformInfo = {
36
- name: "bilibili",
37
- membership: {
38
- id: "guard",
39
- name: "大航海",
40
- level: ["", "总督", "提督", "舰长"],
41
- },
42
- gift: {
43
- action: "投喂",
44
- },
45
- currency: {
46
- silver: {
47
- name: "银瓜子",
48
- ratio: 1,
49
- },
50
- gold: {
51
- name: "电池",
52
- ratio: 100,
53
- money: 1000,
54
- },
55
- },
56
- stats: {
57
- view: "看过",
58
- online: "在线",
59
- like: "点赞",
60
- },
61
- };
62
-
63
- class Bilibili {
64
- static pluginName = "bilibili";
65
- constructor(main: FloatingLive) {
66
- main.command.register(
67
- "bilibili.room.create",
68
- (id: string | number, options?: RoomOptions) => {
69
- return new RoomBilibili(Number(id), options);
70
- }
71
- );
72
- main.command.register("bilibili.room.info", async (id: string | number) => {
73
- const rawInfo = await getInfoByRoom(parseInt("" + id));
74
- return parseInfo(rawInfo);
75
- });
76
-
77
- main.command.register("bilibili.credentials.check", async (credentials) => {
78
- const buvid = (await getBuvid(credentials)) || "";
79
- const userId = await getLoginUid(credentials);
80
- return {
81
- credentials,
82
- tokens: {
83
- userId,
84
- buvid,
85
- },
86
- userId,
87
- };
88
- });
89
-
90
- main.manifest.register("platform", "bilibili", platformInfo);
91
-
92
- main.command.register("bilibili.login.qrcode.get", () => {
93
- return generateLoginQRcode();
94
- });
95
-
96
- main.command.register("bilibili.login.qrcode.poll", async (key) => {
97
- const [status, credentials] = await checkLoginQRcode(key);
98
- return { status, credentials };
99
- });
100
- }
101
- }
102
-
103
- export default Bilibili;
1
+ export * from "./plugin";
2
+ export * from "./room";
3
+ export * from "./parser";
4
+ export * from "./types";
5
+ export * from "./utils";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@floating-live/bilibili",
3
- "version": "0.15.1",
3
+ "version": "0.15.2",
4
4
  "type": "commonjs",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -24,6 +24,6 @@
24
24
  "typescript": "^4.8.4"
25
25
  },
26
26
  "peerDependencies": {
27
- "floating-live": "^0.15.5"
27
+ "floating-live": "^0.15.6"
28
28
  }
29
29
  }
package/plugin.d.ts ADDED
@@ -0,0 +1,29 @@
1
+ import type { FloatingLive } from "floating-live";
2
+ interface BilibiliLoginInfo {
3
+ credentials: string;
4
+ tokens: {
5
+ /** 用户uid */
6
+ userId: number;
7
+ /** buvid */
8
+ buvid: string;
9
+ };
10
+ userId: number;
11
+ }
12
+ declare module "floating-live" {
13
+ interface FloatingCommandMap {
14
+ "bilibili.credentials.check": (credentials: string) => Promise<BilibiliLoginInfo>;
15
+ "bilibili.login.qrcode.get": () => Promise<{
16
+ key: string;
17
+ url: string;
18
+ }>;
19
+ "bilibili.login.qrcode.poll": (key: string) => Promise<{
20
+ status: number;
21
+ credentials?: string;
22
+ }>;
23
+ }
24
+ }
25
+ export declare class PluginBilibili {
26
+ static pluginName: string;
27
+ constructor(main: FloatingLive);
28
+ }
29
+ export default PluginBilibili;
package/plugin.js ADDED
@@ -0,0 +1,67 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PluginBilibili = void 0;
4
+ const room_1 = require("./room");
5
+ const utils_1 = require("./utils");
6
+ const parser_1 = require("./parser");
7
+ const platformInfo = {
8
+ name: "bilibili",
9
+ membership: {
10
+ id: "guard",
11
+ name: "大航海",
12
+ level: ["", "总督", "提督", "舰长"],
13
+ },
14
+ gift: {
15
+ action: "投喂",
16
+ },
17
+ currency: {
18
+ silver: {
19
+ name: "银瓜子",
20
+ ratio: 1,
21
+ },
22
+ gold: {
23
+ name: "电池",
24
+ ratio: 100,
25
+ money: 1000,
26
+ },
27
+ },
28
+ stats: {
29
+ view: "看过",
30
+ online: "在线",
31
+ like: "点赞",
32
+ },
33
+ };
34
+ class PluginBilibili {
35
+ constructor(main) {
36
+ main.command.register("bilibili.room.create", (id, options) => {
37
+ return new room_1.RoomBilibili(Number(id), options);
38
+ });
39
+ main.command.register("bilibili.room.info", async (id) => {
40
+ const rawInfo = await (0, utils_1.getInfoByRoom)(parseInt("" + id));
41
+ return (0, parser_1.parseInfo)(rawInfo);
42
+ });
43
+ main.command.register("bilibili.credentials.check", async (credentials) => {
44
+ const buvid = (await (0, utils_1.getBuvid)(credentials)) || "";
45
+ const userId = await (0, utils_1.getLoginUid)(credentials);
46
+ return {
47
+ credentials,
48
+ tokens: {
49
+ userId,
50
+ buvid,
51
+ },
52
+ userId,
53
+ };
54
+ });
55
+ main.manifest.register("platform", "bilibili", platformInfo);
56
+ main.command.register("bilibili.login.qrcode.get", () => {
57
+ return (0, utils_1.generateLoginQRcode)();
58
+ });
59
+ main.command.register("bilibili.login.qrcode.poll", async (key) => {
60
+ const [status, credentials] = await (0, utils_1.checkLoginQRcode)(key);
61
+ return { status, credentials };
62
+ });
63
+ }
64
+ }
65
+ exports.PluginBilibili = PluginBilibili;
66
+ PluginBilibili.pluginName = "bilibili";
67
+ exports.default = PluginBilibili;
package/plugin.ts ADDED
@@ -0,0 +1,103 @@
1
+ import type { FloatingLive, PlatformInfo } from "floating-live";
2
+ import { RoomBilibili, RoomOptions } from "./room";
3
+ import {
4
+ checkLoginQRcode,
5
+ generateLoginQRcode,
6
+ getBuvid,
7
+ getInfoByRoom,
8
+ getLoginUid,
9
+ } from "./utils";
10
+ import { parseInfo } from "./parser";
11
+
12
+ interface BilibiliLoginInfo {
13
+ credentials: string;
14
+ tokens: {
15
+ /** 用户uid */
16
+ userId: number;
17
+ /** buvid */
18
+ buvid: string;
19
+ };
20
+ userId: number;
21
+ }
22
+
23
+ declare module "floating-live" {
24
+ interface FloatingCommandMap {
25
+ "bilibili.credentials.check": (
26
+ credentials: string
27
+ ) => Promise<BilibiliLoginInfo>;
28
+ "bilibili.login.qrcode.get": () => Promise<{ key: string; url: string }>;
29
+ "bilibili.login.qrcode.poll": (
30
+ key: string
31
+ ) => Promise<{ status: number; credentials?: string }>;
32
+ }
33
+ }
34
+
35
+ const platformInfo: PlatformInfo = {
36
+ name: "bilibili",
37
+ membership: {
38
+ id: "guard",
39
+ name: "大航海",
40
+ level: ["", "总督", "提督", "舰长"],
41
+ },
42
+ gift: {
43
+ action: "投喂",
44
+ },
45
+ currency: {
46
+ silver: {
47
+ name: "银瓜子",
48
+ ratio: 1,
49
+ },
50
+ gold: {
51
+ name: "电池",
52
+ ratio: 100,
53
+ money: 1000,
54
+ },
55
+ },
56
+ stats: {
57
+ view: "看过",
58
+ online: "在线",
59
+ like: "点赞",
60
+ },
61
+ };
62
+
63
+ export class PluginBilibili {
64
+ static pluginName = "bilibili";
65
+ constructor(main: FloatingLive) {
66
+ main.command.register(
67
+ "bilibili.room.create",
68
+ (id: string | number, options?: RoomOptions) => {
69
+ return new RoomBilibili(Number(id), options);
70
+ }
71
+ );
72
+ main.command.register("bilibili.room.info", async (id: string | number) => {
73
+ const rawInfo = await getInfoByRoom(parseInt("" + id));
74
+ return parseInfo(rawInfo);
75
+ });
76
+
77
+ main.command.register("bilibili.credentials.check", async (credentials) => {
78
+ const buvid = (await getBuvid(credentials)) || "";
79
+ const userId = await getLoginUid(credentials);
80
+ return {
81
+ credentials,
82
+ tokens: {
83
+ userId,
84
+ buvid,
85
+ },
86
+ userId,
87
+ };
88
+ });
89
+
90
+ main.manifest.register("platform", "bilibili", platformInfo);
91
+
92
+ main.command.register("bilibili.login.qrcode.get", () => {
93
+ return generateLoginQRcode();
94
+ });
95
+
96
+ main.command.register("bilibili.login.qrcode.poll", async (key) => {
97
+ const [status, credentials] = await checkLoginQRcode(key);
98
+ return { status, credentials };
99
+ });
100
+ }
101
+ }
102
+
103
+ export default PluginBilibili;