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 +21 -15
- package/lib/font/HYZhengYuan-75W.ttf +0 -0
- package/package.json +1 -1
- package/readme.md +1 -0
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