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[] ?? [];
+8
View File
@@ -155,6 +155,8 @@ 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>
{!isPublicPage && (
<>
<!-- Feed tab: only shown for multi-user (more than one shard) --> <!-- Feed tab: only shown for multi-user (more than one shard) -->
{!singleHandle && ( {!singleHandle && (
<a href={baseUrl} class="text-sm text-zinc-400 hover:text-white transition-colors">Feed</a> <a href={baseUrl} class="text-sm text-zinc-400 hover:text-white transition-colors">Feed</a>
@@ -173,8 +175,12 @@ try {
{mobileApp && ( {mobileApp && (
<a href={`${baseUrl}convert/`} class="text-sm text-zinc-400 hover:text-white transition-colors">Convert</a> <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">
{!isPublicPage && (
<>
<!-- Logout button — hidden until logged in --> <!-- Logout button — hidden until logged in -->
<button <button
id="nav-logout" id="nav-logout"
@@ -190,6 +196,8 @@ try {
title="Upload activity" title="Upload activity"
>↑</button> >↑</button>
)} )}
</>
)}
<button <button
id="theme-toggle" id="theme-toggle"
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" 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"