Commit Graph

462 Commits

Author SHA1 Message Date
Deluan 9422373be0 Optimize AlbumRepository.GetAll and add a GetAllWithoutGenres method specifically for Subsonic API, where multiple-genres are not required 2021-11-02 21:19:49 -04:00
Deluan 12818fb590 Make song/album/artist endpoints read-only 2021-11-02 14:44:50 -04:00
Deluan 133fed344f Add `owner_id` to `playlist` 2021-10-31 15:08:06 -04:00
Steve Richter a56d5bc850
Listenbrainz scrobbling (#1424)
* Refactor session_keys to its own package

* Adjust play_tracker

- Don't send external NowPlaying/Scrobble for tracks with unknown artist
- Continue to the next agent on error

* Implement ListenBrainz Agent and Auth Router

* Implement frontend for ListenBrainz linking

* Update listenBrainzRequest

- Don't marshal Player to json
- Rename Track to Title

* Return ErrRetryLater on ListenBrainz server errors

* Add tests for listenBrainzAgent

* Add tests for ListenBrainz Client

* Adjust ListenBrainzTokenDialog to handle errors better

* Refactor listenbrainz.formatListen and listenBrainzRequest structs

* Refactor agent auth_routers

* Refactor session_keys to agents package

* Add test for listenBrainzResponse

* Add tests for ListenBrainz auth_router

* Update ListenBrainzTokenDialog and auth_router

* Adjust player scrobble toggle
2021-10-30 12:17:42 -04:00
Deluan fa3471f527 Simplify `resources` code, enabling any resource to be overridden (not just translations) 2021-10-28 10:25:25 -04:00
Deluan 9072412812 Fix translations on Windows 2021-10-28 09:41:37 -04:00
Deluan f645c4769c Fix double escaped lyrics and comments 2021-10-26 19:33:21 -04:00
Deluan 5dce499d6d Fix/Optimized Playlist tracks deletion 2021-10-26 14:05:28 -04:00
Deluan af00503b77 Optimize playlist updates 2021-10-26 10:45:14 -04:00
Deluan 2e2a647e67 Make SmartPlaylists read-only 2021-10-23 20:25:28 -04:00
Deluan 1a96e9fe65 Import smart playlists (extension .nsp) 2021-10-23 20:25:28 -04:00
Deluan c72add516a Add methods to Playlist model
Also, don't load genres for Playlists tracks (not necessary for now)
2021-10-23 20:25:28 -04:00
Deluan d200933b68 Reduce number of queries for some playlists operations.
Also allow admins to update/delete playlists from other users in the Subsonic API. Closes #1366
2021-10-23 20:25:28 -04:00
Dheeraj Lalwani 5621551dd0
Adds Lyrics Support to Subsonic API (#1379)
* Add function 'isSynced' that identifies if lyrics are synced or not and add tests for the same

* implement 'getLyrics' which returns lyrics if they exist

Signed-off-by: Dheeraj Lalwani <lalwanidheeraj1234@gmail.com>

* remove timestamps frorom the the lyrics if they are synced, fix filters & clean up code

Signed-off-by: Dheeraj Lalwani <lalwanidheeraj1234@gmail.com>

* add snapshot tests for the 'Lyrics' response & add some clean up

Signed-off-by: Dheeraj Lalwani <lalwanidheeraj1234@gmail.com>

* add tests for 'GetLyrics' function

Signed-off-by: Dheeraj Lalwani <lalwanidheeraj1234@gmail.com>

* update the snapshot test & the test for 'GetLyrics' function

Signed-off-by: Dheeraj Lalwani <lalwanidheeraj1234@gmail.com>
2021-10-19 16:33:06 -04:00
Deluan b6e30cd01f Return playlists sorted in `getPlaylists` Subsonic endpoint 2021-10-05 14:47:57 -04:00
Deluan 6c3e45de41 Add songs to playlists with drag and drop 2021-10-02 13:14:33 -04:00
Deluan Quintão 91e36a2c18
Check goimports in the pipeline (#1381)
* Check goimports in the pipeline

* Check goimports in the pipeline

* Check goimports in the pipeline

* go mod tidy

* wip

* wip

* Fix goimports and go:build tags

* Run golangci-lint before goimports
2021-10-01 15:32:24 -04:00
Deluan c6868ff8a0 Don't show Artist Page for "Various Artists" 2021-09-27 11:52:23 -04:00
Dnouv 482c2dec0c
Artist Detail Page (first cut) (#1287)
* Configure fetching from API and route

* pretty

* Remove errors

* Remove errors

* Remove errors

* Complete page for Desktop view

* Fix error

* Add xs Artist page

* Remove unused import

* Add styles for theme

* Change route path

* Remove artId useEffect array

* Remove array

* Fix cover load err

* Add redirect on err

* Remove route

* What's in a name? consistency :)

* Fix err

* Fix UI changes

* Fetch album from resource

* Renaming done

* Review changes

* Some touch-up

* Small refactor, to make naming and structure more consistent with AlbumShow

* Make artist's album list similar to original implementation

* Reuse AlbumGridView, to avoid duplication

* Add feature flag to enable new Artist Page, default false

* Better biography styling. Small refactorings,

* Don't encode quotes and other symbols

* Moved AlbumShow to correct folder

Co-authored-by: Deluan <deluan@navidrome.org>
2021-09-26 15:32:40 -04:00
caiocotts 210dc6b12e
Add x-total-count to Subsonic API getAlbumList (#1360)
* Add x-total-count to Subsonic API getAlbumList

* Rename variable

Co-authored-by: Deluan <deluan@navidrome.org>
2021-09-21 20:40:39 -04:00
Deluan Quintão 79363d6c07
Move Playlists to the sidebar menu (#1339)
* Show playlists in sidebar menu

* Fix menu

* Refresh playlist submenu when adding new playlist

* Group shared playlists below user's playlists

* Fix text overflow in menu options

* Add button in playlist menu to go to Playlists list

* Add config option `DevSidebarPlaylists` to enable this feature (default false)
2021-09-11 13:11:15 -04:00
Deluan c831dc4cdf Use `structs` lib to map models to DB. Fix #1266 2021-08-01 12:04:45 -04:00
Deluan 8afa2cd833 Remove dependency of deprecated `ioutil` package 2021-07-20 20:12:28 -04:00
Deluan 774ad65155 Use fs.FS in MergeFS implementation 2021-07-20 19:54:44 -04:00
Deluan 7540881695 Small refactorings 2021-07-20 19:18:29 -04:00
Deluan bc6b175414 Make `getGenre` Subsonic endpoint returns genres sorted by counts 2021-07-20 17:45:08 -04:00
Deluan b6e9ec4db4 Optimize GetAll genres query 2021-07-20 17:45:08 -04:00
Deluan 20b7e5c49b Add Genre filters to UI 2021-07-20 17:45:08 -04:00
Deluan 1d8607ef6a Remove unnecessary repositories methods 2021-07-20 17:45:08 -04:00
Deluan 5e54925520 Add multiple genres to Albums 2021-07-20 17:45:08 -04:00
Deluan 39da741a80 Add multiple genres to MediaFile 2021-07-20 17:45:08 -04:00
Deluan 7cd3a8ba67 Add genre tables, read multiple-genres from tags 2021-07-20 17:45:08 -04:00
Deluan 8d56ec898e Use AlbumArtist tag even for compilations, when it is specified.
If the tracks' AlbumArtists are different, then use "Various Artists"
2021-07-15 11:53:08 -04:00
Deluan cfb113bd33 Disable Last.FM features based on `LastFM.Enabled` config option 2021-07-02 10:04:41 -04:00
Deluan ed286c7103 Don't rely on goroutines to send keepalive events 2021-07-01 13:31:46 -04:00
Deluan 0c2ca2a5e4 Assign event ids in the main loop, to avoid out-of-order events 2021-07-01 10:58:41 -04:00
Deluan 5bd33455a1 Fix deadlock situation when events are sent too fast to the broker 2021-07-01 10:42:00 -04:00
Deluan a73f885afb Add option to disable album cover animation in the player. Closes #1185 2021-06-28 17:11:05 -04:00
Deluan 94533e585c Add tests to `/scrobble` endpoint 2021-06-26 13:52:29 -04:00
Deluan 26bcf0b877 Enable Last.fm scrobbling by default (still requires user's authorization) 2021-06-25 23:09:09 -04:00
Deluan 056f0b944f Refactor: Consolidate scrobbling logic in play_tracker 2021-06-23 11:01:58 -04:00
Deluan a7509c9ff7 Send NowPlaying and Scrobbles to Last.fm 2021-06-23 11:01:58 -04:00
Deluan d5461d0ae9 Refactor Agents to be singleton
Initial work for Last.fm scrobbler
2021-06-23 11:01:58 -04:00
Deluan 743e469795 Use singleton in other places as well 2021-06-21 18:59:26 -04:00
Deluan 1f997357a9 Expose Last.fm's ApiKey to UI 2021-06-21 18:14:01 -04:00
Deluan 502a719e96 Implement Last.FM Desktop Auth flow endpoints 2021-06-21 18:14:01 -04:00
Steve Richter 8ee5c1f245 Initial Last.fm UI implementation 2021-06-21 18:14:01 -04:00
Deluan ffa76bba6a Add flag to disable Scrobble config in the UI 2021-06-21 18:14:01 -04:00
Deluan 877f01bd38 Show notification if server is updated 2021-06-21 13:48:39 -04:00
Deluan 47bcf719f2 Fix cookie warning 2021-06-20 13:27:50 -04:00
Deluan 197d430d15 Fix lint error 2021-06-20 12:07:34 -04:00
Deluan 80b2c2f3cf Try to register all playing music in GetNowPlaying 2021-06-20 11:25:15 -04:00
Deluan 97434c1789 Fix GetNowPlaying endpoint showing only the last play 2021-06-20 10:39:19 -04:00
Deluan f8ee6db72a New implementation of NowPlaying 2021-06-20 10:39:16 -04:00
Deluan c09468e135 Option to allow auto-login during development. 2021-06-19 10:56:39 -04:00
Deluan 31ea033880 Fix subsonic token when authenticating by Header 2021-06-18 19:00:13 -04:00
Deluan Quintão 66b74c81f1
Encrypt passwords in DB (#1187)
* Encode/Encrypt passwords in DB

* Only decrypts passwords if it is necessary

* Add tests for encryption functions
2021-06-18 18:38:38 -04:00
Deluan d42dfafad4 Add username to request.Context 2021-06-18 18:28:51 -04:00
Deluan 86271f0412 Optimize refresh events for scrobble endpoint 2021-06-16 10:23:34 -04:00
Deluan fb7229a53e Refech using getMany, reducing the number of API calls 2021-06-16 10:01:09 -04:00
Deluan 521d1ff2bf Disable `realip` middleware when using the reverse proxy authentication feature
Should fix https://github.com/navidrome/navidrome/pull/1152#issuecomment-862306847
2021-06-16 10:01:09 -04:00
Deluan b65e76293a Only send events to clients who need it
- User events (star, rating, plays) only sent to same user
- Don't send to the client (browser window) that originated the event
2021-06-15 18:59:26 -04:00
Deluan 8383527aab Only refetch changed resources when receive a "refreshResource" event 2021-06-15 16:12:13 -04:00
Deluan 667701be02 Less `warning` messages when first running it.
They are actually `info` messages
2021-06-13 19:27:01 -04:00
Deluan 59b99d2206 No need to check for first time when authenticating. One less SQL call per request 2021-06-13 19:26:25 -04:00
Deluan d54129ecd2 Rename `app` package to `nativeapi` 2021-06-13 19:15:41 -04:00
Deluan Quintão 03efc48137
Refactor routing, changes API URLs (#1171)
* Make authentication part of the server, so it can be reused outside the Native API

This commit has broken tests after a rebase

* Serve frontend assets from `server`, and not from Native API

* Change Native API URL

* Fix auth tests

* Refactor server authentication

* Simplify authProvider, now subsonic token+salt comes from the server

* Don't send JWT token to UI when authenticated via Request Header

* Enable ReverseProxyWhitelist to be read from environment
2021-06-13 12:46:36 -04:00
Igor Rzegocki 6bd4c0f6bf
Reverse proxy authentication support (#1152)
* feat(auth): reverse proxy authentication support - #176

* address PR remarks

* Fix redaction of UI appConfig

Co-authored-by: Deluan <deluan@navidrome.org>
2021-06-11 23:17:21 -04:00
Deluan e31802d2d3 Only send "refresh" event if `SetRating` was successful 2021-06-10 15:03:30 -04:00
Deluan cefc939909 Trigger UI refresh on media annotation events: `star`, `setRating` and `scrobble` 2021-06-10 12:20:52 -04:00
Deluan 7f85ecd515 Trigger a UI refresh when the scanner finds changes.
Closes #1025
2021-06-09 21:02:20 -04:00
Deluan 110e17b004 Make MockRepo names more consistent 2021-06-08 16:30:19 -04:00
Yash Jipkate af210c8903
Add Native Sharing REST API (#1150)
* Initial draft - UNTESTED

* changes to Save() and Update()

* apply col filter and limit nanoid

* remove columns to not update
2021-06-08 15:44:30 -04:00
Yash Jipkate 7b05c49215
Add devEnableShare config option (#1141)
* add devEnableShare config option

* Toggle in config.js
2021-05-30 15:36:10 -04:00
Deluan 675cbe11b3 Fix `updatePlaylist` not updating fields `comment` and `public`.
Fix #1140
2021-05-29 17:16:56 -04:00
Deluan 91a91f7e06 GetCoverArt returns placeholder if `id` is missing
This mimics Subsonic behaviour, even if it contradicts the API documentation, which states `id` is required

Fixes #1139
2021-05-29 11:37:00 -04:00
Deluan b398053223 Include a shared Last.FM api key, providing zero conf ArtistInfo (bio/top songs/similar artists) 2021-05-27 16:14:24 -04:00
Deluan 86d3a219a9 Show name of router in log 2021-05-24 11:55:39 -04:00
Deluan 22ce5b6282 Removed unnecessary code 2021-05-11 18:55:58 -04:00
Deluan 7d96167abc Upgrade to go-chi 5 2021-05-11 17:21:18 -04:00
Dnouv 089d4abab1
Replace Feature Policy with Permissions Policy (#1112)
* Add Permissions Policy

* Remove Display capture option
2021-05-11 11:29:55 -04:00
Deluan 3e8d3e78c2 Fix Bookmarks Subsonic support (#1099)
JSON responses were incorrect
2021-05-07 09:47:13 -04:00
Deluan 7feda4bea4 Add `EnableUserEditing`, to control whether a regular user can change their own details (default `true`) 2021-05-02 17:11:12 -04:00
Deluan 2372f1d12b Change visibility of helper function 2021-05-02 15:23:51 -04:00
Deluan 490a7fcf52 Add test to Login function 2021-05-02 15:19:21 -04:00
Deluan b8138ebad6 Fix create first login 2021-05-02 14:13:17 -04:00
Deluan e3fe8399c8 Fix DevAutoCreateAdminPassword 2021-05-01 18:40:02 -04:00
Deluan a35de2bfd1 Allow regular users to change their info, including password.
Should fix #199
2021-04-28 22:35:25 -04:00
Deluan 6e73c23704 Keepalive must return an ID to be used with `dataProvider.getOne` 2021-04-26 23:19:30 -04:00
Deluan abaecf2b88 Add Nginx header to not buffer SSE connection
This should allow the Activity Panel, that uses a Server-Side Events/ Event Source connection, to work with default Nginx reverse proxy configuration.
2021-04-20 10:16:20 -04:00
Deluan f63a912341 Add config option to set default theme 2021-04-18 13:51:00 -04:00
Ayush Naidu f7dfabaa40
Replaced literal 302 with http constant (#1006) 2021-04-08 14:17:14 -04:00
Neil Chauhan 48ae4f7479
Add 5-star rating system(#986)
* Added Star Rating functionality for Songs

* Added Star Rating functionality for Artists

* Added Star Rating functionality for AlbumListView

* Added Star Rating functionality for AlbumDetails and improved typography for title

* Added functionality to turn on/off Star Rating functionality for Songs

* Added functionality to turn on/off Star Rating functionality for Artists

* Added functionality to turn on/off Star Rating functionality for Albums

* Added enableStarRating to server config

* Resolved the bugs and improved the ratings functionality.

* synced repo and removed duplicate key

* changed the default rating size to small, and changed the color to match the theme.

* Added translations for ratings, and Top Rated tab in side menu.

* Changed rating translation to topRated in albumLists, and added has_rating filter to topRated.

* Added empty stars icon to RatingField.

* Added sortable=false in AlbumSongs and added sortByOrder=DESC in all List components.

* Added translations for rating, for artists and albums, and removed the sortByOrder=DESC from SimpleLists.
2021-04-07 16:02:52 -04:00
Deluan 156a53c2ac Add support for artist 5-star rating in Subsonic API 2021-04-06 23:06:31 -04:00
Deluan 9913b92905 Get lossless format list from server 2021-04-06 22:18:48 -04:00
harshavardhanpb 5128c049d7
Rename diodo_test.go to diode_test.go (#956)
Simple typo fix
2021-03-31 15:41:38 -04:00
Deluan 3b0defefec Fix UI loading redirections. Should fix #906 2021-03-29 20:13:04 -04:00
Neil Chauhan 404253a881
Enable turn on/off Favorites/Loved feature. (#917)
* Added option to enable/disable favorites in Song

* Added option to enable/disable favorites in Artist

* Added option to enable/disable favorites in Albums and Favorites tab in sidebar

* Added option to enable/disable favorites in Player

* Set default value of enableFavourites as true

* Improved the functionality to enable/disable Favorites

* Add `EnableFavourites` config option

Co-authored-by: Deluan <deluan@navidrome.org>
2021-03-28 20:35:49 -04:00
Yash Jipkate e575825c33
Add `/` to `_` mapping for paths based on tags. (#888)
Closes  #592
2021-03-25 21:48:28 -04:00
Josep Mª Domingo 515aa7108b
Move logger middleware to capture routing errors (ex: 405). (#877)
* Fix #836

* Remove requestLogger middleware from MountRouter
2021-03-24 23:17:36 -04:00
Deluan 720e2357b7 Add option to sort Recently Added by file's mtime instead of time of import. 2021-03-12 18:18:35 -05:00
Deluan Quintão 2d528bbc87
Remove dependency of go-bindata (#818)
* Use new embed functionality for serving UI assets

* Use new embed functionality for serving resources. Remove dependency on go-bindata

* Remove Go 1.15
2021-03-12 11:06:51 -05:00
Deluan cfc9162729 Use a Waiter diode, to avoid constant CPU usage. Fixes #777 2021-02-13 12:08:32 -05:00
Deluan 107803e037 Update list of Not Implemented / Gone Subsonic API endpoints 2021-02-09 21:25:14 -05:00
Deluan 157faad028 Rename ExternalInfo to ExternalMetadata 2021-02-09 15:33:33 -05:00
Deluan 5fdd8b32d7 Move utilitarian/generic packages to utils: lastfm, spotify, gravatar, cache, and pool 2021-02-09 15:33:33 -05:00
Deluan 6ee45a9ccc Move project to Navidrome GitHub organization 2021-02-06 21:46:35 -05:00
Deluan 26f838167e Add tests to diode 2021-02-04 15:42:08 -05:00
Deluan c7af3b8256 Add test to Event 2021-02-04 12:43:46 -05:00
Deluan 7adacbac0d Removed event.type from SSE, as it was causing the browser to hang.
Needs more investigation, but for now, back to the simple message format
2021-02-04 12:37:06 -05:00
Deluan 9668263235 Logging when triggering manual scan 2021-02-03 00:27:59 -05:00
Deluan 905c685696 Use diodes instead of channels in SSE broker 2021-02-02 18:55:08 -05:00
Deluan 1f3bc4d202 Use tools.go commands without installing 2021-02-01 16:16:30 -05:00
Deluan 861b406575 Use new simplified `uuid.NewString()` syntax 2021-02-01 01:22:31 -05:00
Deluan 9520c30c32 Fix "failed" Subsonic response. Fix #716 2021-01-07 08:24:13 -05:00
Deluan cdae4347a6 Make ServerStart variable global 2020-12-21 11:39:38 -05:00
Deluan 8c063c4f0c Removed unused variable 2020-12-21 10:01:37 -05:00
Deluan 14b060a42a Only close connection if the write times out 2020-12-20 15:21:46 -05:00
Deluan 1d338417e9 Make `done` channel buffered 2020-12-13 11:58:00 -05:00
Deluan d685aefab3 Don't ever stop the `listen` go routine 2020-12-12 23:04:50 -05:00
Deluan e27d917bd4 Forgot to allocate `done` channel 2020-12-12 21:10:43 -05:00
Deluan 8b92796a5c Disconnect the client if the output buffer fills up 2020-12-12 18:26:30 -05:00
Deluan 17833cd9d2 Make names more consistent 2020-12-12 13:46:36 -05:00
Deluan e2969aa34c Use non-blocking event sending 2020-12-12 13:35:49 -05:00
Deluan a74b365feb Only adds route to `/events` if Activity Panel is enabled 2020-12-09 15:33:37 -05:00
Deluan 25ae1c6cdd Return album art as a Reader 2020-12-02 09:13:36 -05:00
Deluan a8c5fa6d49 Fix file descriptor leak in SSE implementation.master
See https://github.com/deluan/navidrome/issues/446#issuecomment-736296465
2020-12-01 09:24:44 -05:00
Deluan 975579ab26 Add option for player to report real paths in Subsonic API. Closes #625 2020-11-28 10:25:23 -05:00
Deluan b6c578e3a2 Change format of events sent by server, leveraging event type and id 2020-11-25 20:46:21 -05:00
Deluan f29bb211d1 Better termination handling in Scanner's progress 2020-11-25 19:05:36 -05:00
Deluan 63171368ed Disable Activity Panel by default.
You'll need to set `DevActivityPanel` (or `ND_DEVACTIVITYPANEL`) to `true` to re-enable it
2020-11-25 15:29:46 -05:00
Deluan 3e8bee4f65 Make eventStream connection/reconnection more reliable
Also more logs on the server
2020-11-20 20:27:30 -05:00
Deluan 666b058ce4 Request album covers when DevFastAccessCoverArt is true 2020-11-18 16:59:06 -05:00
Deluan a1dcb9a4e3 Show folders scanned instead of files scanned 2020-11-16 00:36:12 -05:00
Deluan 44d13bd37c Remove stray Printf 2020-11-14 13:38:31 -05:00
Deluan 1c7f859b5e Add more broker log 2020-11-14 00:44:58 -05:00
Deluan 08f96639f4 Add Uptime to Activity Panel 2020-11-13 20:09:23 -05:00
Deluan b64bb706f7 Use Gravatar in GetAvatar Subsonic API 2020-11-13 14:57:49 -05:00
Deluan 9d7995fd4d Redesign UserMenu, now with support for Gravatar 2020-11-13 00:40:30 -05:00
Deluan 08e63c867b Add config option to globally enable/disable downloads 2020-11-10 16:14:43 -05:00
Deluan bf69c5589f Fix log message 2020-11-10 14:46:12 -05:00
Deluan 8f2fe6f9fa Add buffer to broker SendMessage 2020-11-09 19:24:27 -05:00
Deluan 08dbf44529 Better broker logging 2020-11-09 19:24:04 -05:00
Deluan a2e76d6898 Add flag to enable activity menu 2020-11-09 16:12:50 -05:00
Deluan 56803d0151 Auto-reconnect to event stream after 20secs timeout 2020-11-09 16:12:50 -05:00
Deluan 2b1a5f579a Adding a communication channel between server and clients using SSE 2020-11-09 16:12:50 -05:00
Deluan 9cbeddae8f Avoid cross-site scripting
See: https://lgtm.com/rules/1510377426397/
2020-11-05 12:32:39 -05:00
Deluan 36596d4fdb Don't send the transcoded file if it is a HEAD request 2020-11-03 16:06:02 -05:00
Deluan ee5a0698c0 Simplify scanner utilization 2020-11-01 18:37:17 -05:00
Deluan 71b77cba2b Bump Subsonic API to 1.16.1 2020-11-01 17:04:53 -05:00