增加`#版本`命令

This commit is contained in:
Kokomi 2023-03-10 04:38:01 +08:00
parent 5216f6fc0a
commit 106defd380
9 changed files with 40 additions and 14 deletions

11
CHANGELOG.md Normal file
View File

@ -0,0 +1,11 @@
# 3.0.1
* 添加`#版本`命令,用于查看更新记录
# 3.0.0
* 用icqq进行登录
# 3.0.0
* 我的

View File

@ -12,6 +12,7 @@ import cfg from '../config/config.js'
import MysApi from '../../plugins/genshin/model/mys/mysApi.js' import MysApi from '../../plugins/genshin/model/mys/mysApi.js'
import MysInfo from '../../plugins/genshin/model/mys/mysInfo.js' import MysInfo from '../../plugins/genshin/model/mys/mysInfo.js'
import puppeteer from '../puppeteer/puppeteer.js' import puppeteer from '../puppeteer/puppeteer.js'
import { Version } from '#miao'
/** /**
* 常用的处理方法 * 常用的处理方法
@ -140,16 +141,31 @@ export default class Runtime {
mkdir(`html/${plugin}/${path}`) mkdir(`html/${plugin}/${path}`)
// 自动计算pluResPath // 自动计算pluResPath
let pluResPath = `../../../${lodash.repeat('../', paths.length)}plugins/${plugin}/resources/` let pluResPath = `../../../${lodash.repeat('../', paths.length)}plugins/${plugin}/resources/`
let miaoResPath = `../../../${lodash.repeat('../', paths.length)}plugins/miao-plugin/resources/`
const layoutPath = process.cwd() + '/plugins/miao-plugin/resources/common/layout/'
// 渲染data // 渲染data
data = { data = {
sys: {
scale: 1
},
/** miao 相关参数 **/
copyright: `Created By Miao-Yunzai<span class="version">${Version.yunzai}</span> `,
_res_path: pluResPath,
_miao_path: miaoResPath,
_tpl_path: process.cwd() + '/plugins/miao-plugin/resources/common/tpl/',
defaultLayout: layoutPath + 'default.html',
elemLayout: layoutPath + 'elem.html',
...data, ...data,
/** 默认参数 **/
_plugin: plugin, _plugin: plugin,
_htmlPath: path, _htmlPath: path,
pluResPath, pluResPath,
tplFile: `./plugins/${plugin}/resources/${path}.html`, tplFile: `./plugins/${plugin}/resources/${path}.html`,
saveId: data.saveId || data.save_id || paths[paths.length - 1], saveId: data.saveId || data.save_id || paths[paths.length - 1],
pageGotoParams: { pageGotoParams: {
waitUntil: 'networkidle0' waitUntil: 'networkidle2'
} }
} }
// 处理beforeRender // 处理beforeRender

View File

@ -1,7 +1,6 @@
import template from 'art-template' import template from 'art-template'
import fs from 'fs' import fs from 'fs'
import lodash from 'lodash' import lodash from 'lodash'
import { segment } from 'icqq'
import chokidar from 'chokidar' import chokidar from 'chokidar'
import cfg from '../config/config.js' import cfg from '../config/config.js'
@ -22,9 +21,7 @@ class Puppeteer {
headless: true, headless: true,
args: [ args: [
'--disable-gpu', '--disable-gpu',
'--disable-dev-shm-usage',
'--disable-setuid-sandbox', '--disable-setuid-sandbox',
'--no-first-run',
'--no-sandbox', '--no-sandbox',
'--no-zygote', '--no-zygote',
'--single-process' '--single-process'
@ -73,11 +70,19 @@ class Puppeteer {
logger.mark('puppeteer Chromium 启动中...') logger.mark('puppeteer Chromium 启动中...')
/** 初始化puppeteer */ /** 初始化puppeteer */
this.browser = await puppeteer.launch(this.config).catch((err) => { this.browser = await puppeteer.launch(this.config).catch((err, trace) => {
logger.error(err.toString()) let errMsg = err.toString() + (trace ? trace.toString() : '')
if (String(err).includes('correct Chromium')) { if (typeof err == 'object') {
logger.error('没有正确安装Chromium可以尝试执行安装命令node ./node_modules/puppeteer/install.js') logger.error(JSON.stringify(err))
} else {
logger.error(err.toString())
if (errMsg.includes('Could not find Chromium')) {
logger.error('没有正确安装Chromium可以尝试执行安装命令node ./node_modules/puppeteer/install.js')
} else if (errMsg.includes('libatk-bridge')) {
logger.error('没有正确安装Chromium可尝试执行 sudo yum install -y chromium')
}
} }
console.log(err, trace)
}) })
this.lock = false this.lock = false

View File

@ -1,5 +1,4 @@
import plugin from '../../lib/plugins/plugin.js' import plugin from '../../lib/plugins/plugin.js'
import { segment } from 'icqq'
export class newcomer extends plugin { export class newcomer extends plugin {
constructor () { constructor () {
super({ super({

View File

@ -4,7 +4,6 @@ import fs from 'node:fs'
import GachaLog from '../model/gachaLog.js' import GachaLog from '../model/gachaLog.js'
import ExportLog from '../model/exportLog.js' import ExportLog from '../model/exportLog.js'
import LogCount from '../model/logCount.js' import LogCount from '../model/logCount.js'
import { segment } from 'icqq'
const _path = process.cwd() + '/plugins/genshin' const _path = process.cwd() + '/plugins/genshin'

View File

@ -2,7 +2,6 @@
import plugin from '../../../lib/plugins/plugin.js' import plugin from '../../../lib/plugins/plugin.js'
import gsCfg from '../model/gsCfg.js' import gsCfg from '../model/gsCfg.js'
import common from '../../../lib/common/common.js' import common from '../../../lib/common/common.js'
import { segment } from 'icqq'
import fs from 'node:fs' import fs from 'node:fs'
import fetch from 'node-fetch' import fetch from 'node-fetch'

View File

@ -2,7 +2,6 @@
import plugin from '../../../lib/plugins/plugin.js' import plugin from '../../../lib/plugins/plugin.js'
import gsCfg from '../model/gsCfg.js' import gsCfg from '../model/gsCfg.js'
import common from '../../../lib/common/common.js' import common from '../../../lib/common/common.js'
import { segment } from 'icqq'
import lodash from 'lodash' import lodash from 'lodash'
import fs from 'node:fs' import fs from 'node:fs'
import fetch from 'node-fetch' import fetch from 'node-fetch'

View File

@ -3,7 +3,6 @@ import fetch from 'node-fetch'
import lodash from 'lodash' import lodash from 'lodash'
import puppeteer from '../../../lib/puppeteer/puppeteer.js' import puppeteer from '../../../lib/puppeteer/puppeteer.js'
import common from '../../../lib/common/common.js' import common from '../../../lib/common/common.js'
import { segment } from 'icqq'
import gsCfg from '../model/gsCfg.js' import gsCfg from '../model/gsCfg.js'
const _path = process.cwd() const _path = process.cwd()

View File

@ -2,7 +2,6 @@ import base from './base.js'
import MysInfo from './mys/mysInfo.js' import MysInfo from './mys/mysInfo.js'
import gsCfg from './gsCfg.js' import gsCfg from './gsCfg.js'
import lodash from 'lodash' import lodash from 'lodash'
import { segment } from 'icqq'
import fs from 'node:fs' import fs from 'node:fs'
import fetch from 'node-fetch' import fetch from 'node-fetch'
import common from '../../../lib/common/common.js' import common from '../../../lib/common/common.js'