koishi-plugin-bilibili-notify 1.2.15 → 1.2.16

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/lib/biliAPI.js CHANGED
@@ -203,28 +203,34 @@ class BiliAPI extends koishi_1.Service {
203
203
  refresh_token: null
204
204
  };
205
205
  }
206
- // 定义解密信息
207
- let decryptedCookies;
208
- let decryptedRefreshToken;
206
+ // 尝试解密
209
207
  try {
210
208
  // 解密数据
211
- decryptedCookies = this.ctx.wbi.decrypt(data.bili_cookies);
209
+ const decryptedCookies = this.ctx.wbi.decrypt(data.bili_cookies);
212
210
  // 解密refresh_token
213
- decryptedRefreshToken = this.ctx.wbi.decrypt(data.bili_refresh_token);
211
+ const decryptedRefreshToken = this.ctx.wbi.decrypt(data.bili_refresh_token);
212
+ // 解析从数据库读到的cookies
213
+ const cookies = JSON.parse(decryptedCookies);
214
+ // 返回值
215
+ return {
216
+ cookies,
217
+ refresh_token: decryptedRefreshToken
218
+ };
214
219
  }
215
220
  catch (e) {
216
- // 解密失败,删除数据库登录信息
221
+ // 数据库被篡改,在控制台提示
222
+ this.loginNotifier = this.ctx.notifier.create({
223
+ type: 'warning',
224
+ content: '数据库被篡改,请重新登录'
225
+ });
226
+ // 解密或解析失败,删除数据库登录信息
217
227
  await this.ctx.database.remove('loginBili', [1]);
218
- // 直接返回
219
- return;
228
+ // 返回空值
229
+ return {
230
+ cookies: null,
231
+ refresh_token: null
232
+ };
220
233
  }
221
- // 解析从数据库读到的cookies
222
- const cookies = JSON.parse(decryptedCookies);
223
- // 返回值
224
- return {
225
- cookies,
226
- refresh_token: decryptedRefreshToken
227
- };
228
234
  }
229
235
  async loadCookiesFromDatabase() {
230
236
  // Get login info from db
Binary file
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": "1.2.15",
4
+ "version": "1.2.16",
5
5
  "contributors": [
6
6
  "Akokko <admin@akokko.com>"
7
7
  ],
package/readme.md CHANGED
@@ -159,6 +159,7 @@
159
159
  - ver 1.2.13 现已支持调试模式,目前支持对动态的调试。需要调试模式可在控制台中开启
160
160
  - ver 1.2.14 优化调试模式输出,直播推送卡片添加分区信息
161
161
  - ver 1.2.15 新增直播推送卡片简介隐藏选项
162
+ - ver 1.2.16 当存储在数据库中的登录信息被篡改时,新增控制台提示
162
163
 
163
164
  ## 交流群
164
165