fix: apply configuration option to enable/disable WebUI in AstrBotDashboard (#3152)

This commit is contained in:
Soulter
2025-10-26 17:29:04 +08:00
committed by GitHub
parent 7e5592dd32
commit 51246ea31b
2 changed files with 11 additions and 3 deletions
+6 -3
View File
@@ -41,10 +41,13 @@ class InitialLoader:
self.dashboard_server = AstrBotDashboard(
core_lifecycle, self.db, core_lifecycle.dashboard_shutdown_event, webui_dir
)
task = asyncio.gather(
core_task, self.dashboard_server.run()
) # 启动核心任务和仪表板服务器
coro = self.dashboard_server.run()
if coro:
# 启动核心任务和仪表板服务器
task = asyncio.gather(core_task, coro)
else:
task = core_task
try:
await task # 整个AstrBot在这里运行
except asyncio.CancelledError:
+5
View File
@@ -178,6 +178,11 @@ class AstrBotDashboard:
else:
port = self.core_lifecycle.astrbot_config["dashboard"].get("port", 6185)
host = self.core_lifecycle.astrbot_config["dashboard"].get("host", "0.0.0.0")
enable = self.core_lifecycle.astrbot_config["dashboard"].get("enable", True)
if not enable:
logger.info("WebUI 已被禁用")
return
logger.info(f"正在启动 WebUI, 监听地址: http://{host}:{port}")