From 86284968817902c08a6611b76814100b4447c757 Mon Sep 17 00:00:00 2001 From: Deeman Date: Thu, 26 Feb 2026 02:52:45 +0100 Subject: [PATCH] feat(dev): open browser automatically on dev server ready MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- web/scripts/dev_run.sh | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/web/scripts/dev_run.sh b/web/scripts/dev_run.sh index df3d11f..dbfefa1 100644 --- a/web/scripts/dev_run.sh +++ b/web/scripts/dev_run.sh @@ -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_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