#!/usr/bin/env bash # Start the standalone demo client page for LAN access. # Backend must be running first: cd backend && docker compose up -d --build # Usage: ./start.sh [port] set -euo pipefail ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" cd "$ROOT" PORT="${1:-${DEMO_PORT:-38081}}" HOST="${DEMO_HOST:-0.0.0.0}" API_PORT="${API_PORT:-38080}" LAN_IP="$(python3 - <<'PY' import socket s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) try: s.connect(("8.8.8.8", 80)) print(s.getsockname()[0]) except OSError: print("") finally: s.close() PY )" echo "Demo client listening on ${HOST}:${PORT}" echo "Local: http://127.0.0.1:${PORT}/" if [[ -n "${LAN_IP}" && ( "${HOST}" == "0.0.0.0" || "${HOST}" == "::" ) ]]; then echo "LAN: http://${LAN_IP}:${PORT}/" echo "Base URL: http://${LAN_IP}:${API_PORT}" fi exec python3 server.py --host "$HOST" -p "$PORT"