diff --git a/astrbot/dashboard/routes/stat.py b/astrbot/dashboard/routes/stat.py index 337e544af..b216d3d14 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 f9c22f18d..2a871485e 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 mdi-menu - AstrBot +
+ AstrBot + + {{ botCurrVersion }} +
- 有新版本! + AstrBot 有新版本! + + + WebUI 有新版本!
@@ -353,8 +369,8 @@ if (localStorage.getItem('change_pwd_hint') != null && localStorage.getItem('cha diff --git a/dashboard/src/layouts/full/vertical-sidebar/VerticalSidebar.vue b/dashboard/src/layouts/full/vertical-sidebar/VerticalSidebar.vue index 9b2abed91..d505e0422 100644 --- a/dashboard/src/layouts/full/vertical-sidebar/VerticalSidebar.vue +++ b/dashboard/src/layouts/full/vertical-sidebar/VerticalSidebar.vue @@ -9,9 +9,6 @@ const customizer = useCustomizerStore(); const sidebarMenu = shallowRef(sidebarItems); const showIframe = ref(false); -const version = ref(""); -const buildVer = ref(""); -const hasWebUIUpdate = ref(false); // 默认桌面端 iframe 样式 const iframeStyle = ref({ @@ -68,9 +65,10 @@ function toggleIframe() { showIframe.value = !showIframe.value; } -function openIframeLink() { +function openIframeLink(url) { if (typeof window !== 'undefined') { - window.open("https://astrbot.app", "_blank"); + let url_ = url || "https://astrbot.app"; + window.open(url_, "_blank"); } } @@ -149,25 +147,6 @@ function endDrag() { document.removeEventListener('touchend', onTouchEnd); } -// 获取版本和更新信息 -onMounted(() => { - axios.get('/api/stat/version') - .then((res) => { - version.value = "v" + res.data.data.version; - }) - .catch((err) => { - console.log(err); - }); - - axios.get('/api/update/check?type=dashboard') - .then((res) => { - hasWebUIUpdate.value = res.data.data.has_new_version; - buildVer.value = res.data.data.current_version; - }) - .catch((err) => { - console.log(err); - }); -}); -
- {{ version }} -
-
- - - 🤔 点击此处 查看/关闭 悬浮文档! - - - WebUI 版本: {{ buildVer }} - 构建: embedded - - - - AGPL-3.0 +
+ + 官方文档 + +
+ + GitHub + +
+
-
- - -
-
- AstrBot Logo - AstrBot Logo -
+ + +
+ +
+
+
+ AstrBot Logo + AstrBot Logo +
+
+

AstrBot

+

A project out of interests and loves ❤️

+
+ + Star 这个项目! 🌟 + + + 提交 Issue + +
+
+
+
-

AstrBot

+ +
+ + + +

贡献者

+

+ 本项目由众多开源社区成员共同维护。感谢每一位贡献者的付出! +

+

+ 查看 AstrBot 贡献者 +

+
+ + + + + + +
+
+
- A project out of interests and loves ❤️ - - By Soulter, AstrBot Contributors - and AstrBot - Plugin Authors - - - - - Active Contributors of Soulter/AstrBot - Last 28 days - - Active Contributors of Soulter/AstrBot - Last 28 days - - - - - - Star 这个项目! 🌟 - - - - 有使用问题或者功能建议?提交 Issue! - + +
+ + + +

全球部署

+ +
+ +

AstrBot 采用 AGPL v3 协议开源

+
+
+ + + + + + +
+
+
-
+ - \ No newline at end of file