feat(dev): open browser automatically on dev server ready
Polls /auth/dev-login until the app responds, then opens an incognito/private window — same pattern as padelnomics. Tries flatpak Chrome → flatpak Firefox → system Chrome → Chromium → Firefox in that order. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -165,4 +165,27 @@ run_with_label "$COLOR_APP" "app " uv run --package beanflows python -m bea
|
|||||||
run_with_label "$COLOR_WORKER" "worker" uv run --package beanflows python -m beanflows.worker
|
run_with_label "$COLOR_WORKER" "worker" uv run --package beanflows python -m beanflows.worker
|
||||||
run_with_label "$COLOR_CSS" "css " make css-watch
|
run_with_label "$COLOR_CSS" "css " make css-watch
|
||||||
|
|
||||||
|
# Open a private/incognito browser window once the server is ready.
|
||||||
|
# Polls /auth/dev-login until it responds (up to 10 seconds), then launches.
|
||||||
|
(
|
||||||
|
DEV_URL="http://localhost:5001/auth/dev-login?email=pro@beanflows.coffee"
|
||||||
|
for i in $(seq 1 20); do
|
||||||
|
sleep 0.5
|
||||||
|
if curl -s -o /dev/null -w "%{http_code}" "$DEV_URL" 2>/dev/null | grep -qE "^[23]"; then
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
if flatpak info com.google.Chrome >/dev/null 2>&1; then
|
||||||
|
flatpak run com.google.Chrome --incognito "$DEV_URL" &>/dev/null &
|
||||||
|
elif flatpak info org.mozilla.firefox >/dev/null 2>&1; then
|
||||||
|
flatpak run org.mozilla.firefox --private-window "$DEV_URL" &>/dev/null &
|
||||||
|
elif command -v google-chrome >/dev/null 2>&1; then
|
||||||
|
google-chrome --incognito "$DEV_URL" &>/dev/null &
|
||||||
|
elif command -v chromium >/dev/null 2>&1; then
|
||||||
|
chromium --incognito "$DEV_URL" &>/dev/null &
|
||||||
|
elif command -v firefox >/dev/null 2>&1; then
|
||||||
|
firefox --private-window "$DEV_URL" &>/dev/null &
|
||||||
|
fi
|
||||||
|
) &
|
||||||
|
|
||||||
wait
|
wait
|
||||||
|
|||||||
Reference in New Issue
Block a user