yz-yuki-plugin 1.0.3-rc.2 → 1.0.3-rc.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.
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
  ```
@@ -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 body = await page.$(Options?.tab ?? 'body');
27
- if (!body)
26
+ const element = await page.$(Options?.tab ?? 'body');
27
+ if (!element)
28
28
  return false;
29
- const boundingBox = await body.boundingBox();
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 page.screenshot(screenshotOptions).catch(err => {
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.2",
3
+ "version": "1.0.3-rc.3",
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.2",
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.2",
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",
@@ -8,6 +8,7 @@
8
8
  body {
9
9
  width: 563px !important;
10
10
  font-family: "OPSans", Arial, sans-serif;
11
+ margin: auto;
11
12
  }
12
13
 
13
14
  .container {