Skip to content

Commit ab79a87

Browse files
authored
feat: support desktop dashboard listen config (#134)
* fix: allow LAN dashboard access by default * docs: explain manual LAN dashboard access * feat: support desktop dashboard listen config * fix: log invalid desktop dashboard config * refactor: simplify desktop dashboard config parsing * refactor: use cmd config for desktop dashboard listen * fix: ignore blank dashboard env overrides
1 parent 8067943 commit ab79a87

4 files changed

Lines changed: 405 additions & 17 deletions

File tree

README.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,51 @@ If you need to migrate data between the desktop app and a source-based deploymen
9393

9494
Not really. AstrBot Desktop is intended for local desktop usage and personal workflows. If you need long-running, stable server deployment, use the upstream AstrBot source, Docker, or panel-based deployment instead.
9595

96+
<!-- faq: lan-webui-access -->
97+
### How can I access the WebUI from another device on my LAN?
98+
99+
AstrBot Desktop listens on `127.0.0.1:6185` by default, so only the local machine can access the WebUI. If you explicitly want LAN access, set the dashboard host to `0.0.0.0` in AstrBot's command config.
100+
101+
Config file path:
102+
103+
```text
104+
~/.astrbot/data/cmd_config.json
105+
```
106+
107+
On Windows, this is usually:
108+
109+
```text
110+
C:\Users\<username>\.astrbot\data\cmd_config.json
111+
```
112+
113+
Write this content:
114+
115+
```json
116+
{
117+
"dashboard": {
118+
"host": "0.0.0.0",
119+
"port": 6185
120+
}
121+
}
122+
```
123+
124+
Fully quit and restart AstrBot Desktop after saving the file, then visit this URL from another device:
125+
126+
```text
127+
http://<LAN IP of the machine running AstrBot Desktop>:6185/
128+
```
129+
130+
To restore local-only access, set `dashboard.host` back to `127.0.0.1`, then restart the app.
131+
132+
Environment variables still work as advanced overrides and take precedence over `cmd_config.json`:
133+
134+
```bash
135+
ASTRBOT_DASHBOARD_HOST=0.0.0.0
136+
ASTRBOT_DASHBOARD_PORT=6185
137+
```
138+
139+
Before enabling LAN access, make sure your system firewall allows port `6185`, and do not expose the port on untrusted networks or the public internet.
140+
96141
<!-- faq: macos-quarantine -->
97142
### macOS says the app is damaged or cannot be opened
98143

README_zh.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,51 @@ AstrBot Desktop 是面向本地桌面使用的 AstrBot 打包发行版。它内
9393

9494
不推荐。AstrBot Desktop 更适合本地桌面使用和个人工作流体验;如果你要长期稳定运行在服务器上,更建议使用上游 AstrBot 的源码、Docker 或面板部署方式。
9595

96+
<!-- faq: lan-webui-access -->
97+
### 如何从局域网内其他设备访问 WebUI?
98+
99+
桌面端默认只监听 `127.0.0.1:6185`,仅允许本机访问。如果确认需要在同一局域网内访问,可以在 AstrBot 命令配置中把 dashboard host 改为 `0.0.0.0`
100+
101+
配置文件路径:
102+
103+
```text
104+
~/.astrbot/data/cmd_config.json
105+
```
106+
107+
Windows 对应路径通常是:
108+
109+
```text
110+
C:\Users\<用户名>\.astrbot\data\cmd_config.json
111+
```
112+
113+
写入以下内容:
114+
115+
```json
116+
{
117+
"dashboard": {
118+
"host": "0.0.0.0",
119+
"port": 6185
120+
}
121+
}
122+
```
123+
124+
保存后完全退出并重新启动 AstrBot Desktop,然后在其他设备访问:
125+
126+
```text
127+
http://<运行 AstrBot Desktop 的主机内网 IP>:6185/
128+
```
129+
130+
如需恢复默认本机访问,可把 `dashboard.host` 改回 `127.0.0.1` 后重启应用。
131+
132+
环境变量仍可作为高级覆盖项,且优先级高于 `cmd_config.json`
133+
134+
```bash
135+
ASTRBOT_DASHBOARD_HOST=0.0.0.0
136+
ASTRBOT_DASHBOARD_PORT=6185
137+
```
138+
139+
开启局域网访问前,请确认系统防火墙允许端口 `6185`,并不要在不可信网络或公网环境暴露该端口。
140+
96141
<!-- faq: macos-quarantine -->
97142
### macOS 提示“应用已损坏”或无法打开
98143

docs/environment-variables.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,29 @@
5656
| `ASTRBOT_DESKTOP_CLIENT` | 标记桌面客户端环境 | 打包态启动后端时写入 `1` |
5757
| `ASTRBOT_BACKEND_STARTUP_HEARTBEAT_PATH` | 桌面端写给后端启动器的 heartbeat 文件路径 | 打包态默认写到 `ASTRBOT_ROOT/data/backend-startup-heartbeat.json` |
5858

59+
### 局域网访问 WebUI
60+
61+
桌面端默认写入 `DASHBOARD_HOST=127.0.0.1`,因此 WebUI 默认仅允许本机访问。如果需要从同一局域网内的其他设备访问,推荐编辑 AstrBot 命令配置:
62+
63+
```text
64+
~/.astrbot/data/cmd_config.json
65+
```
66+
67+
Windows 对应路径通常为 `C:\Users\<用户名>\.astrbot\data\cmd_config.json`
68+
69+
```json
70+
{
71+
"dashboard": {
72+
"host": "0.0.0.0",
73+
"port": 6185
74+
}
75+
}
76+
```
77+
78+
设置后需要完全退出并重新启动 AstrBot Desktop,再通过 `http://<主机内网 IP>:6185/` 访问。开启前请确认系统防火墙允许端口 `6185`,并避免在不可信网络或公网环境暴露该端口。如需恢复默认本机访问,可将 `dashboard.host` 设回 `127.0.0.1` 后重启应用。
79+
80+
环境变量优先级高于 `cmd_config.json`。如果同时设置了 `ASTRBOT_DASHBOARD_HOST` / `DASHBOARD_HOST``ASTRBOT_DASHBOARD_PORT` / `DASHBOARD_PORT`,桌面端会优先保留环境变量值。
81+
5982
## 4. 发布/CI(GitHub Actions)
6083

6184
| 变量 | 用途 | 默认值/行为 |

0 commit comments

Comments
 (0)