Commit Graph
4371 Commits
Author SHA1 Message Date
Deluan 915f09a75c feat: add library access methods to User model
Signed-off-by: Deluan <deluan@navidrome.org>
2025-07-16 18:10:15 -04:00
Deluan 3f44e86299 fix: add ApplyArtistLibraryFilter to filter artists by associated music folders
Signed-off-by: Deluan <deluan@navidrome.org>
2025-07-16 18:10:15 -04:00
Deluan b2fec7277b refactor: optimize starred items queries with parallel execution and fix test isolation
Refactored starred items functionality by extracting common logic into getStarredItems()
method that executes artist, album, and media file queries in parallel for better performance.
This eliminates code duplication between GetStarred and GetStarred2 methods while improving
response times through concurrent database queries using run.Parallel().

Also fixed test isolation issues by adding missing auth.Init(ds) call in album lists test setup.
This resolves nil pointer dereference errors in GetStarred and GetStarred2 tests when run independently.
2025-07-16 18:10:15 -04:00
Deluan a93fa53ae7 feat: implement multi-library support for GetRandomSongs, GetSongsByGenre, GetStarred, and GetStarred2
- Added multi-library filtering to GetRandomSongs endpoint using musicFolderId parameter
- Added multi-library filtering to GetSongsByGenre endpoint using musicFolderId parameter
- Enhanced GetStarred and GetStarred2 to filter artists, albums, and songs by library
- Added Options field to MockMediaFileRepo and MockArtistRepo for test compatibility
- Added comprehensive Ginkgo/Gomega tests for all new multi-library functionality
- All tests verify proper SQL filter generation and library access validation
- Supports single/multiple musicFolderId values with fallback to all accessible libraries
2025-07-16 18:10:15 -04:00
Deluan b9e7b7cad7 feat: implement multi-library support for GetAlbumList and GetAlbumList2 endpoints
- Enhanced selectedMusicFolderIds helper to validate and filter library IDs
- Added ApplyLibraryFilter function in filter/filters.go for library filtering
- Updated getAlbumList to support musicFolderId parameter filtering
- Added comprehensive tests for multi-library functionality
- Supports single and multiple musicFolderId values
- Falls back to all accessible libraries when no musicFolderId provided
- Validates library access permissions for user security
2025-07-16 18:10:15 -04:00
Deluan bbc6d0722c feat: add library access validation to selectedMusicFolderIds
Enhanced the selectedMusicFolderIds function to validate musicFolderId parameters
against the user's accessible libraries. Invalid library IDs (those the user
doesn't have access to) are now silently filtered out, improving security by
preventing users from accessing libraries they don't have permission for.

Changes include:
- Added validation logic to check musicFolderId parameters against user's accessible libraries
- Added slices package import for efficient validation
- Enhanced function documentation to clarify validation behavior
- Added comprehensive test cases covering validation scenarios
- Maintains backward compatibility with existing behavior
2025-07-16 18:10:15 -04:00
Deluan c5b7857fef refactor: change ArtistRepository.GetIndex to accept multiple library IDs
Updated the GetIndex method signature to accept a slice of library IDs instead of a single ID, enabling support for filtering artists across multiple libraries simultaneously.

Changes include:
- Modified ArtistRepository interface in model/artist.go
- Updated implementation in persistence/artist_repository.go with improved library filtering logic
- Refactored Subsonic API browsing.go to use new selectedMusicFolderIds helper
- Added comprehensive test coverage for multiple library scenarios
- Updated mock repository implementation for testing

This change improves flexibility for multi-library operations while maintaining backward compatibility through the selectedMusicFolderIds helper function.
2025-07-16 18:10:15 -04:00
Deluan 64159d715a feat: enhance selectedMusicFolderIds function to handle valid music folder IDs and improve fallback logic
Signed-off-by: Deluan <deluan@navidrome.org>
2025-07-16 18:10:15 -04:00
Deluan ad0c9ae153 refactor: simplify getUserAccessibleLibraries function and update related tests
Signed-off-by: Deluan <deluan@navidrome.org>
2025-07-16 18:10:15 -04:00
Deluan 6125a090ef fix: ensure LibrarySelector dropdown refreshes on button close
Added refresh() call when closing the dropdown via button click to maintain
consistency with the ClickAwayListener behavior. This ensures the UI
updates properly regardless of how the dropdown is closed, fixing an
inconsistent refresh behavior between different closing methods.

The fix tracks the previous open state and calls refresh() only when
the dropdown was open and is being closed by the button click.
2025-07-16 18:10:15 -04:00
Deluan a3281ca027 feat(subsonic): update GetIndexes and GetArtists method to support library ID filtering
Signed-off-by: Deluan <deluan@navidrome.org>
2025-07-16 18:10:15 -04:00
Deluan 0b61df1b90 feat(library): enhance LibrarySelectionField to extract library IDs from record
Signed-off-by: Deluan <deluan@navidrome.org>
2025-07-16 18:10:15 -04:00
Deluan c1365cd236 feat(subsonic): implement user-specific library access in GetMusicFolders
Signed-off-by: Deluan <deluan@navidrome.org>
2025-07-16 18:10:15 -04:00
Deluan 5d926538d7 Add library_id field support for smart playlists
- Add library_id field to smart playlist criteria system
- Supports Is and IsNot operators for filtering by library ID
- Includes comprehensive test coverage for single values and lists
- Enables creation of library-specific smart playlists
2025-07-16 18:10:15 -04:00
Deluan 4b107b213c feat(artist): add library ID filtering for artists in repository and update resource filtering logic
Signed-off-by: Deluan <deluan@navidrome.org>

# Conflicts:
#	persistence/artist_repository.go
2025-07-16 18:10:15 -04:00
Deluan 5ecad64a3f feat(library): add refresh functionality on LibrarySelector close
Signed-off-by: Deluan <deluan@navidrome.org>
2025-07-16 18:10:15 -04:00
Deluan 2f9a9cf4fb fix(repository): add table name handling in filter functions for SQL queries
Signed-off-by: Deluan <deluan@navidrome.org>
2025-07-16 18:10:15 -04:00
Deluan 93059204f3 feat(library): streamline library ID filtering in repositories and update resource filtering logic
Signed-off-by: Deluan <deluan@navidrome.org>
2025-07-16 18:10:15 -04:00
Deluan d44292cdc7 feat(library): add library ID filtering for album resources
Signed-off-by: Deluan <deluan@navidrome.org>
2025-07-16 18:10:15 -04:00
Deluan ac31ea640f test: add unit tests for file utility functions
Signed-off-by: Deluan <deluan@navidrome.org>
2025-07-16 18:10:15 -04:00
Deluan 17bb39c472 feat(library): add tests for LibrarySelector and library selection hooks
Signed-off-by: Deluan <deluan@navidrome.org>
2025-07-16 18:10:14 -04:00
Deluan 1713396da2 feat(library): implement library selection functionality with reducer and UI component
Signed-off-by: Deluan <deluan@navidrome.org>

# Conflicts:
#	.github/copilot-instructions.md

# Conflicts:
#	.gitignore
2025-07-16 18:10:14 -04:00
Deluan db167f56b9 feat(user): add library selection for user creation and editing
Signed-off-by: Deluan <deluan@navidrome.org>
2025-07-16 18:10:14 -04:00
Deluan e9d6a8eccf feat(repository): apply library filtering in CountAll methods for albums, folders, and media files
Signed-off-by: Deluan <deluan@navidrome.org>
2025-07-16 18:10:14 -04:00
Deluan f9fc3cd1c6 prepend libraryID for track and album PIDs
Signed-off-by: Deluan <deluan@navidrome.org>
2025-07-16 18:10:14 -04:00
Deluan 4b8b19e154 fix: track processed libraries by updating state with scan timestamps
Signed-off-by: Deluan <deluan@navidrome.org>
2025-07-16 18:10:14 -04:00
Deluan 4f4b0fb94a refactor(scanner): streamline library handling by using state-libraries for consistency
Signed-off-by: Deluan <deluan@navidrome.org>
2025-07-16 18:10:14 -04:00
Deluan ee18a04da9 feat(library): add/remove watchers on demand, not only when server starts
Signed-off-by: Deluan <deluan@navidrome.org>
2025-07-16 18:10:14 -04:00
Deluan 8c8ef7836a feat(library): add library path and name fields to album and mediafile models
Signed-off-by: Deluan <deluan@navidrome.org>
2025-07-16 18:10:14 -04:00
Deluan b4c3590bfe refactor: move scan triggering logic into a helper method for clarity
Signed-off-by: Deluan <deluan@navidrome.org>
2025-07-16 18:10:14 -04:00
Deluan 6c5c9e0b68 rename migration file for user library table to maintain versioning order
Signed-off-by: Deluan <deluan@navidrome.org>
2025-07-16 18:10:14 -04:00
Deluan df3e03698f feat(library): trigger scan after successful library deletion to clean up orphaned data
Signed-off-by: Deluan <deluan@navidrome.org>
2025-07-16 18:10:14 -04:00
Deluan 12562dbfab feat(library): implement scanner interface for triggering library scans on create/update
Signed-off-by: Deluan <deluan@navidrome.org>

# Conflicts:
#	cmd/wire_gen.go
#	cmd/wire_injectors.go

# Conflicts:
#	cmd/wire_gen.go

# Conflicts:
#	cmd/wire_gen.go
#	cmd/wire_injectors.go
2025-07-16 18:10:14 -04:00
Deluan c8ee3edba7 feat(missingfiles): add library filter and display in MissingFilesList component
Signed-off-by: Deluan <deluan@navidrome.org>
2025-07-16 18:10:14 -04:00
Deluan 2dee0fee98 feat(mediafile): add LibraryName field and update queries to include library name
Signed-off-by: Deluan <deluan@navidrome.org>
2025-07-16 18:10:14 -04:00
Deluan 20968ef0b9 feat(library): enhance LibraryCreate and LibraryEdit components with additional props and styling
Signed-off-by: Deluan <deluan@navidrome.org>
2025-07-16 18:10:14 -04:00
Deluan f1cea72715 feat(library): add additional fields and restructure LibraryEdit component for enhanced statistics display
Signed-off-by: Deluan <deluan@navidrome.org>
2025-07-16 18:10:14 -04:00
Deluan a036db7ebd feat(controller): add function to retrieve the most recent scan time across all libraries
Signed-off-by: Deluan <deluan@navidrome.org>
2025-07-16 18:10:14 -04:00
Deluan 9e90145291 test(scanner): improve handling of filesystem errors and ensure warnings are returned
Signed-off-by: Deluan <deluan@navidrome.org>
2025-07-16 18:10:14 -04:00
Deluan 4c06cd2ac8 test(scanner): add tests for multi-library scanning and validation
Signed-off-by: Deluan <deluan@navidrome.org>
2025-07-16 18:10:14 -04:00
Deluan daa3648b06 lint
Signed-off-by: Deluan <deluan@navidrome.org>
2025-07-16 18:10:14 -04:00
Deluan 5a78c6e49a feat(library): enhance validation messages and error handling for library paths
Signed-off-by: Deluan <deluan@navidrome.org>
2025-07-16 18:10:14 -04:00
Deluan 0ef4c3ed8c simplify DeleteLibraryButton.jsx
Signed-off-by: Deluan <deluan@navidrome.org>
2025-07-16 18:10:14 -04:00
Deluan 1713095414 use utils/formatBytes
Signed-off-by: Deluan <deluan@navidrome.org>
2025-07-16 18:10:14 -04:00
Deluan 4c3bc499c1 feat(library): improve library path validation and error handling - WIP
Signed-off-by: Deluan <deluan@navidrome.org>
2025-07-16 18:10:14 -04:00
Deluan 4ab37346fc feat(library): enhance library validation and management with path checks and normalization - WIP
Signed-off-by: Deluan <deluan@navidrome.org>
2025-07-16 18:10:14 -04:00
Deluan 2b8af050a4 feat(library): add library management features including create, edit, delete, and list functionalities - WIP
Signed-off-by: Deluan <deluan@navidrome.org>
2025-07-16 18:10:14 -04:00
Deluan e9fb649e9e fix migration file name
Signed-off-by: Deluan <deluan@navidrome.org>
2025-07-16 18:10:14 -04:00
Deluan b93a753b9f add total_duration column to library and update user_library table
Signed-off-by: Deluan <deluan@navidrome.org>
2025-07-16 18:10:14 -04:00
Deluan d2a2c43ef5 refactor library service to use REST repository pattern and remove CRUD operations
Signed-off-by: Deluan <deluan@navidrome.org>
2025-07-16 18:10:14 -04:00