From 1d94a92936abb3d37a8f9bfb36c8850246fee15d Mon Sep 17 00:00:00 2001 From: Christophe Besson Date: Mon, 5 Oct 2026 12:23:18 +0200 Subject: feat: copy a file's or folder's #/name@owner link from Files, Music, Photos and Search MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit "Copy link" puts the address group-link.js resolves on the clipboard, on the hub's origin rather than the page's, so a link copied in the desktop application is not app://meshbay. Files offers it for one row, from the right-click menu or the toolbar with one row ticked (a phone's way in); Music on one track's menu, whose dots a phone has; Photos on a right-clicked tile and in the lightbox's bar. The video player and the file preview carry a link button next to Download. Applications get a `linkFor(entry | folderPath)` prop (MESHBAY_DESIGN.md §9.2) and offer the action only when it names a link. The group page builds it from the hub's row; Search from each result's own group and its path before the merged views prefixed it, and names no link for a folder of the merged tree, which a group name alone does not identify. harness/copy_link_probe.py mounts the three applications in Chrome and reads what reached the clipboard. Co-Authored-By: Claude Opus 5.5 --- packages/meshbay-hub/src/meshbay_hub/static/music-app.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'packages/meshbay-hub/src/meshbay_hub/static/music-app.js') diff --git a/packages/meshbay-hub/src/meshbay_hub/static/music-app.js b/packages/meshbay-hub/src/meshbay_hub/static/music-app.js index f2c4374..9adb1e1 100644 --- a/packages/meshbay-hub/src/meshbay_hub/static/music-app.js +++ b/packages/meshbay-hub/src/meshbay_hub/static/music-app.js @@ -11,6 +11,7 @@ import { Menu, MenuDots, useMenu } from './menu.js'; import { PlaylistMenuButton, NameModal, usePlaylists } from './playlist-menu.js'; import * as P from './playlists.js'; import { CastButton } from './cast-session.js'; +import { copyLink } from './copy-link.js'; // -- Music -------------------------------------------------------------------- // @@ -564,7 +565,7 @@ function FlatList({ items, onPlayQueue, onMenu }) { function MusicApp({ groupId, transportRef, gekRef, status, entries, availableEntries, musicDirectories, musicbrainzConfig, onPlayQueue, userId, - hideFilter, userPrefs, pageResetKey, + hideFilter, userPrefs, pageResetKey, linkFor, }) { const [mode, setMode] = useState(loadViewMode); const [filter, setFilter] = useState(''); @@ -618,6 +619,9 @@ function MusicApp({ // argument slot for one. const onMenu = useCallback((e, tracks, startIndex) => { if (!tracks || !tracks.length) return; + // One track's menu — a row's, whose dots are how a phone opens it. An + // album's carries all its tracks and gets no link: Files has the folder's. + const link = tracks.length === 1 && linkFor ? linkFor(tracks[0]) : null; openAt(e, [ { label: t('music.menu_play'), icon: 'play', onSelect: () => onPlayQueue(tracks, startIndex || 0) }, @@ -650,8 +654,10 @@ function MusicApp({ }, ], }, + ...(link ? [{ divider: true }, + { label: t('link.copy'), icon: 'link', onSelect: () => copyLink(link) }] : []), ]); - }, [openAt, onPlayQueue, playlists, addToPlaylist]); + }, [openAt, onPlayQueue, playlists, addToPlaylist, linkFor]); useEffect(() => { setMode(loadViewMode()); }, [groupId]); useEffect(() => { setFilter(''); }, [groupId]); -- cgit v1.2.3