fix image

This commit is contained in:
Davide Scaini
2026-04-09 13:39:44 +02:00
parent 5a29259259
commit bf95097d75
2 changed files with 50 additions and 32 deletions
+11 -1
View File
@@ -70,7 +70,17 @@
return DOMPurify.sanitize(marked(rawDescription, { renderer }) as string); return DOMPurify.sanitize(marked(rawDescription, { renderer }) as string);
})(); })();
$: imageBase = `${base}data/activities/images/${activity.id}/`; // Derive image dir from detail_url so multi-user paths resolve correctly.
// "dave/_merged/activities/foo.json" → "/data/dave/_merged/activities/images/{id}/"
$: imageBase = (() => {
const du = activity.detail_url ?? '';
const dir = du.startsWith('http')
? du.substring(0, du.lastIndexOf('/') + 1)
: du.includes('/')
? `${base}data/${du.substring(0, du.lastIndexOf('/') + 1)}`
: `${base}data/activities/`;
return `${dir}images/${activity.id}/`;
})();
$: galleryImages = (detail?.custom as any)?.images as string[] ?? []; $: galleryImages = (detail?.custom as any)?.images as string[] ?? [];
+39 -31
View File
@@ -155,40 +155,48 @@ try {
<a href={baseUrl} class="font-bold text-white tracking-tight hover:text-[--accent] transition-colors"> <a href={baseUrl} class="font-bold text-white tracking-tight hover:text-[--accent] transition-colors">
Bincio<span class="text-[--accent]">Activity</span> Bincio<span class="text-[--accent]">Activity</span>
</a> </a>
<!-- Feed tab: only shown for multi-user (more than one shard) --> {!isPublicPage && (
{!singleHandle && ( <>
<a href={baseUrl} class="text-sm text-zinc-400 hover:text-white transition-colors">Feed</a> <!-- Feed tab: only shown for multi-user (more than one shard) -->
)} {!singleHandle && (
<!-- Single-user: static handle link. Multi-user: populated by user-widget script. --> <a href={baseUrl} class="text-sm text-zinc-400 hover:text-white transition-colors">Feed</a>
{singleHandle )}
? <a href={`${baseUrl}u/${singleHandle}/`} class="text-sm text-zinc-400 hover:text-white transition-colors">@{singleHandle}</a> <!-- Single-user: static handle link. Multi-user: populated by user-widget script. -->
: <a id="nav-me" href="#" style="display:none" class="text-sm text-[--accent] hover:text-white transition-colors"></a> {singleHandle
} ? <a href={`${baseUrl}u/${singleHandle}/`} class="text-sm text-zinc-400 hover:text-white transition-colors">@{singleHandle}</a>
<!-- Per-user nav links — updated by user-widget script in multi-user mode --> : <a id="nav-me" href="#" style="display:none" class="text-sm text-[--accent] hover:text-white transition-colors"></a>
<a id="nav-stats" href={singleHandle ? `${baseUrl}u/${singleHandle}/stats/` : `${baseUrl}stats/`} data-user-path="stats/" class="text-sm text-zinc-400 hover:text-white transition-colors">Stats</a> }
<a id="nav-athlete" href={singleHandle ? `${baseUrl}u/${singleHandle}/athlete/` : `${baseUrl}athlete/`} data-user-path="athlete/" class="text-sm text-zinc-400 hover:text-white transition-colors">Athlete</a> <!-- Per-user nav links — updated by user-widget script in multi-user mode -->
{mobileApp && ( <a id="nav-stats" href={singleHandle ? `${baseUrl}u/${singleHandle}/stats/` : `${baseUrl}stats/`} data-user-path="stats/" class="text-sm text-zinc-400 hover:text-white transition-colors">Stats</a>
<a id="nav-record" href={singleHandle ? `${baseUrl}u/${singleHandle}/record/` : `${baseUrl}record/`} data-user-path="record/" class="text-sm text-zinc-400 hover:text-white transition-colors">Record</a> <a id="nav-athlete" href={singleHandle ? `${baseUrl}u/${singleHandle}/athlete/` : `${baseUrl}athlete/`} data-user-path="athlete/" class="text-sm text-zinc-400 hover:text-white transition-colors">Athlete</a>
)} {mobileApp && (
{mobileApp && ( <a id="nav-record" href={singleHandle ? `${baseUrl}u/${singleHandle}/record/` : `${baseUrl}record/`} data-user-path="record/" class="text-sm text-zinc-400 hover:text-white transition-colors">Record</a>
<a href={`${baseUrl}convert/`} class="text-sm text-zinc-400 hover:text-white transition-colors">Convert</a> )}
{mobileApp && (
<a href={`${baseUrl}convert/`} class="text-sm text-zinc-400 hover:text-white transition-colors">Convert</a>
)}
</>
)} )}
<div class="ml-auto flex items-center gap-1"> <div class="ml-auto flex items-center gap-1">
<!-- Logout button — hidden until logged in --> {!isPublicPage && (
<button <>
id="nav-logout" <!-- Logout button — hidden until logged in -->
style="display:none" <button
class="text-xs text-zinc-500 hover:text-white transition-colors px-2 h-8" id="nav-logout"
aria-label="Log out" style="display:none"
>Log out</button> class="text-xs text-zinc-500 hover:text-white transition-colors px-2 h-8"
{editEnabled && ( aria-label="Log out"
<button >Log out</button>
id="upload-btn" {editEnabled && (
class="text-zinc-400 hover:text-white transition-colors w-8 h-8 flex items-center justify-center rounded-md hover:bg-zinc-800 text-base" <button
aria-label="Upload activity" id="upload-btn"
title="Upload activity" class="text-zinc-400 hover:text-white transition-colors w-8 h-8 flex items-center justify-center rounded-md hover:bg-zinc-800 text-base"
>↑</button> aria-label="Upload activity"
title="Upload activity"
>↑</button>
)}
</>
)} )}
<button <button
id="theme-toggle" id="theme-toggle"