From a4833d13303f894044648577e4a321328a3b9fbb Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Wed, 29 Apr 2026 13:00:34 +0100 Subject: [PATCH] Simplify landing auth actions --- src/repixelizer/gui.py | 40 ++++++---------------- src/repixelizer/gui_static/landing.html | 45 ++++--------------------- tests/test_gui.py | 4 +++ 3 files changed, 20 insertions(+), 69 deletions(-) diff --git a/src/repixelizer/gui.py b/src/repixelizer/gui.py index eb39855..b89e928 100644 --- a/src/repixelizer/gui.py +++ b/src/repixelizer/gui.py @@ -886,11 +886,9 @@ def _landing_page_html( } auth_enabled = bool(auth_payload.get("enabled")) authenticated = bool(subject_payload.get("authenticated")) - primary_href = "/app/" if authenticated or not auth_enabled else "#auth" - primary_label = "Continue to the demo" if authenticated else ("Sign in to the demo" if auth_enabled else "Open the demo") providers = auth_payload.get("providers") if isinstance(auth_payload.get("providers"), list) else [] - provider_button_html = "" - if auth_enabled and not authenticated: + header_actions_html = "" + if auth_enabled and not authenticated and providers: fragments = [] for provider in providers: if not isinstance(provider, dict): @@ -904,42 +902,24 @@ def _landing_page_html( fragments.append( f'' ) - provider_button_html = "".join(fragments) - hero_note = ( - "Heimdall handles the provider dance, Repixelizer keeps the local verdict, and the browser mostly gets to stop couriering secrets." - if auth_enabled - else "It is not a miracle worker, and it is definitely not here to pretend it invented hand-authored pixel art from nothing." - ) - auth_notice = "" - if auth_enabled and not auth_payload.get("providers"): - auth_notice = ( - '

Auth is enabled here, but no providers are configured yet. ' - "The front door exists, but somebody still owes it an actual key.

" + header_actions_html = "".join(fragments) + elif authenticated: + header_actions_html = ( + 'Continue to the demo' + '' ) - elif auth_enabled: - auth_notice = '

Choose a provider. The main page stays put while Heimdall and the backend sort out the paperwork in another tab.

' - auth_state_text = ( - f"Already authenticated as {subject_payload.get('displayName') or subject_payload.get('accountId') or 'a local creature'}." - if authenticated - else "" - ) + else: + header_actions_html = 'Open the demo' static_dir = _static_dir() styles_path = static_dir / "styles.css" styles_version = int(styles_path.stat().st_mtime_ns) if styles_path.exists() else 0 landing_template = (static_dir / "landing.html").read_text(encoding="utf-8") return ( landing_template.replace("{{STYLES_VERSION}}", str(styles_version)) - .replace("{{HERO_NOTE}}", html.escape(hero_note)) - .replace("{{PRIMARY_HREF}}", html.escape(primary_href, quote=True)) - .replace("{{PRIMARY_LABEL}}", html.escape(primary_label)) - .replace("{{SIGNOUT_HIDDEN}}", "hidden" if not authenticated else "") - .replace("{{AUTH_PROVIDER_BUTTONS}}", provider_button_html) - .replace("{{AUTH_STATE_TEXT}}", html.escape(auth_state_text)) + .replace("{{HEADER_ACTIONS}}", header_actions_html) .replace("{{DEMO_LIMITS}}", html.escape(demo_limits)) - .replace("{{AUTH_NOTICE}}", auth_notice) .replace("{{AUTH_CONFIG_JSON}}", _json_html(auth_payload)) .replace("{{SESSION_SUBJECT_JSON}}", _json_html(subject_payload)) - .replace("{{DEFAULT_PRIMARY_LABEL_JSON}}", _json_html(primary_label)) ) diff --git a/src/repixelizer/gui_static/landing.html b/src/repixelizer/gui_static/landing.html index 17c411a..f5b57e7 100644 --- a/src/repixelizer/gui_static/landing.html +++ b/src/repixelizer/gui_static/landing.html @@ -92,11 +92,6 @@ transform-origin: 42% 63%; } - .landing-auth-strip { - display: grid; - gap: 10px; - } - .landing-header { grid-template-columns: minmax(0, 1.35fr) auto minmax(280px, 0.9fr) minmax(220px, 0.65fr); } @@ -165,13 +160,12 @@

How to enter

-

Start from this page, authenticate if enabled, then continue into the app.

-

The hosted flow is a short handoff, not a separate experience.

-

If auth is disabled, the demo button goes straight to the live workspace.

+

Pick a provider when hosted auth is enabled.

+

Otherwise, go straight to the live workspace.

+

The browser is merely the courier. It should not get ideas.

-
- {{PRIMARY_LABEL}} - +
+ {{HEADER_ACTIONS}}
@@ -208,13 +202,6 @@ Real cells on a real lattice, ready for cleanup or export.
-
-

{{HERO_NOTE}}

-
{{AUTH_PROVIDER_BUTTONS}}
-

- {{AUTH_STATE_TEXT}} -

-
@@ -242,27 +229,20 @@

Self-hosters can still go straight to the app. Hosted mode just gets a front door instead of making everyone trip over raw controls immediately.

- {{AUTH_NOTICE}}