koishi-plugin-bilibili-notify 3.2.5-alpha.0 → 3.2.5-alpha.1

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.
Files changed (62) hide show
  1. package/lib/biliAPI-BB6Ih4EM.mjs +659 -0
  2. package/lib/biliAPI-GF2e2-2V.js +664 -0
  3. package/lib/biliAPI.d.mts +82 -0
  4. package/lib/biliAPI.d.ts +75 -72
  5. package/lib/biliAPI.js +5 -811
  6. package/lib/biliAPI.mjs +4 -0
  7. package/lib/blive-BBVUYbxX.js +43 -0
  8. package/lib/blive-CyC_0-9A.mjs +37 -0
  9. package/lib/blive.d.mts +19 -0
  10. package/lib/blive.d.ts +15 -12
  11. package/lib/blive.js +4 -59
  12. package/lib/blive.mjs +3 -0
  13. package/lib/chunk-CrFLpmCJ.js +67 -0
  14. package/lib/chunk-DBmNgn_A.mjs +40 -0
  15. package/lib/comRegister-CcqOpkwB.mjs +1421 -0
  16. package/lib/comRegister-t7UnYFig.js +1426 -0
  17. package/lib/comRegister.d.mts +109 -0
  18. package/lib/comRegister.d.ts +103 -100
  19. package/lib/comRegister.js +6 -1896
  20. package/lib/comRegister.mjs +5 -0
  21. package/lib/database-4f9U--Ji.mjs +20 -0
  22. package/lib/database-Ct2yIdxk.js +37 -0
  23. package/lib/database-Do3O9MDA.d.mts +18 -0
  24. package/lib/database-KWDs372o.d.ts +18 -0
  25. package/lib/database.d.mts +2 -0
  26. package/lib/database.d.ts +2 -14
  27. package/lib/database.js +5 -14
  28. package/lib/database.mjs +3 -0
  29. package/lib/font/HYZhengYuan-75W.js +5 -0
  30. package/lib/font/HYZhengYuan-75W.mjs +5 -0
  31. package/lib/generateImg-E9JeFpQX.js +92628 -0
  32. package/lib/generateImg-zwzMYjw6.mjs +92623 -0
  33. package/lib/generateImg.d.mts +65 -0
  34. package/lib/generateImg.d.ts +59 -46
  35. package/lib/generateImg.js +4 -1504
  36. package/lib/generateImg.mjs +4 -0
  37. package/lib/img/arrow.js +5 -0
  38. package/lib/img/arrow.mjs +5 -0
  39. package/lib/index-DeGUe4jM.d.mts +265 -0
  40. package/lib/index-MJKYbMf7.d.ts +265 -0
  41. package/lib/index.d.mts +73 -0
  42. package/lib/index.d.ts +65 -62
  43. package/lib/index.js +296 -394
  44. package/lib/index.mjs +300 -0
  45. package/lib/page/0.mjs +0 -0
  46. package/lib/type/index.d.mts +2 -0
  47. package/lib/type/index.d.ts +2 -262
  48. package/lib/type/index.js +5 -18
  49. package/lib/type/index.mjs +3 -0
  50. package/lib/type-C5ZxPrgY.mjs +19 -0
  51. package/lib/type-WjCy4YMc.js +31 -0
  52. package/lib/utils/index.d.mts +15 -0
  53. package/lib/utils/index.d.ts +8 -6
  54. package/lib/utils/index.js +6 -102
  55. package/lib/utils/index.mjs +3 -0
  56. package/lib/utils-BoaYrSvG.js +79 -0
  57. package/lib/utils-C95cnBJG.mjs +61 -0
  58. package/package.json +7 -4
  59. package/readme.md +10 -1
  60. package/lib/img/arrow.png +0 -0
  61. /package/lib/{font/HYZhengYuan-75W.ttf → assets/HYZhengYuan-75W-CAgMN3FH.ttf} +0 -0
  62. /package/lib/page/{0.html → 0.js} +0 -0
@@ -1,13 +1,15 @@
1
+ //#region src/utils/index.d.ts
1
2
  interface RetryOptions {
2
- attempts: number;
3
- onFailure?: (error: Error, attempts: number) => Promise<void> | void;
3
+ attempts: number;
4
+ onFailure?: (error: Error, attempts: number) => Promise<void> | void;
4
5
  }
5
- export declare function Retry(options?: RetryOptions): MethodDecorator;
6
+ declare function Retry(options?: RetryOptions): MethodDecorator;
6
7
  /**
7
8
  * 高阶函数:为函数添加锁机制
8
9
  * @param {Function} fn - 需要包装的原始函数
9
10
  * @returns {Function} 带锁功能的函数
10
11
  */
11
- export declare function withLock(fn: any): (...args: any[]) => void;
12
- export declare function withRetry<T>(fn: (...args: unknown[]) => T | Promise<T>, maxAttempts?: number, delayMs?: number): Promise<T>;
13
- export {};
12
+ declare function withLock(fn: any): (...args: any[]) => void;
13
+ declare function withRetry<T>(fn: (...args: unknown[]) => T | Promise<T>, maxAttempts?: number, delayMs?: number): Promise<T>;
14
+ //#endregion
15
+ export { Retry, withLock, withRetry };
@@ -1,102 +1,6 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Retry = Retry;
4
- exports.withLock = withLock;
5
- exports.withRetry = withRetry;
6
- function Retry(options = { attempts: 3 }) {
7
- return (
8
- // biome-ignore lint/complexity/noBannedTypes: <explanation>
9
- target, propertyKey,
10
- // biome-ignore lint/suspicious/noExplicitAny: <explanation>
11
- descriptor) => {
12
- const originalMethod = descriptor.value;
13
- // biome-ignore lint/suspicious/noExplicitAny: <explanation>
14
- descriptor.value = async function (...args) {
15
- let lastError;
16
- for (let i = 0; i < options.attempts; i++) {
17
- try {
18
- return await originalMethod.apply(this, args);
19
- }
20
- catch (error) {
21
- lastError = error;
22
- if (options.onFailure) {
23
- await options.onFailure.call(this, lastError, i + 1);
24
- }
25
- }
26
- }
27
- // biome-ignore lint/style/noNonNullAssertion: <explanation>
28
- throw lastError;
29
- };
30
- return descriptor;
31
- };
32
- }
33
- /**
34
- * 高阶函数:为函数添加锁机制
35
- * @param {Function} fn - 需要包装的原始函数
36
- * @returns {Function} 带锁功能的函数
37
- */
38
- function withLock(fn) {
39
- // 判断是否是异步函数
40
- const isAsync = fn.constructor.name === "AsyncFunction";
41
- // 定义锁标志
42
- let locked = false;
43
- // 判断是否为异步函数
44
- if (isAsync) {
45
- // 变为Promise
46
- return (...args) => {
47
- // 已加锁则跳过执行
48
- if (locked)
49
- return;
50
- // 获取锁
51
- locked = true;
52
- // 将异步函数转为Promise链
53
- Promise.resolve(fn(...args))
54
- .catch((err) => {
55
- // 打印错误
56
- console.error("Execution error:", err);
57
- // 重新抛出错误
58
- throw err;
59
- })
60
- .finally(() => {
61
- // 确保释放锁
62
- locked = false;
63
- });
64
- };
65
- }
66
- // 不是异步函数
67
- return (...args) => {
68
- // 已加锁则跳过执行
69
- if (locked)
70
- return;
71
- // 获取锁
72
- locked = true;
73
- try {
74
- // 执行函数
75
- fn(...args);
76
- }
77
- catch (err) {
78
- // 打印错误
79
- console.error("Execution error:", err);
80
- // 重新抛出错误
81
- throw err;
82
- }
83
- finally {
84
- // 无论成功失败都释放锁
85
- locked = false;
86
- }
87
- };
88
- }
89
- async function withRetry(fn, maxAttempts = 3, delayMs = 1000) {
90
- let attempt = 0;
91
- while (attempt < maxAttempts) {
92
- try {
93
- return await fn();
94
- }
95
- catch (error) {
96
- attempt++;
97
- if (attempt >= maxAttempts)
98
- throw error;
99
- await new Promise((resolve) => setTimeout(resolve, delayMs * attempt)); // 指数退避
100
- }
101
- }
102
- }
1
+ const require_chunk = require('../chunk-CrFLpmCJ.js');
2
+ const require_utils = require('../utils-BoaYrSvG.js');
3
+
4
+ exports.Retry = require_utils.Retry;
5
+ exports.withLock = require_utils.withLock;
6
+ exports.withRetry = require_utils.withRetry;
@@ -0,0 +1,3 @@
1
+ import { Retry, withLock, withRetry } from "../utils-C95cnBJG.mjs";
2
+
3
+ export { Retry, withLock, withRetry };
@@ -0,0 +1,79 @@
1
+
2
+ //#region src/utils/index.ts
3
+ function Retry(options = { attempts: 3 }) {
4
+ return (target, propertyKey, descriptor) => {
5
+ const originalMethod = descriptor.value;
6
+ descriptor.value = async function(...args) {
7
+ let lastError;
8
+ for (let i = 0; i < options.attempts; i++) try {
9
+ return await originalMethod.apply(this, args);
10
+ } catch (error) {
11
+ lastError = error;
12
+ if (options.onFailure) await options.onFailure.call(this, lastError, i + 1);
13
+ }
14
+ throw lastError;
15
+ };
16
+ return descriptor;
17
+ };
18
+ }
19
+ /**
20
+ * 高阶函数:为函数添加锁机制
21
+ * @param {Function} fn - 需要包装的原始函数
22
+ * @returns {Function} 带锁功能的函数
23
+ */
24
+ function withLock(fn) {
25
+ const isAsync = fn.constructor.name === "AsyncFunction";
26
+ let locked = false;
27
+ if (isAsync) return (...args) => {
28
+ if (locked) return;
29
+ locked = true;
30
+ Promise.resolve(fn(...args)).catch((err) => {
31
+ console.error("Execution error:", err);
32
+ throw err;
33
+ }).finally(() => {
34
+ locked = false;
35
+ });
36
+ };
37
+ return (...args) => {
38
+ if (locked) return;
39
+ locked = true;
40
+ try {
41
+ fn(...args);
42
+ } catch (err) {
43
+ console.error("Execution error:", err);
44
+ throw err;
45
+ } finally {
46
+ locked = false;
47
+ }
48
+ };
49
+ }
50
+ async function withRetry(fn, maxAttempts = 3, delayMs = 1e3) {
51
+ let attempt = 0;
52
+ while (attempt < maxAttempts) try {
53
+ return await fn();
54
+ } catch (error) {
55
+ attempt++;
56
+ if (attempt >= maxAttempts) throw error;
57
+ await new Promise((resolve) => setTimeout(resolve, delayMs * attempt));
58
+ }
59
+ }
60
+
61
+ //#endregion
62
+ Object.defineProperty(exports, 'Retry', {
63
+ enumerable: true,
64
+ get: function () {
65
+ return Retry;
66
+ }
67
+ });
68
+ Object.defineProperty(exports, 'withLock', {
69
+ enumerable: true,
70
+ get: function () {
71
+ return withLock;
72
+ }
73
+ });
74
+ Object.defineProperty(exports, 'withRetry', {
75
+ enumerable: true,
76
+ get: function () {
77
+ return withRetry;
78
+ }
79
+ });
@@ -0,0 +1,61 @@
1
+ //#region src/utils/index.ts
2
+ function Retry(options = { attempts: 3 }) {
3
+ return (target, propertyKey, descriptor) => {
4
+ const originalMethod = descriptor.value;
5
+ descriptor.value = async function(...args) {
6
+ let lastError;
7
+ for (let i = 0; i < options.attempts; i++) try {
8
+ return await originalMethod.apply(this, args);
9
+ } catch (error) {
10
+ lastError = error;
11
+ if (options.onFailure) await options.onFailure.call(this, lastError, i + 1);
12
+ }
13
+ throw lastError;
14
+ };
15
+ return descriptor;
16
+ };
17
+ }
18
+ /**
19
+ * 高阶函数:为函数添加锁机制
20
+ * @param {Function} fn - 需要包装的原始函数
21
+ * @returns {Function} 带锁功能的函数
22
+ */
23
+ function withLock(fn) {
24
+ const isAsync = fn.constructor.name === "AsyncFunction";
25
+ let locked = false;
26
+ if (isAsync) return (...args) => {
27
+ if (locked) return;
28
+ locked = true;
29
+ Promise.resolve(fn(...args)).catch((err) => {
30
+ console.error("Execution error:", err);
31
+ throw err;
32
+ }).finally(() => {
33
+ locked = false;
34
+ });
35
+ };
36
+ return (...args) => {
37
+ if (locked) return;
38
+ locked = true;
39
+ try {
40
+ fn(...args);
41
+ } catch (err) {
42
+ console.error("Execution error:", err);
43
+ throw err;
44
+ } finally {
45
+ locked = false;
46
+ }
47
+ };
48
+ }
49
+ async function withRetry(fn, maxAttempts = 3, delayMs = 1e3) {
50
+ let attempt = 0;
51
+ while (attempt < maxAttempts) try {
52
+ return await fn();
53
+ } catch (error) {
54
+ attempt++;
55
+ if (attempt >= maxAttempts) throw error;
56
+ await new Promise((resolve) => setTimeout(resolve, delayMs * attempt));
57
+ }
58
+ }
59
+
60
+ //#endregion
61
+ export { Retry, withLock, withRetry };
package/package.json CHANGED
@@ -1,18 +1,19 @@
1
1
  {
2
2
  "name": "koishi-plugin-bilibili-notify",
3
3
  "description": "Koishi bilibili notify plugin",
4
- "version": "3.2.5-alpha.0",
4
+ "version": "3.2.5-alpha.1",
5
5
  "contributors": [
6
6
  "Akokko <admin@akokko.com>"
7
7
  ],
8
8
  "main": "lib/index.js",
9
9
  "typings": "lib/index.d.ts",
10
10
  "scripts": {
11
- "build": "yakumo build",
11
+ "yakumo build": "yakumo build",
12
12
  "clean": "yakumo clean",
13
13
  "bump": "yakumo version",
14
14
  "dep": "yakumo upgrade",
15
- "pub": "yakumo publish"
15
+ "pub": "yakumo publish",
16
+ "build": "tsdown"
16
17
  },
17
18
  "files": [
18
19
  "lib",
@@ -35,6 +36,7 @@
35
36
  },
36
37
  "dependencies": {
37
38
  "@akokko/blive-message-listener": "^0.5.1",
39
+ "@satorijs/element": "^3.1.8",
38
40
  "axios": "^1.9.0",
39
41
  "axios-cookiejar-support": "^5.0.5",
40
42
  "cacheable-lookup": "^7.0.0",
@@ -63,8 +65,9 @@
63
65
  "globals": "^15.15.0",
64
66
  "koishi": "^4.18.8",
65
67
  "koishi-plugin-puppeteer": "^3.9.0",
68
+ "tsdown": "^0.12.6",
66
69
  "tsx": "^4.19.4",
67
- "typescript": "^5.9.0-dev.20250603",
70
+ "typescript": "5.8.3",
68
71
  "yakumo": "^1.0.0",
69
72
  "yakumo-esbuild": "^1.0.0",
70
73
  "yakumo-tsc": "^1.0.0",
package/readme.md CHANGED
@@ -5,6 +5,7 @@
5
5
  ---
6
6
 
7
7
  - koishi-plugin-bilibili-notify [![npm](https://img.shields.io/npm/v/koishi-plugin-bilibili-notify?style=flat-square)](https://www.npmjs.com/package/koishi-plugin-bilibili-notify)
8
+ - [重要通知](#重要通知)
8
9
  - [重新订阅](#重新订阅)
9
10
  - [功能](#功能)
10
11
  - [注意事项](#注意事项)
@@ -15,6 +16,10 @@
15
16
  - [感谢](#感谢)
16
17
  - [License](#License)
17
18
 
19
+ ## 重要通知
20
+ > [!important]
21
+ > `3.2.5-alpha.x` 目前均为测试版本,请不要更新🙅
22
+
18
23
  ## 重新订阅
19
24
  > [!important]
20
25
  >由于版本 `2.0.0-alpha.7` 重构了订阅功能,从 `2.0.0-alpha.7` 以前版本升级到以后版本的需重新订阅
@@ -270,7 +275,11 @@ uid为必填参数,为要推送的UP主的UID,index为可选参数,为要
270
275
  - ver 3.2.3 优化:移除不必要的代码;
271
276
  - ver 3.2.4-alpha.0 优化:选项 `pushImgsInDynamic` 发送多图会以转发消息的格式发送; 新增:选项 `dynamicVideoUrlToBV` 开启后将链接转换为bv号以用作特殊用途;
272
277
  - ver 3.2.4 修复:第一次使用插件时,使用登录指令报错; 插件配置页新增和删除提示信息;
273
- - ver 3.2.5 优化:新增 `DNS` 缓存,以减少DNS错误;
278
+
279
+ > [!important]
280
+ > `3.2.5-alpha.x` 目前均为测试版本,请不要更新🙅
281
+ > - ver 3.2.5-alpha.0 优化:新增 `DNS` 缓存,以减少DNS错误;
282
+ > - ver 3.2.5-alpha.1 测试版本
274
283
 
275
284
  ## 交流群
276
285
 
package/lib/img/arrow.png DELETED
Binary file
File without changes