From e64315f68d5d4ad8040643035068dd494340655f Mon Sep 17 00:00:00 2001 From: ZTatman Date: Mon, 5 Oct 2026 15:58:47 -0400 Subject: [PATCH] fix(setup): pre-fill public base URL and require it in the wizard An empty firebreak_public_base_url only works while the person filling in the wizard happens to be browsing the same origin Forgejo redirects back to, so it can look fine during local setup and still be wrong in production. It also leaves share URLs relative, since there is no externally resolvable origin to build them from. The setup page already derived the request's base URL to display the OAuth callback hint, but persisted "" instead, so the field and the hint could disagree. Pass the derived value through as the field's value and mark the input required, dropping the hint that told users to leave it blank on localhost. --- web/app/routers/setup.py | 8 +++++--- web/app/templates/setup.html | 7 ++++--- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/web/app/routers/setup.py b/web/app/routers/setup.py index 8dc0124..37da3a3 100644 --- a/web/app/routers/setup.py +++ b/web/app/routers/setup.py @@ -61,9 +61,11 @@ async def setup_page( "reconfiguring": existing is not None and has_users, "forgejo_base_url": existing.forgejo_base_url if existing else "", "forgejo_oauth_client_id": existing.forgejo_oauth_client_id if existing else "", - "firebreak_public_base_url": existing.firebreak_public_base_url - if existing - else "", + # Pre-fill with the request's own base URL so the field is never + # accidentally left blank: an empty value only works while the caller + # is browsing the same origin that Forgejo redirects back to, and any + # generated share link needs an externally resolvable address. + "firebreak_public_base_url": public_base, "oauth_callback_url": f"{public_base}/auth/callback/forgejo", } return templates.TemplateResponse(request, "setup.html", ctx) diff --git a/web/app/templates/setup.html b/web/app/templates/setup.html index e1fbdd6..a2b1a93 100644 --- a/web/app/templates/setup.html +++ b/web/app/templates/setup.html @@ -112,16 +112,17 @@

- Your production domain for OAuth redirects. Leave blank on localhost — Firebreak will use http://localhost:8000 automatically. + The address Forgejo redirects back to after sign-in, and the origin + share links point at. Pre-filled from how you reached this page + — change it to your real domain once Firebreak is deployed.