fix(hub): activity card links to /u/{handle}/ when same origin to avoid hub loop

This commit is contained in:
Davide Scaini
2026-05-01 22:07:01 +02:00
parent 1f11bee730
commit 0ab62aa961
+8 -2
View File
@@ -113,8 +113,14 @@ const singleHandle = isSingleUser ? shards[0].handle : null;
appsDiv.style.display = ''; appsDiv.style.display = '';
greeting.textContent = `Ciao, ${user.display_name || user.handle}.`; greeting.textContent = `Ciao, ${user.display_name || user.handle}.`;
cardsDiv.innerHTML = ''; cardsDiv.innerHTML = '';
if (user.activity_access && activityUrl) if (user.activity_access && activityUrl) {
cardsDiv.appendChild(appCard('BincioActivity', 'Tracks, strade e numeri', activityUrl)); // If activityUrl is the same origin (dev --hub mode), go to the user page
// directly so we don't loop back to the hub root.
const activityHref = activityUrl === window.location.origin
? `${activityUrl}/u/${user.handle}/`
: activityUrl;
cardsDiv.appendChild(appCard('BincioActivity', 'Tracks, strade e numeri', activityHref));
}
if (user.wiki_access && wikiUrl) if (user.wiki_access && wikiUrl)
cardsDiv.appendChild(appCard('BincioWiki', 'La memoria collettiva del gruppo', wikiUrl)); cardsDiv.appendChild(appCard('BincioWiki', 'La memoria collettiva del gruppo', wikiUrl));
} }