mirror of
https://github.com/kilyabin/psysonic.git
synced 2026-07-22 06:25:41 +00:00
feat(search): queue pasted share links from Live Search and mobile search
Implement share-link detection in search (track, queue, album, artist, composer): enqueue tracks/queues without interrupting playback; preview album/artist/composer without switching the active server; queue preview modal with scrollable track list. Based on community PR #551. Co-authored-by: Daniel Wagner <daniel.iuser@icloud.com>
This commit is contained in:
@@ -10,7 +10,14 @@
|
||||
* Network-bound endpoints (`getAlbum`, `search`, etc.) require axios
|
||||
* mocking and are not in this PR.
|
||||
*/
|
||||
import { buildCoverArtUrl, buildDownloadUrl, buildStreamUrl, coverArtCacheKey } from './subsonicStreamUrl';
|
||||
import {
|
||||
buildCoverArtUrl,
|
||||
buildCoverArtUrlForServer,
|
||||
buildDownloadUrl,
|
||||
buildStreamUrl,
|
||||
coverArtCacheKey,
|
||||
coverArtCacheKeyForServer,
|
||||
} from './subsonicStreamUrl';
|
||||
import { beforeEach, describe, expect, it } from 'vitest';
|
||||
import { parseSubsonicEntityStarRating } from './subsonicRatings';
|
||||
import { getClient, libraryFilterParams } from './subsonicClient';
|
||||
@@ -173,6 +180,24 @@ describe('buildCoverArtUrl', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('buildCoverArtUrlForServer', () => {
|
||||
it('builds getCoverArt URL with explicit server credentials', () => {
|
||||
const url = new URL(buildCoverArtUrlForServer('https://remote.example', 'bob', 'secret', 'art-9', 40));
|
||||
expect(url.origin).toBe('https://remote.example');
|
||||
expect(url.pathname).toBe('/rest/getCoverArt.view');
|
||||
expect(url.searchParams.get('id')).toBe('art-9');
|
||||
expect(url.searchParams.get('size')).toBe('40');
|
||||
expect(url.searchParams.get('u')).toBe('bob');
|
||||
expect(url.searchParams.get('t')).toBeTruthy();
|
||||
});
|
||||
});
|
||||
|
||||
describe('coverArtCacheKeyForServer', () => {
|
||||
it('scopes cache keys by server id', () => {
|
||||
expect(coverArtCacheKeyForServer('srv-b', 'cover-1', 80)).toBe('srv-b:cover:cover-1:80');
|
||||
});
|
||||
});
|
||||
|
||||
describe('buildDownloadUrl', () => {
|
||||
it('returns a /rest/download.view URL with id + auth params', () => {
|
||||
setUpServer({ url: 'https://music.example.com' });
|
||||
|
||||
Reference in New Issue
Block a user