From 550685183b7b948a8b74cfa36454ee9384b35db0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=B0=8F=E5=8F=B6?= <1936472877@qq.com>
Date: Thu, 21 Nov 2024 17:32:45 +0800
Subject: [PATCH] =?UTF-8?q?perf:=20=E6=9B=B4=E6=94=B9=E5=9B=BE=E7=89=87?=
=?UTF-8?q?=E6=B8=B2=E6=9F=93=E6=96=B9=E5=BC=8F?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
README.md | 2 +-
apps/achievement.js | 2 +-
apps/discounts.js | 2 +-
apps/inventory.js | 2 +-
apps/search.js | 2 +-
components/Render.js | 3 +
resources/common/layout/default.html | 2 +-
resources/inventory/index.css | 112 ++++++++++++++
resources/inventory/index.html | 218 ++++++---------------------
9 files changed, 170 insertions(+), 175 deletions(-)
create mode 100644 resources/inventory/index.css
diff --git a/README.md b/README.md
index 2de032d..856dfd5 100644
--- a/README.md
+++ b/README.md
@@ -6,7 +6,7 @@
-![GitHub release (latest by date)](https://img.shields.io/github/v/release/XasYer/YePanel)
+![GitHub release (latest by date)](https://img.shields.io/github/v/release/XasYer/steam-plugin)
![GitHub stars](https://img.shields.io/github/stars/XasYer/steam-plugin?style=social)
![GitHub forks](https://img.shields.io/github/forks/XasYer/steam-plugin?style=social)
![GitHub license](https://img.shields.io/github/license/XasYer/steam-plugin)
diff --git a/apps/achievement.js b/apps/achievement.js
index e2fb3d3..5047151 100644
--- a/apps/achievement.js
+++ b/apps/achievement.js
@@ -110,7 +110,7 @@ export const rule = {
}
)
}
- const img = await Render.simpleRender('inventory/index', { data })
+ const img = await Render.render('inventory/index', { data })
if (img) {
await e.reply(img)
} else {
diff --git a/apps/discounts.js b/apps/discounts.js
index 0d993b9..a2a1c55 100644
--- a/apps/discounts.js
+++ b/apps/discounts.js
@@ -58,7 +58,7 @@ export const rule = {
}
data.push(key)
}
- const img = await Render.simpleRender('inventory/index', { data })
+ const img = await Render.render('inventory/index', { data })
if (img) {
await e.reply(img)
} else {
diff --git a/apps/inventory.js b/apps/inventory.js
index 68972ab..8d7f1cb 100644
--- a/apps/inventory.js
+++ b/apps/inventory.js
@@ -91,7 +91,7 @@ export const rule = {
})
screenshotOptions.desc = `总游戏时长:${getTime(playtimeForever)} / 最近两周游戏时长:${getTime(playtime2weeks)}`
}
- const img = await Render.simpleRender('inventory/index', {
+ const img = await Render.render('inventory/index', {
data: [screenshotOptions]
})
if (img) {
diff --git a/apps/search.js b/apps/search.js
index 0cb5dde..bf9d8b9 100644
--- a/apps/search.js
+++ b/apps/search.js
@@ -41,7 +41,7 @@ export const rule = {
games,
column: 2
}
- const img = await Render.simpleRender('inventory/index', { data: [screenshotOptions] })
+ const img = await Render.render('inventory/index', { data: [screenshotOptions] })
if (img) {
await e.reply(img)
} else {
diff --git a/components/Render.js b/components/Render.js
index 8341fe8..5cbfc3e 100644
--- a/components/Render.js
+++ b/components/Render.js
@@ -22,6 +22,9 @@ const Render = {
scale: scale(params.scale || 1),
copyright: params.copyright || `Created By ${Version.BotName} v${Version.BotVersion} & ${Version.pluginName} v${Version.pluginVersion} `
},
+ pageGotoParams: {
+ waitUntil: 'networkidle0' // +0.5s
+ },
...params
}
return await puppeteer.screenshot(path, data)
diff --git a/resources/common/layout/default.html b/resources/common/layout/default.html
index 1ae5069..7e212c9 100644
--- a/resources/common/layout/default.html
+++ b/resources/common/layout/default.html
@@ -8,7 +8,7 @@
-