koishi-plugin-bilibili-notify 1.2.14 → 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/database.js +2 -2
- package/lib/font/HYZhengYuan-75W.ttf +0 -0
- package/lib/generateImg.d.ts +2 -0
- package/lib/generateImg.js +3 -2
- package/lib/index.d.ts +1 -0
- package/lib/index.js +7 -3
- package/package.json +1 -1
- package/readme.md +2 -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
|
package/lib/database.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.name = void 0;
|
|
4
|
-
exports.apply = apply;
|
|
3
|
+
exports.apply = exports.name = void 0;
|
|
5
4
|
exports.name = 'Database';
|
|
6
5
|
function apply(ctx) {
|
|
7
6
|
// 新增LoginBili表
|
|
@@ -23,3 +22,4 @@ function apply(ctx) {
|
|
|
23
22
|
time: 'timestamp'
|
|
24
23
|
}, { autoInc: true });
|
|
25
24
|
}
|
|
25
|
+
exports.apply = apply;
|
|
Binary file
|
package/lib/generateImg.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
1
2
|
import { Context, Schema, Service } from "koishi";
|
|
2
3
|
declare module 'koishi' {
|
|
3
4
|
interface Context {
|
|
@@ -43,6 +44,7 @@ declare namespace GenerateImg {
|
|
|
43
44
|
cardColorEnd: string;
|
|
44
45
|
enableLargeFont: boolean;
|
|
45
46
|
font: string;
|
|
47
|
+
hideDesc: boolean;
|
|
46
48
|
}
|
|
47
49
|
const Config: Schema<Config>;
|
|
48
50
|
}
|
package/lib/generateImg.js
CHANGED
|
@@ -180,7 +180,7 @@ class GenerateImg extends koishi_1.Service {
|
|
|
180
180
|
<span class="broadcast-message">${userData.info.uname}${titleStatus}</span>
|
|
181
181
|
</div>
|
|
182
182
|
</div>
|
|
183
|
-
|
|
183
|
+
${this.giConfig.hideDesc ? '' : `<p class="card-text">${data.description ? data.description : '这个主播很懒,什么都简介都没写'}</p>`}
|
|
184
184
|
<p class="card-link">
|
|
185
185
|
<span>${liveTime}</span>
|
|
186
186
|
<span>分区名称:${data.area_name}</span>
|
|
@@ -1385,7 +1385,8 @@ class GenerateImg extends koishi_1.Service {
|
|
|
1385
1385
|
cardColorStart: koishi_1.Schema.string(),
|
|
1386
1386
|
cardColorEnd: koishi_1.Schema.string(),
|
|
1387
1387
|
enableLargeFont: koishi_1.Schema.boolean(),
|
|
1388
|
-
font: koishi_1.Schema.string()
|
|
1388
|
+
font: koishi_1.Schema.string(),
|
|
1389
|
+
hideDesc: koishi_1.Schema.boolean()
|
|
1389
1390
|
});
|
|
1390
1391
|
})(GenerateImg || (GenerateImg = {}));
|
|
1391
1392
|
exports.default = GenerateImg;
|
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
|
@@ -26,8 +26,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
26
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.Config = exports.name = exports.inject = void 0;
|
|
30
|
-
exports.apply = apply;
|
|
29
|
+
exports.apply = exports.Config = exports.name = exports.inject = void 0;
|
|
31
30
|
const koishi_1 = require("koishi");
|
|
32
31
|
// import plugins
|
|
33
32
|
// import Authority from './authority'
|
|
@@ -52,7 +51,6 @@ exports.Config = koishi_1.Schema.object({
|
|
|
52
51
|
enable: koishi_1.Schema.boolean()
|
|
53
52
|
.default(false)
|
|
54
53
|
.description('是否开启主人账号功能,如果您的机器人没有私聊权限请不要开启此功能。开启后如果机器人运行错误会向您进行报告')
|
|
55
|
-
.experimental()
|
|
56
54
|
}).description('主人账号'),
|
|
57
55
|
koishi_1.Schema.union([
|
|
58
56
|
koishi_1.Schema.object({
|
|
@@ -110,6 +108,10 @@ exports.Config = koishi_1.Schema.object({
|
|
|
110
108
|
customLiveEnd: koishi_1.Schema.string()
|
|
111
109
|
.default('-name下播啦,本次直播了-time')
|
|
112
110
|
.description('自定义下播提示语,-name代表UP昵称,-time代表开播时长。例如-name下播啦,本次直播了-time,会发送为xxxUP下播啦,直播时长为xx小时xx分钟xx秒'),
|
|
111
|
+
hideDesc: koishi_1.Schema.boolean()
|
|
112
|
+
.default(false)
|
|
113
|
+
.description('是否隐藏UP主直播间简介,开启后推送的直播卡片将不再展示简介')
|
|
114
|
+
.experimental(),
|
|
113
115
|
style: koishi_1.Schema.object({}).description('美化设置'),
|
|
114
116
|
removeBorder: koishi_1.Schema.boolean()
|
|
115
117
|
.default(false)
|
|
@@ -247,6 +249,7 @@ class ServerManager extends koishi_1.Service {
|
|
|
247
249
|
removeBorder: globalConfig.removeBorder,
|
|
248
250
|
cardColorStart: globalConfig.cardColorStart,
|
|
249
251
|
cardColorEnd: globalConfig.cardColorEnd,
|
|
252
|
+
hideDesc: globalConfig.hideDesc,
|
|
250
253
|
enableLargeFont: globalConfig.enableLargeFont,
|
|
251
254
|
font: globalConfig.font
|
|
252
255
|
});
|
|
@@ -344,3 +347,4 @@ function apply(ctx, config) {
|
|
|
344
347
|
}
|
|
345
348
|
});
|
|
346
349
|
}
|
|
350
|
+
exports.apply = apply;
|
package/package.json
CHANGED