Update astrbot/dashboard/server.py

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
LIghtJUNction
2026-02-09 00:21:37 +08:00
committed by GitHub
parent 31f46045d7
commit af09b5cb16
+7 -3
View File
@@ -313,9 +313,13 @@ class AstrBotDashboard:
port,
)
if self.check_port_in_use("127.0.0.1", port):
info = self.get_process_using_port(port)
raise RuntimeError(f"端口 {port} 已被占用\n{info}")
check_hosts = {host}
if host not in ("127.0.0.1", "localhost", "::1"):
check_hosts.add("127.0.0.1")
for check_host in check_hosts:
if self.check_port_in_use(check_host, port):
info = self.get_process_using_port(port)
raise RuntimeError(f"端口 {port} 已被占用\n{info}")
if self.enable_webui:
self._print_access_urls(host, port)