From ccbfc3d27471819fb940898a83eca6a22e78a651 Mon Sep 17 00:00:00 2001
From: Soulter <905617992@qq.com>
Date: Mon, 9 Jun 2025 11:47:23 +0800
Subject: [PATCH] =?UTF-8?q?perf:=20=E5=BC=BA=E5=8C=96=E5=BC=BA=E5=88=B6?=
=?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=BB=98=E8=AE=A4=E5=AF=86=E7=A0=81=E9=80=BB?=
=?UTF-8?q?=E8=BE=91?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
astrbot/core/config/astrbot_config.py | 1 +
astrbot/dashboard/routes/auth.py | 2 +
astrbot/dashboard/routes/stat.py | 24 +-
dashboard/src/components/shared/Logo.vue | 16 +-
.../full/vertical-header/VerticalHeader.vue | 215 ++++++++++++++----
.../authentication/authForms/AuthLogin.vue | 6 +-
6 files changed, 205 insertions(+), 59 deletions(-)
diff --git a/astrbot/core/config/astrbot_config.py b/astrbot/core/config/astrbot_config.py
index 98794c9dd..3f97bf333 100644
--- a/astrbot/core/config/astrbot_config.py
+++ b/astrbot/core/config/astrbot_config.py
@@ -43,6 +43,7 @@ class AstrBotConfig(dict):
"""不存在时载入默认配置"""
with open(config_path, "w", encoding="utf-8-sig") as f:
json.dump(default_config, f, indent=4, ensure_ascii=False)
+ object.__setattr__(self, "first_deploy", True) # 标记第一次部署
with open(config_path, "r", encoding="utf-8-sig") as f:
conf_str = f.read()
diff --git a/astrbot/dashboard/routes/auth.py b/astrbot/dashboard/routes/auth.py
index 5ce578305..639adb709 100644
--- a/astrbot/dashboard/routes/auth.py
+++ b/astrbot/dashboard/routes/auth.py
@@ -1,5 +1,6 @@
import jwt
import datetime
+import asyncio
from .route import Route, Response, RouteContext
from quart import request
from astrbot.core import WEBUI_SK, DEMO_MODE
@@ -41,6 +42,7 @@ class AuthRoute(Route):
.__dict__
)
else:
+ await asyncio.sleep(3)
return Response().error("用户名或密码错误").__dict__
async def edit_account(self):
diff --git a/astrbot/dashboard/routes/stat.py b/astrbot/dashboard/routes/stat.py
index b216d3d14..65b77e06c 100644
--- a/astrbot/dashboard/routes/stat.py
+++ b/astrbot/dashboard/routes/stat.py
@@ -46,11 +46,27 @@ class StatRoute(Route):
h, m = divmod(m, 60)
return f"{h}小时{m}分{s}秒"
+ def is_default_cred(self):
+ username = self.config["dashboard"]["username"]
+ password = self.config["dashboard"]["password"]
+ return (
+ username == "astrbot"
+ and password == "77b90590a8945a7d36c963981a307dc9"
+ and not DEMO_MODE
+ )
+
async def get_version(self):
- return Response().ok({
- "version": VERSION,
- "dashboard_version": await get_dashboard_version(),
- }).__dict__
+ return (
+ Response()
+ .ok(
+ {
+ "version": VERSION,
+ "dashboard_version": await get_dashboard_version(),
+ "change_pwd_hint": self.is_default_cred(),
+ }
+ )
+ .__dict__
+ )
async def get_start_time(self):
return Response().ok({"start_time": self.core_lifecycle.start_time}).__dict__
diff --git a/dashboard/src/components/shared/Logo.vue b/dashboard/src/components/shared/Logo.vue
index db3e6cc66..2b77ccefa 100644
--- a/dashboard/src/components/shared/Logo.vue
+++ b/dashboard/src/components/shared/Logo.vue
@@ -5,18 +5,25 @@