Commit 8d5e0200 authored by Aryan Noshirvnai's avatar Aryan Noshirvnai

Add shared-library search to the Library page

Users could only search their own library - there was no way to find
music already tagged by someone else on Stax. Added a "My Library" /
"Shared" scope toggle that appears while actively searching; switching to
Shared re-runs the query against every user's library via the new
/library/shared/search endpoint. Kept on the Library page rather than a
new tab or folded into Discovery: typing a search is the same action as
the existing owner-scoped one, just widened in scope, while Discovery's
own mental model (ambient/mic-driven identification) is genuinely
different.

Shared results can't be streamed or playlisted directly - every row
belongs to another user - so SharedSongRow claims a real owned copy via
/library/shared/claim before playing or adding to a playlist, reusing the
same "get your own copy, then use it" flow Discovery already has for a
mic hit that turns out to be something someone else has.
Co-Authored-By: 's avatarClaude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019i3NAUkLkHNbsPg5vKfzF9
parent 35ada4a6
Pipeline #1178 failed with stages
in 24 minutes and 22 seconds
...@@ -35,6 +35,31 @@ export function searchLibrary(query: string) { ...@@ -35,6 +35,31 @@ export function searchLibrary(query: string) {
}) })
} }
/** Same title/artist/genre matching as searchLibrary, but across every user's library, not
* just the caller's own - deduped by (title, artist) so a song many different users have all
* separately uploaded doesn't show up once per owner. Songs only, no album groupings - see the
* backend endpoint's own docstring for why merging albums across owners isn't attempted. Every
* returned song belongs to whichever user actually owns that row, not the caller - it can't be
* streamed directly (see PlayerContext/streamUrl); claimSharedSong turns one into the caller's
* own playable copy first. */
export function searchSharedLibrary(query: string) {
return apiFetch<{ status: string; songs: LibrarySong[] }>('/library/shared/search', {
method: 'POST',
form: { query },
})
}
/** Turns a searchSharedLibrary result into something the caller can actually play: their own
* LibrarySong row (a new one reusing the same underlying file, or their existing copy if they
* already have this song) - the same "identify something someone else already has, get your
* own copy" mechanism Discovery uses, just reached by typing a search instead of a mic listen. */
export function claimSharedSong(title: string, artist: string) {
return apiFetch<{ status: string; library_song_id: number }>('/library/shared/claim', {
method: 'POST',
form: { title, artist },
})
}
export interface Album { export interface Album {
album: string album: string
artist: string artist: string
......
import { useState } from 'react'
import { ListPlus, Music2, Play } from 'lucide-react'
import { claimSharedSong, type LibrarySong } from '../api/library'
import { ApiError } from '../api/client'
import { usePlayer, type PlayableSong } from '../context/PlayerContext'
/** A song found via Library's "Shared" search scope - belongs to some other user's library, not
* the caller's, so it can't be streamed or playlisted directly (every stream/playlist endpoint
* is scoped to the caller's own rows). Visually similar to the normal SongRow, but every action
* here claims the song first: the same "get your own copy, then play it" mechanism Discovery
* already uses when an identified song turns out to be something someone else already has,
* just reached by typing a search instead of a mic listen. No swipe actions (queue/delete), no
* now-playing indicator either - both assume a library_song_id the caller already owns, which
* doesn't exist yet here (and won't persist across renders once claimed, so there's nothing
* stable to compare against currentSong with anyway). */
export function SharedSongRow({ song, onAddToPlaylist }: { song: LibrarySong; onAddToPlaylist: (song: { id: number; title: string }) => void }) {
const { toggle } = usePlayer()
const [claiming, setClaiming] = useState<'play' | 'playlist' | null>(null)
const [error, setError] = useState<string | null>(null)
async function claim(): Promise<number> {
const res = await claimSharedSong(song.title, song.artist)
return res.library_song_id
}
async function handlePlay() {
setError(null)
setClaiming('play')
try {
const libraryId = await claim()
const playable: PlayableSong = {
id: libraryId,
title: song.title,
artist: song.artist,
album: song.album,
coverart: song.coverart,
lyrics: song.lyrics,
}
toggle(playable, [playable])
} catch (err) {
setError(err instanceof ApiError ? err.message : `Could not add "${song.title}"`)
} finally {
setClaiming(null)
}
}
async function handleAddToPlaylist() {
setError(null)
setClaiming('playlist')
try {
const libraryId = await claim()
onAddToPlaylist({ id: libraryId, title: song.title })
} catch (err) {
setError(err instanceof ApiError ? err.message : `Could not add "${song.title}"`)
} finally {
setClaiming(null)
}
}
return (
<li className="-mx-1 rounded-xl">
<div className="relative flex items-center gap-1 rounded-xl border border-transparent pr-2 hover:border-outline-variant hover:bg-surface-container">
<button
onClick={handlePlay}
disabled={claiming !== null}
aria-label={`Add and play ${song.title}`}
className="group flex min-w-0 flex-1 items-center gap-4 rounded-lg px-2 py-3 text-left transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary disabled:cursor-not-allowed"
>
<div className="relative h-12 w-12 shrink-0">
{song.coverart ? (
<img src={song.coverart} alt="" loading="lazy" decoding="async" className="h-12 w-12 rounded-lg object-cover" />
) : (
<div className="flex h-12 w-12 items-center justify-center rounded-lg bg-surface-container-high text-on-surface-variant">
<Music2 size={18} strokeWidth={1.75} />
</div>
)}
<span
className={`absolute inset-0 flex items-center justify-center rounded-lg bg-black/50 text-white transition-opacity duration-150 ${
claiming === 'play' ? 'opacity-100' : 'opacity-0 group-hover:opacity-100'
}`}
>
{claiming === 'play' ? (
<span className="h-3.5 w-3.5 animate-spin rounded-full border-2 border-white/40 border-t-white" />
) : (
<Play size={18} strokeWidth={2} fill="currentColor" className="ml-0.5" />
)}
</span>
</div>
<div className="min-w-0 flex-1">
<p className="truncate font-medium text-on-surface group-hover:text-primary">{song.title}</p>
<p className="truncate text-sm text-on-surface-variant">
{song.artist}
{song.album ? ` · ${song.album}` : ''}
</p>
{error && <p className="mt-0.5 truncate text-xs text-error">{error}</p>}
</div>
</button>
<button
onClick={handleAddToPlaylist}
disabled={claiming !== null}
aria-label={`Add ${song.title} to a playlist`}
className="shrink-0 rounded-full p-2 text-on-surface-variant transition-colors hover:bg-surface-container-high hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary disabled:cursor-not-allowed"
>
{claiming === 'playlist' ? (
<span className="block h-[18px] w-[18px] animate-spin rounded-full border-2 border-outline-variant border-t-on-surface" />
) : (
<ListPlus size={18} strokeWidth={1.75} />
)}
</button>
</div>
</li>
)
}
...@@ -229,6 +229,100 @@ describe('Library', () => { ...@@ -229,6 +229,100 @@ describe('Library', () => {
expect(await screen.findByText(/No results for/)).toBeInTheDocument() expect(await screen.findByText(/No results for/)).toBeInTheDocument()
}) })
it('does not show the My Library / Shared toggle outside of a search', async () => {
vi.spyOn(libraryApi, 'getLibrary').mockResolvedValue({ status: 'success', library: [SONG] })
renderLibrary()
await screen.findByText('Invisible')
expect(screen.queryByRole('button', { name: 'Shared' })).not.toBeInTheDocument()
})
it('switching to Shared searches the shared library instead of the caller\'s own', async () => {
vi.spyOn(libraryApi, 'getLibrary').mockResolvedValue({ status: 'success', library: [] })
const searchLibrary = vi.spyOn(libraryApi, 'searchLibrary').mockResolvedValue({ status: 'success', songs: [], albums: [] })
const searchSharedLibrary = vi.spyOn(libraryApi, 'searchSharedLibrary').mockResolvedValue({
status: 'success',
songs: [{ ...SONG, id: 99, user_id: 42, title: 'Someone Else\'s Song' }],
})
renderLibrary()
await userEvent.type(screen.getByPlaceholderText('Search songs and albums'), 'song')
await waitFor(() => expect(searchLibrary).toHaveBeenCalledWith('song'))
await userEvent.click(await screen.findByRole('button', { name: 'Shared' }))
await waitFor(() => expect(searchSharedLibrary).toHaveBeenCalledWith('song'))
expect(await screen.findByText('Someone Else\'s Song')).toBeInTheDocument()
})
it('shows an empty state for a shared search with no matches', async () => {
vi.spyOn(libraryApi, 'getLibrary').mockResolvedValue({ status: 'success', library: [] })
vi.spyOn(libraryApi, 'searchLibrary').mockResolvedValue({ status: 'success', songs: [], albums: [] })
vi.spyOn(libraryApi, 'searchSharedLibrary').mockResolvedValue({ status: 'success', songs: [] })
renderLibrary()
await userEvent.type(screen.getByPlaceholderText('Search songs and albums'), 'nothing')
await userEvent.click(await screen.findByRole('button', { name: 'Shared' }))
expect(await screen.findByText(/No results for "nothing" in the shared library/)).toBeInTheDocument()
})
it('tapping a shared search result claims it, then plays the claimed copy', async () => {
vi.spyOn(libraryApi, 'getLibrary').mockResolvedValue({ status: 'success', library: [] })
vi.spyOn(libraryApi, 'searchLibrary').mockResolvedValue({ status: 'success', songs: [], albums: [] })
vi.spyOn(libraryApi, 'searchSharedLibrary').mockResolvedValue({
status: 'success',
songs: [{ ...SONG, id: 99, user_id: 42, title: 'Someone Else\'s Song' }],
})
const claimSharedSong = vi.spyOn(libraryApi, 'claimSharedSong').mockResolvedValue({ status: 'success', library_song_id: 7 })
const fetchStreamUrl = vi.spyOn(streamApi, 'fetchStreamUrl').mockResolvedValue('blob:fake-url')
renderLibrary()
await userEvent.type(screen.getByPlaceholderText('Search songs and albums'), 'song')
await userEvent.click(await screen.findByRole('button', { name: 'Shared' }))
await userEvent.click(await screen.findByRole('button', { name: /Add and play Someone Else's Song/ }))
await waitFor(() => expect(claimSharedSong).toHaveBeenCalledWith('Someone Else\'s Song', 'Duran Duran'))
await waitFor(() => expect(fetchStreamUrl).toHaveBeenCalledWith(7))
})
it('claims a shared search result before opening the add-to-playlist modal for it', async () => {
vi.spyOn(libraryApi, 'getLibrary').mockResolvedValue({ status: 'success', library: [] })
vi.spyOn(libraryApi, 'searchLibrary').mockResolvedValue({ status: 'success', songs: [], albums: [] })
vi.spyOn(libraryApi, 'searchSharedLibrary').mockResolvedValue({
status: 'success',
songs: [{ ...SONG, id: 99, user_id: 42, title: 'Someone Else\'s Song' }],
})
const claimSharedSong = vi.spyOn(libraryApi, 'claimSharedSong').mockResolvedValue({ status: 'success', library_song_id: 7 })
vi.spyOn(libraryApi, 'getPlaylists').mockResolvedValue({ status: 'success', playlists: [] })
renderLibrary()
await userEvent.type(screen.getByPlaceholderText('Search songs and albums'), 'song')
await userEvent.click(await screen.findByRole('button', { name: 'Shared' }))
await userEvent.click(await screen.findByRole('button', { name: /Add Someone Else's Song to a playlist/ }))
await waitFor(() => expect(claimSharedSong).toHaveBeenCalledWith('Someone Else\'s Song', 'Duran Duran'))
expect(await screen.findByText('Add "Someone Else\'s Song" to playlist')).toBeInTheDocument()
})
it('shows an error on a shared row if claiming fails, without crashing', async () => {
vi.spyOn(libraryApi, 'getLibrary').mockResolvedValue({ status: 'success', library: [] })
vi.spyOn(libraryApi, 'searchLibrary').mockResolvedValue({ status: 'success', songs: [], albums: [] })
vi.spyOn(libraryApi, 'searchSharedLibrary').mockResolvedValue({
status: 'success',
songs: [{ ...SONG, id: 99, user_id: 42, title: 'Someone Else\'s Song' }],
})
vi.spyOn(libraryApi, 'claimSharedSong').mockRejectedValue(new ApiError(404, 'Gone', null))
renderLibrary()
await userEvent.type(screen.getByPlaceholderText('Search songs and albums'), 'song')
await userEvent.click(await screen.findByRole('button', { name: 'Shared' }))
await userEvent.click(await screen.findByRole('button', { name: /Add and play Someone Else's Song/ }))
expect(await screen.findByText('Gone')).toBeInTheDocument()
})
it('clearing the search returns to the full library list', async () => { it('clearing the search returns to the full library list', async () => {
vi.spyOn(libraryApi, 'getLibrary').mockResolvedValue({ status: 'success', library: [SONG] }) vi.spyOn(libraryApi, 'getLibrary').mockResolvedValue({ status: 'success', library: [SONG] })
vi.spyOn(libraryApi, 'searchLibrary').mockResolvedValue({ status: 'success', songs: [], albums: [] }) vi.spyOn(libraryApi, 'searchLibrary').mockResolvedValue({ status: 'success', songs: [], albums: [] })
......
import { useEffect, useMemo, useState } from 'react' import { useEffect, useMemo, useState } from 'react'
import { Music2, Search } from 'lucide-react' import { Globe2, Music2, Search } from 'lucide-react'
import { useNavigate } from 'react-router-dom' import { useNavigate } from 'react-router-dom'
import { deleteLibrarySong, getLibrary, searchLibrary, type AlbumMatch, type LibrarySong } from '../api/library' import {
deleteLibrarySong,
getLibrary,
searchLibrary,
searchSharedLibrary,
type AlbumMatch,
type LibrarySong,
} from '../api/library'
import { ApiError } from '../api/client' import { ApiError } from '../api/client'
import { Layout } from '../components/Layout' import { Layout } from '../components/Layout'
import { AddToPlaylistModal } from '../components/AddToPlaylistModal' import { AddToPlaylistModal } from '../components/AddToPlaylistModal'
import { SongRow } from '../components/SongRow' import { SongRow } from '../components/SongRow'
import { SharedSongRow } from '../components/SharedSongRow'
import { Input } from '../components/ui/Input' import { Input } from '../components/ui/Input'
import { SkeletonRow } from '../components/ui/Skeleton' import { SkeletonRow } from '../components/ui/Skeleton'
import { EmptyState } from '../components/ui/EmptyState' import { EmptyState } from '../components/ui/EmptyState'
...@@ -61,16 +69,24 @@ function AlbumCard({ album, onOpen }: { album: AlbumMatch; onOpen: () => void }) ...@@ -61,16 +69,24 @@ function AlbumCard({ album, onOpen }: { album: AlbumMatch; onOpen: () => void })
) )
} }
type SearchScope = 'mine' | 'shared'
export function Library() { export function Library() {
const navigate = useNavigate() const navigate = useNavigate()
const [songs, setSongs] = useState<LibrarySong[]>([]) const [songs, setSongs] = useState<LibrarySong[]>([])
const [loading, setLoading] = useState(true) const [loading, setLoading] = useState(true)
const [error, setError] = useState<string | null>(null) const [error, setError] = useState<string | null>(null)
const [addingSong, setAddingSong] = useState<LibrarySong | null>(null) // A shared-search result isn't a real LibrarySong the caller owns yet (see SharedSongRow) -
// only {id, title} of the freshly claimed copy exists by the time this gets set, so the type
// here has to accept either shape. AddToPlaylistModal only ever needed that narrower shape
// anyway (see its own prop type).
const [addingSong, setAddingSong] = useState<LibrarySong | { id: number; title: string } | null>(null)
const [deleteError, setDeleteError] = useState<string | null>(null) const [deleteError, setDeleteError] = useState<string | null>(null)
const [query, setQuery] = useState('') const [query, setQuery] = useState('')
const [scope, setScope] = useState<SearchScope>('mine')
const [searchResults, setSearchResults] = useState<{ songs: LibrarySong[]; albums: AlbumMatch[] } | null>(null) const [searchResults, setSearchResults] = useState<{ songs: LibrarySong[]; albums: AlbumMatch[] } | null>(null)
const [sharedResults, setSharedResults] = useState<LibrarySong[] | null>(null)
const [searching, setSearching] = useState(false) const [searching, setSearching] = useState(false)
const albums = useMemo(() => groupIntoAlbums(songs), [songs]) const albums = useMemo(() => groupIntoAlbums(songs), [songs])
...@@ -85,17 +101,28 @@ export function Library() { ...@@ -85,17 +101,28 @@ export function Library() {
useEffect(() => { useEffect(() => {
if (!query.trim()) { if (!query.trim()) {
setSearchResults(null) setSearchResults(null)
setSharedResults(null)
return return
} }
setSearching(true) setSearching(true)
const handle = setTimeout(() => { const handle = setTimeout(() => {
searchLibrary(query.trim()) if (scope === 'shared') {
.then((res) => setSearchResults({ songs: res.songs, albums: res.albums })) searchSharedLibrary(query.trim())
.catch(() => setSearchResults({ songs: [], albums: [] })) .then((res) => setSharedResults(res.songs))
.finally(() => setSearching(false)) .catch(() => setSharedResults([]))
.finally(() => setSearching(false))
} else {
searchLibrary(query.trim())
.then((res) => setSearchResults({ songs: res.songs, albums: res.albums }))
.catch(() => setSearchResults({ songs: [], albums: [] }))
.finally(() => setSearching(false))
}
}, 400) }, 400)
return () => clearTimeout(handle) return () => clearTimeout(handle)
}, [query]) // scope is a dependency on purpose - switching "My Library" <-> "Shared" while a query is
// already typed re-runs the search under the new scope instead of leaving stale results
// (or the other scope's results) on screen.
}, [query, scope])
// Owns the confirm step (not SongRow) since it's also the one that has to reconcile the // Owns the confirm step (not SongRow) since it's also the one that has to reconcile the
// song's removal across every local list it can appear in - the full library and the current // song's removal across every local list it can appear in - the full library and the current
...@@ -123,7 +150,10 @@ export function Library() { ...@@ -123,7 +150,10 @@ export function Library() {
} }
} }
const isSearching = searchResults !== null // Not tied to searchResults (which only ever holds "mine"-scope results) - "shared" scope
// populates sharedResults instead, so deriving this from the query itself is what actually
// stays correct across both scopes.
const isSearching = query.trim().length > 0
return ( return (
<Layout title="Library"> <Layout title="Library">
...@@ -137,6 +167,25 @@ export function Library() { ...@@ -137,6 +167,25 @@ export function Library() {
/> />
</div> </div>
{isSearching && (
<div className="mb-4 flex gap-2">
{(['mine', 'shared'] as const).map((s) => (
<button
key={s}
onClick={() => setScope(s)}
className={`flex items-center gap-1.5 rounded-full px-4 py-1.5 text-sm font-medium transition-colors duration-150 ${
scope === s
? 'bg-primary text-on-primary'
: 'border border-outline-variant bg-surface-container text-on-surface-variant hover:border-primary hover:text-on-surface'
}`}
>
{s === 'shared' && <Globe2 size={14} strokeWidth={2} />}
{s === 'mine' ? 'My Library' : 'Shared'}
</button>
))}
</div>
)}
{loading && !isSearching && ( {loading && !isSearching && (
<div className="space-y-1"> <div className="space-y-1">
<SkeletonRow /> <SkeletonRow />
...@@ -150,11 +199,31 @@ export function Library() { ...@@ -150,11 +199,31 @@ export function Library() {
<EmptyState icon={Music2} message="No songs yet - tag something from Telegram to see it here." /> <EmptyState icon={Music2} message="No songs yet - tag something from Telegram to see it here." />
)} )}
{/* Keyed by isSearching only (not the query text itself) so typing further within the {/* Keyed by isSearching+scope (not the query text itself) so typing further within the
same mode doesn't replay the fade on every keystroke - only the actual search/default same mode doesn't replay the fade on every keystroke - only an actual search/default
swap should animate, not each new set of results arriving within it. */} swap or a scope change should animate, not each new set of results arriving within
<div key={isSearching ? 'search' : 'default'} className="animate-content-enter"> one. */}
{isSearching ? ( <div key={isSearching ? `search-${scope}` : 'default'} className="animate-content-enter">
{isSearching && scope === 'shared' ? (
<>
{searching && (
<div className="space-y-3">
<SkeletonRow />
<SkeletonRow />
</div>
)}
{!searching && (sharedResults?.length ?? 0) === 0 && (
<EmptyState icon={Globe2} message={`No results for "${query.trim()}" in the shared library`} />
)}
{!searching && sharedResults && sharedResults.length > 0 && (
<ul className="space-y-1">
{sharedResults.map((song) => (
<SharedSongRow key={`${song.title}::${song.artist}`} song={song} onAddToPlaylist={setAddingSong} />
))}
</ul>
)}
</>
) : isSearching ? (
<> <>
{searching && ( {searching && (
<div className="space-y-3"> <div className="space-y-3">
...@@ -162,10 +231,10 @@ export function Library() { ...@@ -162,10 +231,10 @@ export function Library() {
<SkeletonRow /> <SkeletonRow />
</div> </div>
)} )}
{!searching && searchResults.songs.length === 0 && searchResults.albums.length === 0 && ( {!searching && (searchResults?.songs.length ?? 0) === 0 && (searchResults?.albums.length ?? 0) === 0 && (
<EmptyState icon={Search} message={`No results for "${query.trim()}"`} /> <EmptyState icon={Search} message={`No results for "${query.trim()}"`} />
)} )}
{!searching && searchResults.albums.length > 0 && ( {!searching && searchResults && searchResults.albums.length > 0 && (
<div className="mb-6"> <div className="mb-6">
<h2 className="mb-2 text-xs font-semibold uppercase tracking-[0.1em] text-primary">Albums</h2> <h2 className="mb-2 text-xs font-semibold uppercase tracking-[0.1em] text-primary">Albums</h2>
<ul className="space-y-1"> <ul className="space-y-1">
...@@ -194,7 +263,7 @@ export function Library() { ...@@ -194,7 +263,7 @@ export function Library() {
</ul> </ul>
</div> </div>
)} )}
{!searching && searchResults.songs.length > 0 && ( {!searching && searchResults && searchResults.songs.length > 0 && (
<div> <div>
<h2 className="mb-2 text-xs font-semibold uppercase tracking-[0.1em] text-primary">Songs</h2> <h2 className="mb-2 text-xs font-semibold uppercase tracking-[0.1em] text-primary">Songs</h2>
<ul className="space-y-1"> <ul className="space-y-1">
......
...@@ -87,6 +87,7 @@ const BACKEND_DONE: DoneGroup[] = [ ...@@ -87,6 +87,7 @@ const BACKEND_DONE: DoneGroup[] = [
'Delete: songs (+ file on disk), playlists (+ their tracks), single playlist tracks - all owner-scoped', 'Delete: songs (+ file on disk), playlists (+ their tracks), single playlist tracks - all owner-scoped',
'/music/tag and /music/upload no longer return a download_url (2026-09-01) - same access-control gap as the old remix one below: the URL pointed at the unauthenticated /downloads static mount with no ownership check, so anyone who saw or guessed a path could pull another user\'s file. Nothing served it any more once the frontend switched the Upload result card to "add to playlist" instead of a download link, so it was removed rather than patched; playback goes through the already-auth-scoped /library/stream/{id}.', '/music/tag and /music/upload no longer return a download_url (2026-09-01) - same access-control gap as the old remix one below: the URL pointed at the unauthenticated /downloads static mount with no ownership check, so anyone who saw or guessed a path could pull another user\'s file. Nothing served it any more once the frontend switched the Upload result card to "add to playlist" instead of a download link, so it was removed rather than patched; playback goes through the already-auth-scoped /library/stream/{id}.',
'LibrarySong.track_number + GET /library/album (2026-09-01): identify_audio() (Shazam, or MusicBrainz\'s release-list for AcoustID hits) always computed a track number, and IdentifiedTrack already cached it, but LibrarySong itself had no column for it - so an album\'s tracks had no real order to sort by anywhere they were shown. Persisted through the shared tag/upload pipeline; the new endpoint returns one (album, artist)\'s tracks sorted by it (numberless tracks last, then alphabetically) for the frontend\'s new dedicated album page.', 'LibrarySong.track_number + GET /library/album (2026-09-01): identify_audio() (Shazam, or MusicBrainz\'s release-list for AcoustID hits) always computed a track number, and IdentifiedTrack already cached it, but LibrarySong itself had no column for it - so an album\'s tracks had no real order to sort by anywhere they were shown. Persisted through the shared tag/upload pipeline; the new endpoint returns one (album, artist)\'s tracks sorted by it (numberless tracks last, then alphabetically) for the frontend\'s new dedicated album page.',
'Search the shared library (2026-09-06): POST /library/shared/search matches title/artist/genre the same way the existing owner-scoped search does, but across every user\'s library - the collective pool already described for Discovery\'s "someone else already has this" hand-off, just reached by typing a search instead of a mic listen. Deduped by (title, artist) so a song several users have separately uploaded doesn\'t show up once per owner, and excludes anything matching a song the searcher already has (by that same identity, not just their own literal row) - the point is surfacing music that\'s new to them. Song-level only, no album groupings: merging albums across different owners (whose coverart wins, mismatched track subsets) needs a real Album entity this app doesn\'t have, so that was deliberately left out rather than half-solved. POST /library/shared/claim turns a result into an actual playable copy - give_from_shared_library (the exact mechanism behind Discovery\'s own hand-off) moved out of discovery.py into a shared services module so both routers call the same code instead of one importing the other\'s private function; picked up a drive-by fix while it moved (track_number wasn\'t being copied, so a claimed song lost its real album order).',
], ],
}, },
{ {
...@@ -200,6 +201,7 @@ const FRONTEND_DONE: DoneGroup[] = [ ...@@ -200,6 +201,7 @@ const FRONTEND_DONE: DoneGroup[] = [
'Delete-from-library (2026-08-31): swipe a Library row left past a threshold to reveal and trigger delete (right instead adds to queue) - confirms via the same window.confirm pattern already used for soundmark delete, then removes the file on disk and reconciles the song out of every local list it could be showing in (the full library, the current search\'s Songs section, and any album groupings within it)', 'Delete-from-library (2026-08-31): swipe a Library row left past a threshold to reveal and trigger delete (right instead adds to queue) - confirms via the same window.confirm pattern already used for soundmark delete, then removes the file on disk and reconciles the song out of every local list it could be showing in (the full library, the current search\'s Songs section, and any album groupings within it)',
'Upload\'s result card swaps its download link for "Add to playlist" (2026-09-01), reusing AddToPlaylistModal (narrowed its song prop to just {id, title} rather than the full LibrarySong shape, since Upload\'s freshly-tagged result isn\'t one) - the card itself is now tappable to play the track immediately via the shared player instead of only offering a file to save locally', 'Upload\'s result card swaps its download link for "Add to playlist" (2026-09-01), reusing AddToPlaylistModal (narrowed its song prop to just {id, title} rather than the full LibrarySong shape, since Upload\'s freshly-tagged result isn\'t one) - the card itself is now tappable to play the track immediately via the shared player instead of only offering a file to save locally',
'Upload accepts multiple files at once (2026-09-01): each selected file gets its own queued row (removable before upload) and its own progress/result/error state, uploaded sequentially through the same one-file-at-a-time endpoint rather than all at once - the identify/tag pipeline per file is already the heavy part, so nothing would be gained by racing several through it in parallel', 'Upload accepts multiple files at once (2026-09-01): each selected file gets its own queued row (removable before upload) and its own progress/result/error state, uploaded sequentially through the same one-file-at-a-time endpoint rather than all at once - the identify/tag pipeline per file is already the heavy part, so nothing would be gained by racing several through it in parallel',
'Search the shared library from the Library page (2026-09-06), not a separate tab and not folded into Discovery - a deliberate call, since typing a search is the same kind of action as the existing owner-scoped search (just widened in scope), while Discovery\'s own mental model is ambient/mic-driven identification, a genuinely different action. A "My Library" / "Shared" scope toggle appears only while actively searching; switching to Shared re-runs the same query against every user\'s library instead of just the caller\'s. Shared results (SharedSongRow, visually similar to the normal SongRow but with no swipe actions - queue/delete both assume an id the caller already owns) claim-on-tap: playing or adding one to a playlist first calls /library/shared/claim to get a real owned copy, then acts on that - the same "get your own copy, then use it" flow already established for Discovery hits.',
], ],
}, },
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment