From 59c2b8c693281692e69f5458339f5cd32c2927f3 Mon Sep 17 00:00:00 2001 From: BlackSigkill Date: Fri, 6 Feb 2026 14:27:40 +0100 Subject: [PATCH] fix copy-link action menu --- js/events.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/js/events.js b/js/events.js index 6f29b67..5850e4c 100644 --- a/js/events.js +++ b/js/events.js @@ -1057,7 +1057,13 @@ export async function handleTrackAction( navigate(`/album/${item.album.id}`); } } else if (action === 'copy-link' || action === 'share') { - const url = `${window.location.origin}/track/${item.id}`; + // Use stored href from card if available, otherwise construct URL + const contextMenu = document.getElementById('context-menu'); + const storedHref = contextMenu?._contextHref; + const url = storedHref + ? `${window.location.origin}${storedHref}` + : `${window.location.origin}/track/${item.id || item.uuid}`; + navigator.clipboard.writeText(url).then(() => { showNotification('Link copied to clipboard!'); }); @@ -1481,6 +1487,7 @@ export function initializeTrackInteractions(player, api, mainContent, contextMen contextTrack = item; contextMenu._contextTrack = item; contextMenu._contextType = type.replace('userplaylist', 'user-playlist'); + contextMenu._contextHref = card.dataset.href; await updateContextMenuLikeState(contextMenu, item); positionMenu(contextMenu, e.pageX, e.pageY);