From edf1145c8144c91308bab94af6d0c89964b6e698 Mon Sep 17 00:00:00 2001 From: bchanot Date: Tue, 13 Oct 2026 21:36:39 +0200 Subject: [PATCH] =?UTF-8?q?chore(supabase):=20LAN=20development=20?= =?UTF-8?q?=E2=80=94=20private-network=20redirect=20URLs=20for=20auth=20li?= =?UTF-8?q?nks,=20pnpm=20dev:lan=20(Vite=20on=200.0.0.0,=20Supabase=20by?= =?UTF-8?q?=20the=20host=20address)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 1 + scripts/dev-lan.sh | 13 +++++++++++++ supabase/config.toml | 5 +++++ 3 files changed, 19 insertions(+) create mode 100755 scripts/dev-lan.sh diff --git a/package.json b/package.json index 54651bfd..b954d381 100644 --- a/package.json +++ b/package.json @@ -11,6 +11,7 @@ }, "scripts": { "dev": "pnpm --filter @faunosteo/app dev", + "dev:lan": "bash scripts/dev-lan.sh", "preview": "pnpm --filter @faunosteo/app preview", "build": "pnpm -r build", "typecheck": "pnpm -r typecheck", diff --git a/scripts/dev-lan.sh b/scripts/dev-lan.sh new file mode 100755 index 00000000..b1cb99cc --- /dev/null +++ b/scripts/dev-lan.sh @@ -0,0 +1,13 @@ +#!/usr/bin/env bash +# Vite dev server reachable from the LAN, wired to the local Supabase stack by the +# host's LAN address (the stack publishes 54321 / 54323 / 54324 on every interface). +# Usage: pnpm dev:lan [host-ip] (default: the first non-loopback IPv4 of this host) +set -euo pipefail +cd "$(dirname "$0")/.." +ip="${1:-$(hostname -I 2>/dev/null | awk '{print $1}')}" +[ -n "$ip" ] || { echo "dev-lan: pass the host IP as the first argument" >&2; exit 1; } +anon="$(node_modules/.bin/supabase status -o env 2>/dev/null | sed -n 's/^ANON_KEY="\(.*\)"$/\1/p')" +[ -n "$anon" ] || { echo "dev-lan: local stack not running (pnpm db:start)" >&2; exit 1; } +echo "== app http://$ip:5173 supabase http://$ip:54321 studio http://$ip:54323 mailpit http://$ip:54324" +VITE_SUPABASE_URL="http://$ip:54321" VITE_SUPABASE_ANON_KEY="$anon" \ + exec node_modules/.bin/pnpm --filter @faunosteo/app exec vite --host 0.0.0.0 --port 5173 diff --git a/supabase/config.toml b/supabase/config.toml index cc16863e..41957600 100644 --- a/supabase/config.toml +++ b/supabase/config.toml @@ -69,11 +69,16 @@ enabled = false enabled = true # Vite dev server of apps/app site_url = "http://127.0.0.1:5173" +# LAN access (pnpm dev:lan): confirmation and recovery links must land on the +# address the browser used, so every private-network host on :5173 is allowed. additional_redirect_urls = [ "http://127.0.0.1:5173", "http://localhost:5173", "http://127.0.0.1:5173/**", "http://localhost:5173/**", + "http://192.168.*.*:5173/**", + "http://10.*.*.*:5173/**", + "http://172.16.*.*:5173/**", ] jwt_expiry = 3600 enable_refresh_token_rotation = true