修正情况下puppeteer渲染触发的路径错误
This commit is contained in:
parent
fb829b2daf
commit
27482065d3
27
README.md
27
README.md
|
@ -9,7 +9,7 @@
|
|||
* 使用icqq登录,防止oicq可能出现的低版本问题(如只需要此特性,可使用[Yunzai-V3](https://gitee.com/yoimiya-kokomi/Yunzai-Bot) )
|
||||
* 基础功能会保持与Yunzai同步迭代更新,如只需原版Yunzai无需切换
|
||||
|
||||
## Miao-Yunzai后续计划no
|
||||
## Miao-Yunzai后续计划
|
||||
|
||||
先刨坑,但也许会咕咕咕
|
||||
|
||||
|
@ -27,19 +27,34 @@
|
|||
|
||||
## 使用方法
|
||||
|
||||
> 环境准备: Windows or Linux,Node.js([版本至少v16以上](http://nodejs.cn/download/)),[Redis](https://redis.io/docs/getting-started/installation/)
|
||||
> 环境准备: Windows or Linux,Node.js( [版本至少v16以上](http://nodejs.cn/download/) ), [Redis](https://redis.io/docs/getting-started/installation/ )
|
||||
|
||||
1.克隆项目
|
||||
1.克隆项目并安装miao-plugin
|
||||
|
||||
请根据网络情况选择Github安装或Gitee安装
|
||||
|
||||
```
|
||||
git clone --depth=1 -b main https://github.com/Le-niao/Yunzai-Bot.git
|
||||
#使用 Github
|
||||
git clone --depth=1 https://github.com/yoimiya-kokomi/Miao-Yunzai.git
|
||||
|
||||
#使用Gitee
|
||||
git clone --depth=1 https://gitee.com/yoimiya-kokomi/Miao-Yunzai.git
|
||||
```
|
||||
|
||||
```
|
||||
cd Yunzai-Bot #进入Yunzai目录
|
||||
#进入Yunzai目录
|
||||
cd Miao-Yunzai
|
||||
```
|
||||
|
||||
2.安装[pnpm](https://pnpm.io/zh/installation),已安装的可以跳过
|
||||
```
|
||||
#使用Github
|
||||
git clone --depth=1 https://github.com/yoimiya-kokomi/miao-plugin.git ./plugins/miao-plugin/
|
||||
|
||||
#使用Gitee
|
||||
git clone --depth=1 https://gitee.com/yoimiya-kokomi/miao-plugin.git ./plugins/miao-plugin/
|
||||
```
|
||||
|
||||
2.安装[pnpm](https://pnpm.io/zh/installation) ,已安装的可以跳过
|
||||
|
||||
```
|
||||
npm install pnpm -g
|
||||
|
|
|
@ -22,7 +22,7 @@ export default function setLog () {
|
|||
type: 'console',
|
||||
layout: {
|
||||
type: 'pattern',
|
||||
pattern: '%[[YzBot][%d{hh:mm:ss.SSS}][%4.4p]%] %m'
|
||||
pattern: '%[[MiaoYz][%d{hh:mm:ss.SSS}][%4.4p]%] %m'
|
||||
}
|
||||
},
|
||||
command: {
|
||||
|
|
|
@ -8,6 +8,7 @@ import cfg from '../config/config.js'
|
|||
const _path = process.cwd()
|
||||
|
||||
let puppeteer = {}
|
||||
|
||||
class Puppeteer {
|
||||
constructor () {
|
||||
this.browser = false
|
||||
|
@ -37,7 +38,6 @@ class Puppeteer {
|
|||
|
||||
this.html = {}
|
||||
this.watcher = {}
|
||||
this.createDir('./temp')
|
||||
this.createDir('./temp/html')
|
||||
}
|
||||
|
||||
|
@ -51,7 +51,13 @@ class Puppeteer {
|
|||
|
||||
createDir (dir) {
|
||||
if (!fs.existsSync(dir)) {
|
||||
fs.mkdirSync(dir)
|
||||
let dirs = dir.split('/')
|
||||
for (let idx = 1; idx <= dirs.length; idx++) {
|
||||
let temp = dirs.slice(0, idx).join('/')
|
||||
if (!fs.existsSync(temp)) {
|
||||
fs.mkdirSync(temp)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -129,7 +135,7 @@ class Puppeteer {
|
|||
path: data.path || ''
|
||||
}
|
||||
|
||||
if (data.imgType == 'png') delete randData.quality
|
||||
if (data.imgType === 'png') delete randData.quality
|
||||
|
||||
buff = await body.screenshot(randData)
|
||||
|
||||
|
@ -212,7 +218,7 @@ class Puppeteer {
|
|||
/** 重启 */
|
||||
restart () {
|
||||
/** 截图超过重启数时,自动关闭重启浏览器,避免生成速度越来越慢 */
|
||||
if (this.renderNum % this.restartNum == 0) {
|
||||
if (this.renderNum % this.restartNum === 0) {
|
||||
if (this.shoting.length <= 0) {
|
||||
setTimeout(async () => {
|
||||
if (this.browser) {
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
"type": "module",
|
||||
"scripts": {
|
||||
"app": "node app.js",
|
||||
"web-debug": "node app.js --web-debug",
|
||||
"dev": "node app.js dev",
|
||||
"web": "node ./lib/tools/web.js",
|
||||
"test": "node ./lib/tools/test.js",
|
||||
|
|
Loading…
Reference in New Issue