diff --git a/misc/filebrowser.sh b/misc/filebrowser.sh index 9c66b0b..f98cd4f 100644 --- a/misc/filebrowser.sh +++ b/misc/filebrowser.sh @@ -29,9 +29,13 @@ INSTALL_PATH="/usr/local/bin/filebrowser" DB_PATH="/usr/local/community-scripts/filebrowser.db" DEFAULT_PORT=8080 -# Get first non-loopback IP -IP=$(hostname -I | awk '{print $1}') -[[ -z "$IP" ]] && IP="127.0.0.1" # Fallback auf localhost, falls keine IP gefunden wird +# Get first non-loopback IP & Detect primary network interface dynamically +IFACE=$(ip -4 route | awk '/default/ {print $5; exit}') +IP=$(ip -4 addr show "$IFACE" | awk '/inet / {print $2}' | cut -d/ -f1 | head -n 1) + +[[ -z "$IP" ]] && IP=$(hostname -I | awk '{print $1}') +[[ -z "$IP" ]] && IP="127.0.0.1" + # Detect OS if [[ -f "/etc/alpine-release" ]]; then