From fb202b4edf8e2125e54a7e5c287444f2f4dddbec Mon Sep 17 00:00:00 2001 From: Davide Scaini Date: Thu, 9 Apr 2026 13:16:00 +0200 Subject: [PATCH] =?UTF-8?q?=20Record=20/=20Convert=20tabs=20=E2=80=94=20no?= =?UTF-8?q?w=20gated=20behind=20PUBLIC=5FMOBILE=5FAPP=3Dtrue.=20Hidden=20b?= =?UTF-8?q?y=20default=20in=20VPS/dev=20mode;=20only=20show=20when=20expli?= =?UTF-8?q?citly=20opted=20into=20the=20mobile=20app=20build.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Edit/Upload UI — split into two concepts: - PUBLIC_EDIT_URL — the server base URL (empty = use proxy at /api/) - PUBLIC_EDIT_ENABLED=true — whether to show the edit/upload buttons at all bincio dev now sets PUBLIC_EDIT_ENABLED=true when instance.db exists (multi-user mode), so the upload button, edit button, and edit drawer all appear. The fetch calls already produce correct relative URLs (${''}/api/upload = /api/upload) which the Vite proxy forwards to bincio serve. --- bincio/dev.py | 6 ++++-- site/src/components/ActivityDetail.svelte | 7 ++++--- site/src/components/EditDrawer.svelte | 1 + site/src/layouts/Base.astro | 18 +++++++++++++----- 4 files changed, 22 insertions(+), 10 deletions(-) diff --git a/bincio/dev.py b/bincio/dev.py index 8bf87fd..24b5292 100644 --- a/bincio/dev.py +++ b/bincio/dev.py @@ -148,8 +148,10 @@ def dev( env = { **os.environ, "BINCIO_DATA_DIR": str(data), - "PUBLIC_EDIT_URL": "", # empty = proxy /api/* to bincio serve - "VITE_API_PORT": str(api_port), # picked up by astro.config.mjs if needed + "PUBLIC_EDIT_URL": "", # empty = proxy /api/* to bincio serve + "PUBLIC_EDIT_ENABLED": "true" if has_auth else "", # show edit/upload UI in VPS mode + "PUBLIC_MOBILE_APP": "", # Record/Convert tabs off by default + "VITE_API_PORT": str(api_port), # picked up by astro.config.mjs } # Start astro dev in foreground (Ctrl+C stops everything) diff --git a/site/src/components/ActivityDetail.svelte b/site/src/components/ActivityDetail.svelte index e5cfd1f..ea242f8 100644 --- a/site/src/components/ActivityDetail.svelte +++ b/site/src/components/ActivityDetail.svelte @@ -13,7 +13,8 @@ export let base: string = '/'; export let athlete: AthleteZones | null = null; - const editUrl = import.meta.env.PUBLIC_EDIT_URL; + const editUrl = import.meta.env.PUBLIC_EDIT_URL ?? ''; + const editEnabled = editUrl !== '' || import.meta.env.PUBLIC_EDIT_ENABLED === 'true'; let detail: ActivityDetail | null = null; let error = ''; @@ -89,7 +90,7 @@ -{#if editOpen && editUrl} +{#if editOpen && editEnabled} editOpen = false} /> {/if} @@ -176,7 +177,7 @@

{displayTitle}

- {#if editUrl} + {#if editEnabled} - {editUrl && ( + {editEnabled && (