koishi-plugin-bilibili-notify 3.2.5-alpha.2 → 3.2.5-alpha.3

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.
@@ -7,7 +7,6 @@ import http from "node:http";
7
7
  import https from "node:https";
8
8
  import axios from "axios";
9
9
  import { Cookie, CookieJar } from "tough-cookie";
10
- import { wrapper } from "axios-cookiejar-support";
11
10
  import { JSDOM } from "jsdom";
12
11
 
13
12
  //#region node_modules/@oxc-project/runtime/src/helpers/decorate.js
@@ -134,7 +133,7 @@ var BiliAPI = class extends Service {
134
133
  this.cacheable = new CacheableLookup();
135
134
  this.cacheable.install(http.globalAgent);
136
135
  this.cacheable.install(https.globalAgent);
137
- this.createNewClient();
136
+ await this.createNewClient();
138
137
  this.loadCookiesFromDatabase();
139
138
  }
140
139
  stop() {
@@ -311,7 +310,8 @@ var BiliAPI = class extends Service {
311
310
  const index = Math.floor(Math.random() * userAgents.length);
312
311
  return userAgents[index];
313
312
  }
314
- createNewClient() {
313
+ async createNewClient() {
314
+ const wrapper = (await import("axios-cookiejar-support")).wrapper;
315
315
  this.jar = new CookieJar();
316
316
  this.client = wrapper(axios.create({
317
317
  jar: this.jar,
@@ -437,12 +437,12 @@ var BiliAPI = class extends Service {
437
437
  }, 36e5);
438
438
  }
439
439
  async checkIfTokenNeedRefresh(refreshToken, csrf, times = 3) {
440
- const notifyAndError = (info) => {
440
+ const notifyAndError = async (info) => {
441
441
  this.loginNotifier = this.ctx.notifier.create({
442
442
  type: "warning",
443
443
  content: info
444
444
  });
445
- this.createNewClient();
445
+ await this.createNewClient();
446
446
  this.refreshCookieTimer();
447
447
  throw new Error(info);
448
448
  };
@@ -480,7 +480,7 @@ var BiliAPI = class extends Service {
480
480
  refresh_token: refreshToken
481
481
  }, { headers: { "Content-Type": "application/x-www-form-urlencoded" } });
482
482
  switch (refreshData.code) {
483
- case -101: return this.createNewClient();
483
+ case -101: return await this.createNewClient();
484
484
  case -111: {
485
485
  await this.ctx.database.remove("loginBili", [1]);
486
486
  notifyAndError("csrf 校验错误,请重新登录");
@@ -7,7 +7,6 @@ const node_http = require_chunk.__toESM(require("node:http"));
7
7
  const node_https = require_chunk.__toESM(require("node:https"));
8
8
  const axios = require_chunk.__toESM(require("axios"));
9
9
  const tough_cookie = require_chunk.__toESM(require("tough-cookie"));
10
- const axios_cookiejar_support = require_chunk.__toESM(require("axios-cookiejar-support"));
11
10
  const jsdom = require_chunk.__toESM(require("jsdom"));
12
11
 
13
12
  //#region node_modules/@oxc-project/runtime/src/helpers/decorate.js
@@ -134,7 +133,7 @@ var BiliAPI = class extends koishi.Service {
134
133
  this.cacheable = new CacheableLookup();
135
134
  this.cacheable.install(node_http.default.globalAgent);
136
135
  this.cacheable.install(node_https.default.globalAgent);
137
- this.createNewClient();
136
+ await this.createNewClient();
138
137
  this.loadCookiesFromDatabase();
139
138
  }
140
139
  stop() {
@@ -311,9 +310,10 @@ var BiliAPI = class extends koishi.Service {
311
310
  const index = Math.floor(Math.random() * userAgents.length);
312
311
  return userAgents[index];
313
312
  }
314
- createNewClient() {
313
+ async createNewClient() {
314
+ const wrapper = (await import("axios-cookiejar-support")).wrapper;
315
315
  this.jar = new tough_cookie.CookieJar();
316
- this.client = (0, axios_cookiejar_support.wrapper)(axios.default.create({
316
+ this.client = wrapper(axios.default.create({
317
317
  jar: this.jar,
318
318
  headers: {
319
319
  "Content-Type": "application/json",
@@ -437,12 +437,12 @@ var BiliAPI = class extends koishi.Service {
437
437
  }, 36e5);
438
438
  }
439
439
  async checkIfTokenNeedRefresh(refreshToken, csrf, times = 3) {
440
- const notifyAndError = (info) => {
440
+ const notifyAndError = async (info) => {
441
441
  this.loginNotifier = this.ctx.notifier.create({
442
442
  type: "warning",
443
443
  content: info
444
444
  });
445
- this.createNewClient();
445
+ await this.createNewClient();
446
446
  this.refreshCookieTimer();
447
447
  throw new Error(info);
448
448
  };
@@ -480,7 +480,7 @@ var BiliAPI = class extends koishi.Service {
480
480
  refresh_token: refreshToken
481
481
  }, { headers: { "Content-Type": "application/x-www-form-urlencoded" } });
482
482
  switch (refreshData.code) {
483
- case -101: return this.createNewClient();
483
+ case -101: return await this.createNewClient();
484
484
  case -111: {
485
485
  await this.ctx.database.remove("loginBili", [1]);
486
486
  notifyAndError("csrf 校验错误,请重新登录");
package/lib/biliAPI.d.mts CHANGED
@@ -58,7 +58,7 @@ declare class BiliAPI extends Service {
58
58
  getMasterInfo(mid: string): Promise<any>;
59
59
  disposeNotifier(): void;
60
60
  getRandomUserAgent(): string;
61
- createNewClient(): void;
61
+ createNewClient(): Promise<void>;
62
62
  getCookies(): string;
63
63
  getCookiesForHeader(): Promise<string>;
64
64
  getLoginInfoIsLoaded(): boolean;
@@ -66,7 +66,7 @@ declare class BiliAPI extends Service {
66
66
  cookies: any;
67
67
  refresh_token: string;
68
68
  }>;
69
- getCSRF(): any;
69
+ getCSRF(): string;
70
70
  loadCookiesFromDatabase(): Promise<void>;
71
71
  enableRefreshCookiesDetect(): void;
72
72
  checkIfTokenNeedRefresh(refreshToken: string, csrf: string, times?: number): Promise<void>;
package/lib/biliAPI.d.ts CHANGED
@@ -58,7 +58,7 @@ declare class BiliAPI extends Service {
58
58
  getMasterInfo(mid: string): Promise<any>;
59
59
  disposeNotifier(): void;
60
60
  getRandomUserAgent(): string;
61
- createNewClient(): void;
61
+ createNewClient(): Promise<void>;
62
62
  getCookies(): string;
63
63
  getCookiesForHeader(): Promise<string>;
64
64
  getLoginInfoIsLoaded(): boolean;
@@ -66,7 +66,7 @@ declare class BiliAPI extends Service {
66
66
  cookies: any;
67
67
  refresh_token: string;
68
68
  }>;
69
- getCSRF(): any;
69
+ getCSRF(): string;
70
70
  loadCookiesFromDatabase(): Promise<void>;
71
71
  enableRefreshCookiesDetect(): void;
72
72
  checkIfTokenNeedRefresh(refreshToken: string, csrf: string, times?: number): Promise<void>;
package/lib/biliAPI.js CHANGED
@@ -1,5 +1,5 @@
1
1
  const require_chunk = require('./chunk-CrFLpmCJ.js');
2
2
  require('./utils-BoaYrSvG.js');
3
- const require_biliAPI = require('./biliAPI-GF2e2-2V.js');
3
+ const require_biliAPI = require('./biliAPI-DyJf03ZZ.js');
4
4
 
5
5
  module.exports = require_biliAPI.biliAPI_default;
package/lib/biliAPI.mjs CHANGED
@@ -1,4 +1,4 @@
1
1
  import "./utils-C95cnBJG.mjs";
2
- import { biliAPI_default } from "./biliAPI-BB6Ih4EM.mjs";
2
+ import { biliAPI_default } from "./biliAPI-CDXS43YV.mjs";
3
3
 
4
4
  export { biliAPI_default as default };
package/lib/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  const require_chunk = require('./chunk-CrFLpmCJ.js');
2
2
  require('./utils-BoaYrSvG.js');
3
- const require_biliAPI = require('./biliAPI-GF2e2-2V.js');
3
+ const require_biliAPI = require('./biliAPI-DyJf03ZZ.js');
4
4
  const require_blive = require('./blive-BBVUYbxX.js');
5
5
  const require_comRegister = require('./comRegister-t7UnYFig.js');
6
6
  require('./type-WjCy4YMc.js');
package/lib/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import "./utils-C95cnBJG.mjs";
2
- import { biliAPI_default } from "./biliAPI-BB6Ih4EM.mjs";
2
+ import { biliAPI_default } from "./biliAPI-CDXS43YV.mjs";
3
3
  import { blive_default } from "./blive-CyC_0-9A.mjs";
4
4
  import { comRegister_default } from "./comRegister-CcqOpkwB.mjs";
5
5
  import "./type-C5ZxPrgY.mjs";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "koishi-plugin-bilibili-notify",
3
3
  "description": "Koishi bilibili notify plugin",
4
- "version": "3.2.5-alpha.2",
4
+ "version": "3.2.5-alpha.3",
5
5
  "contributors": [
6
6
  "Akokko <admin@akokko.com>"
7
7
  ],
@@ -38,14 +38,14 @@
38
38
  "@akokko/blive-message-listener": "^0.5.1",
39
39
  "@satorijs/element": "^3.1.8",
40
40
  "axios": "^1.9.0",
41
- "axios-cookiejar-support": "^5.0.5",
41
+ "axios-cookiejar-support": "^6.0.2",
42
42
  "cacheable-lookup": "^7.0.0",
43
43
  "cron": "^4.3.1",
44
- "jsdom": "^24.1.3",
44
+ "jsdom": "^26.1.0",
45
45
  "luxon": "^3.6.1",
46
46
  "md5": "^2.3.0",
47
47
  "qrcode": "^1.5.4",
48
- "tough-cookie": "^4.1.4"
48
+ "tough-cookie": "^5.1.2"
49
49
  },
50
50
  "devDependencies": {
51
51
  "@biomejs/biome": "1.9.4",
@@ -62,10 +62,10 @@
62
62
  "@types/tough-cookie": "^4.0.5",
63
63
  "esbuild": "^0.25.5",
64
64
  "esbuild-register": "^3.6.0",
65
- "globals": "^15.15.0",
65
+ "globals": "^16.2.0",
66
66
  "koishi": "^4.18.8",
67
67
  "koishi-plugin-puppeteer": "^3.9.0",
68
- "tsdown": "^0.12.6",
68
+ "tsdown": "^0.12.7",
69
69
  "tsx": "^4.19.4",
70
70
  "typescript": "5.8.3",
71
71
  "yakumo": "^1.0.0",
package/readme.md CHANGED
@@ -281,6 +281,7 @@ uid为必填参数,为要推送的UP主的UID,index为可选参数,为要
281
281
  > - ver 3.2.5-alpha.0 优化:新增 `DNS` 缓存,以减少DNS错误;
282
282
  > - ver 3.2.5-alpha.1 测试版本
283
283
  > - ver 3.2.5-alpha.2 测试版本
284
+ > - ver 3.2.5-alpha.3 更新依赖版本
284
285
 
285
286
  ## 交流群
286
287