Commit 0c6460f5 authored by 郭阔's avatar 郭阔

feat(panel): configurable bind address for LAN access

app.py honors WEB_HOST/WEB_PORT env (default 127.0.0.1:8080); run-web.sh
template exports them from web.conf — set WEB_HOST=0.0.0.0 to reach the
panel from other systems on the same network (HTTP + Basic Auth, intranet
use intended).
parent eb56fa8e
...@@ -166,7 +166,7 @@ if [ "$WITH_WEB" = "1" ]; then ...@@ -166,7 +166,7 @@ if [ "$WITH_WEB" = "1" ]; then
set -euo pipefail set -euo pipefail
export PATH="/opt/homebrew/bin:/usr/local/bin:\$PATH" export PATH="/opt/homebrew/bin:/usr/local/bin:\$PATH"
set +u; source "$CONF_DIR/web.conf"; set -u set +u; source "$CONF_DIR/web.conf"; set -u
export WEB_USER="\${WEB_USER:-admin}" WEB_PASS="\${WEB_PASS:?}" export WEB_USER="\${WEB_USER:-admin}" WEB_PASS="\${WEB_PASS:?}" WEB_HOST="\${WEB_HOST:-127.0.0.1}" WEB_PORT="\${WEB_PORT:-8080}"
export SYSTEMD_DIR="$HOME/Library/LaunchAgents" CONF_DIR="$CONF_DIR" WORK_DIR="$WORK_DIR" LOG_DIR="$LOG_DIR" export SYSTEMD_DIR="$HOME/Library/LaunchAgents" CONF_DIR="$CONF_DIR" WORK_DIR="$WORK_DIR" LOG_DIR="$LOG_DIR"
exec "$WORK_DIR/web-venv/bin/python" "$SCRIPT_DIR/../web/app.py" exec "$WORK_DIR/web-venv/bin/python" "$SCRIPT_DIR/../web/app.py"
EOF EOF
......
...@@ -1369,4 +1369,7 @@ def provider_delete(name): ...@@ -1369,4 +1369,7 @@ def provider_delete(name):
if __name__ == "__main__": if __name__ == "__main__":
app.run(host="127.0.0.1", port=8080, debug=False) # WEB_HOST 默认 127.0.0.1(仅本机);设 0.0.0.0 可供同网段其他系统访问
# (HTTP+Basic Auth 明文,仅建议内网使用)。WEB_PORT 默认 8080。
app.run(host=os.environ.get("WEB_HOST", "127.0.0.1"),
port=int(os.environ.get("WEB_PORT", "8080")), debug=False)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment