#!/usr/bin/env bash
set -Eeuo pipefail
cd "$(dirname "$0")/site"
PORT="${PORT:-8080}"
printf "Open http://127.0.0.1:%s/\nStop with Ctrl+C.\n" "$PORT"
if command -v xdg-open >/dev/null 2>&1; then (sleep 1; xdg-open "http://127.0.0.1:$PORT/" >/dev/null 2>&1 || true) & fi
exec python3 -m http.server "$PORT" --bind 127.0.0.1
