yz-yuki-plugin 1.0.3-rc.2 → 1.0.3-rc.4
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/README.md
CHANGED
|
@@ -15,11 +15,22 @@
|
|
|
15
15
|
|
|
16
16
|
##### ```Yunzai-Next:```
|
|
17
17
|
|
|
18
|
-
1. yunzai-next npm包
|
|
18
|
+
1. 方式1: yunzai-next npm包 安装插件:
|
|
19
19
|
>```
|
|
20
20
|
> yarn add yz-yuki-plugin -W
|
|
21
21
|
>```
|
|
22
|
-
接着修改 `yunzaijs/yunzai.config.js
|
|
22
|
+
接着修改 `yunzaijs/yunzai.config.js`,按版本选择修改方式:
|
|
23
|
+
|
|
24
|
+
Yunzai-Next v4.1.28+及以上版本:
|
|
25
|
+
```js
|
|
26
|
+
import { defineConfig } from 'yunzai'
|
|
27
|
+
export default defineConfig({
|
|
28
|
+
applications: ['yz-system', 'yz-yuki-plugin'], //该行添加 'yz-yuki-plugin'
|
|
29
|
+
middlewares: ['yz-mw-runtime', 'yunzai-mys/mw']
|
|
30
|
+
})
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
旧版本:
|
|
23
34
|
```js
|
|
24
35
|
import yuki from 'yz-yuki-plugin' //新增该行
|
|
25
36
|
export default defineConfig({
|
|
@@ -28,7 +39,7 @@ export default defineConfig({
|
|
|
28
39
|
})
|
|
29
40
|
```
|
|
30
41
|
|
|
31
|
-
2.
|
|
42
|
+
2. 方式2(V3的方式):
|
|
32
43
|
>gitee仓库:
|
|
33
44
|
>```
|
|
34
45
|
>git clone --branch main https://gitee.com/snowtafir/yuki-plugin.git ./plugins/yuki-plugin
|
|
@@ -52,6 +63,8 @@ export default defineConfig({
|
|
|
52
63
|
|
|
53
64
|
#### 2. 安装依赖
|
|
54
65
|
* Yunzai-Next:
|
|
66
|
+
|
|
67
|
+
方式2(V3的方式)安装则需要执行:
|
|
55
68
|
```
|
|
56
69
|
yarn install
|
|
57
70
|
```
|
package/lib/apps/bilibili.js
CHANGED
|
@@ -32,7 +32,7 @@ message.use(async (e) => {
|
|
|
32
32
|
e.reply("未取得bot主人身份,无权限添加B站动态订阅");
|
|
33
33
|
}
|
|
34
34
|
else {
|
|
35
|
-
const uid = e.msg.replace(/^(#|\/)(yuki|优纪)?(订阅|添加|add|ADD)(b站|B站|bili|bilibili|哔哩|哔哩哔哩)推送\s*(视频\s*|图文\s*|文章\s*|转发\s*|直播\s*)*/g, "").trim();
|
|
35
|
+
const uid = e.msg.replace(/^(#|\/)(yuki|优纪)?(订阅|添加|add|ADD)(b站|B站|bili|bilibili|哔哩|哔哩哔哩)推送\s*(视频\s*|图文\s*|文章\s*|转发\s*|直播\s*)*/g, "").trim().replace(/^(uid|UID)?(:|:)?/g, '');
|
|
36
36
|
if (!uid) {
|
|
37
37
|
e.reply(`请在指令末尾指定订阅的B站up主的UID!`);
|
|
38
38
|
return true;
|
|
@@ -92,7 +92,7 @@ message.use(async (e) => {
|
|
|
92
92
|
e.reply("未取得bot主人身份,无权限删除B站动态订阅");
|
|
93
93
|
}
|
|
94
94
|
else {
|
|
95
|
-
const uid = e.msg.replace(/^(#|\/)(yuki|优纪)?(取消|删除|del|DEL)(b站|B站|bili|bilibili|哔哩|哔哩哔哩)推送\s*(视频\s*|图文\s*|文章\s*|转发\s*|直播\s*)*/g, "").trim();
|
|
95
|
+
const uid = e.msg.replace(/^(#|\/)(yuki|优纪)?(取消|删除|del|DEL)(b站|B站|bili|bilibili|哔哩|哔哩哔哩)推送\s*(视频\s*|图文\s*|文章\s*|转发\s*|直播\s*)*/g, "").trim().replace(/^(uid|UID)?(:|:)?/g, '');
|
|
96
96
|
if (!uid) {
|
|
97
97
|
e.reply(`请在指令末尾指定订阅的B站up主的UID!`);
|
|
98
98
|
return;
|
|
@@ -297,7 +297,7 @@ message.use(async (e) => {
|
|
|
297
297
|
DYNAMIC_TYPE_LIVE_RCMD: "直播",
|
|
298
298
|
};
|
|
299
299
|
if (subData.group && Object.keys(subData.group).length > 0) {
|
|
300
|
-
messages.push("------群组B
|
|
300
|
+
messages.push("------群组B站订阅------\n");
|
|
301
301
|
Object.keys(subData.group).forEach((groupId) => {
|
|
302
302
|
messages.push(`群组ID:${groupId}:`);
|
|
303
303
|
subData.group[groupId].forEach((item) => {
|
|
@@ -314,7 +314,7 @@ message.use(async (e) => {
|
|
|
314
314
|
});
|
|
315
315
|
}
|
|
316
316
|
if (subData.private && Object.keys(subData.private).length > 0) {
|
|
317
|
-
messages.push("------私聊B站订阅------");
|
|
317
|
+
messages.push("\n------私聊B站订阅------");
|
|
318
318
|
Object.keys(subData.private).forEach((userId) => {
|
|
319
319
|
messages.push(`用户ID:${userId}:`);
|
|
320
320
|
subData.private[userId].forEach((item) => {
|
|
@@ -28,6 +28,7 @@ async function applyLoginQRCode(e) {
|
|
|
28
28
|
};
|
|
29
29
|
const ScreenshotOptionsData = {
|
|
30
30
|
saveHtmlfile: false,
|
|
31
|
+
modelName: "bili-login"
|
|
31
32
|
};
|
|
32
33
|
const qrCodeImage = await Image.renderPage("bili-login", "LoginQrcodePage", LoginPropsData, ScreenshotOptionsData);
|
|
33
34
|
let qrcodeImg;
|
|
@@ -39,6 +40,8 @@ async function applyLoginQRCode(e) {
|
|
|
39
40
|
msg.push(Segment.image(qrcodeImg[0]));
|
|
40
41
|
e.reply('请在3分钟内扫码以完成B站登陆绑定');
|
|
41
42
|
e.reply(msg);
|
|
43
|
+
logger.info(`优纪插件: 如果发送二维码图片消息失败可复制如下URL, 使用在线或本地二维码生成工具生成二维码并扫码`);
|
|
44
|
+
logger.info(`优纪插件: 哔哩登陆二维码URL: ${qrcodeUrl}`);
|
|
42
45
|
return qrcodeKey;
|
|
43
46
|
}
|
|
44
47
|
else {
|
|
@@ -23,10 +23,10 @@ class YukiPuppeteerRender extends Puppeteer {
|
|
|
23
23
|
await page.setExtraHTTPHeaders(Options.header);
|
|
24
24
|
}
|
|
25
25
|
await page.goto(`file://${htmlPath}`, { timeout: Options?.timeout ?? 120000, waitUntil: ["load", "networkidle0"] });
|
|
26
|
-
const
|
|
27
|
-
if (!
|
|
26
|
+
const element = await page.$(Options?.tab ?? 'body');
|
|
27
|
+
if (!element)
|
|
28
28
|
return false;
|
|
29
|
-
const boundingBox = await
|
|
29
|
+
const boundingBox = await element.boundingBox();
|
|
30
30
|
const num = Options?.isSplit ? Math.ceil(boundingBox.height / pageHeight) : 1;
|
|
31
31
|
pageHeight = Math.round(boundingBox.height / num);
|
|
32
32
|
await page.setViewport({
|
|
@@ -71,7 +71,7 @@ class YukiPuppeteerRender extends Puppeteer {
|
|
|
71
71
|
height: Math.min(pageHeight, boundingBox.height - pageHeight * (i - 1)),
|
|
72
72
|
},
|
|
73
73
|
};
|
|
74
|
-
buff = await
|
|
74
|
+
buff = await element.screenshot(screenshotOptions).catch(err => {
|
|
75
75
|
logger.error('[puppeteer]', 'screenshot', err);
|
|
76
76
|
return false;
|
|
77
77
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "yz-yuki-plugin",
|
|
3
|
-
"version": "1.0.3-rc.
|
|
3
|
+
"version": "1.0.3-rc.4",
|
|
4
4
|
"description": "优纪插件,yunzaijs 关于 微博推送、B站推送 等功能的拓展插件",
|
|
5
5
|
"author": "snowtafir",
|
|
6
6
|
"type": "module",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"qrcode": "^1.5.4",
|
|
33
33
|
"react": "^18.3.1",
|
|
34
34
|
"react-dom": "^18.3.1",
|
|
35
|
-
"react-puppeteer": "1.0.
|
|
35
|
+
"react-puppeteer": "1.0.3",
|
|
36
36
|
"redis": "^4.7.0",
|
|
37
37
|
"yaml": "^2.5.0",
|
|
38
38
|
"yarn": "^1.19.1"
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
"qrcode": "^1.5.4",
|
|
68
68
|
"react": "^18.3.1",
|
|
69
69
|
"react-dom": "^18.3.1",
|
|
70
|
-
"react-puppeteer": "1.0.
|
|
70
|
+
"react-puppeteer": "1.0.3",
|
|
71
71
|
"redis": "^4.7.0",
|
|
72
72
|
"rollup": "^4.20.0",
|
|
73
73
|
"rollup-plugin-auto-external": "^2.0.0",
|