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} editOpen = true} diff --git a/site/src/components/EditDrawer.svelte b/site/src/components/EditDrawer.svelte index e2ba5c5..9397030 100644 --- a/site/src/components/EditDrawer.svelte +++ b/site/src/components/EditDrawer.svelte @@ -36,6 +36,7 @@ let uploading = false; let fileInput: HTMLInputElement; + // editUrl is empty in multi-user VPS mode — the Vite proxy forwards /api/* to bincio serve. const api = `${editUrl}/api/activity/${activityId}`; async function load() { diff --git a/site/src/layouts/Base.astro b/site/src/layouts/Base.astro index 1404660..7439464 100644 --- a/site/src/layouts/Base.astro +++ b/site/src/layouts/Base.astro @@ -10,6 +10,10 @@ interface Props { } const { title = 'BincioActivity', description = 'Your personal activity stats', public: isPublicPage = false } = Astro.props; const editUrl = import.meta.env.PUBLIC_EDIT_URL ?? ''; +// Edit UI is enabled when PUBLIC_EDIT_URL is set (single-user bincio-edit mode) +// OR when PUBLIC_EDIT_ENABLED=true (multi-user VPS mode — API proxied at /api/). +const editEnabled = editUrl !== '' || import.meta.env.PUBLIC_EDIT_ENABLED === 'true'; +const mobileApp = import.meta.env.PUBLIC_MOBILE_APP === 'true'; const baseUrl = import.meta.env.BASE_URL ?? '/'; // Read root index.json at build time to detect instance configuration. @@ -163,8 +167,12 @@ try { Stats Athlete - Record - Convert + {mobileApp && ( + Record + )} + {mobileApp && ( + Convert + )} @@ -174,7 +182,7 @@ try { class="text-xs text-zinc-500 hover:text-white transition-colors px-2 h-8" aria-label="Log out" >Log out - {editUrl && ( + {editEnabled && ( - {editUrl && ( + {editEnabled && ( )} - {editUrl && ( + {editEnabled && (