From d57b7222b2e72deedd58e6ef0bdbfb4180eb8616 Mon Sep 17 00:00:00 2001
From: Soulter <905617992@qq.com>
Date: Sat, 17 May 2025 13:30:33 +0800
Subject: [PATCH] =?UTF-8?q?perf:=20=E4=BC=98=E5=8C=96=20WebUI=20About=20?=
=?UTF-8?q?=E9=A1=B5=E9=9D=A2=E3=80=81=E4=BE=A7=E8=BE=B9=E6=A0=8F=E5=92=8C?=
=?UTF-8?q?=E9=A1=B6=E6=A0=8F?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
astrbot/dashboard/routes/stat.py | 6 +-
.../full/vertical-header/VerticalHeader.vue | 34 ++-
.../full/vertical-sidebar/VerticalSidebar.vue | 55 +---
dashboard/src/views/AboutPage.vue | 250 ++++++++++++++----
4 files changed, 240 insertions(+), 105 deletions(-)
diff --git a/astrbot/dashboard/routes/stat.py b/astrbot/dashboard/routes/stat.py
index 337e544a..b216d3d1 100644
--- a/astrbot/dashboard/routes/stat.py
+++ b/astrbot/dashboard/routes/stat.py
@@ -8,6 +8,7 @@ from quart import request
from astrbot.core.core_lifecycle import AstrBotCoreLifecycle
from astrbot.core.db import BaseDatabase
from astrbot.core.config import VERSION
+from astrbot.core.utils.io import get_dashboard_version
from astrbot.core import DEMO_MODE
@@ -46,7 +47,10 @@ class StatRoute(Route):
return f"{h}小时{m}分{s}秒"
async def get_version(self):
- return Response().ok({"version": VERSION}).__dict__
+ return Response().ok({
+ "version": VERSION,
+ "dashboard_version": await get_dashboard_version(),
+ }).__dict__
async def get_start_time(self):
return Response().ok({"start_time": self.core_lifecycle.start_time}).__dict__
diff --git a/dashboard/src/layouts/full/vertical-header/VerticalHeader.vue b/dashboard/src/layouts/full/vertical-header/VerticalHeader.vue
index f9c22f18..2a871485 100644
--- a/dashboard/src/layouts/full/vertical-header/VerticalHeader.vue
+++ b/dashboard/src/layouts/full/vertical-header/VerticalHeader.vue
@@ -78,6 +78,17 @@ function accountEdit() {
});
}
+function getVersion() {
+ axios.get('/api/stat/version')
+ .then((res) => {
+ botCurrVersion.value = "v" + res.data.data.version;
+ dashboardCurrentVersion.value = res.data.data?.dashboard_version;
+ })
+ .catch((err) => {
+ console.log(err);
+ });
+}
+
function checkUpdate() {
updateStatus.value = '正在检查更新...';
axios.get('/api/update/check')
@@ -90,8 +101,6 @@ function checkUpdate() {
} else {
updateStatus.value = res.data.message;
}
- botCurrVersion.value = res.data.data.version;
- dashboardCurrentVersion.value = res.data.data.dashboard_version;
dashboardHasNewVersion.value = res.data.data.dashboard_has_new_version;
})
.catch((err) => {
@@ -181,6 +190,7 @@ function updateDashboard() {
});
}
+getVersion();
checkUpdate();
const commonStore = useCommonStore();
@@ -208,23 +218,29 @@ if (localStorage.getItem('change_pwd_hint') != null && localStorage.getItem('cha
-