fix: minor compatibility with emby for retrieving albums
This commit is contained in:
@@ -36,7 +36,9 @@ export async function retrieveAlbum(id: string): Promise<Album> {
|
||||
const latestAlbumsOptions = {
|
||||
IncludeItemTypes: 'MusicAlbum',
|
||||
Fields: 'DateCreated',
|
||||
SortOrder: 'Ascending',
|
||||
SortOrder: 'Descending',
|
||||
SortBy: 'DateCreated',
|
||||
Recursive: 'true',
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -51,7 +53,8 @@ export async function retrieveRecentAlbums(numberOfAlbums = 24) {
|
||||
const params = new URLSearchParams(options).toString();
|
||||
|
||||
// Retrieve albums
|
||||
return fetchApi<Album[]>(({ user_id }) => `/Users/${user_id}/Items/Latest?${params}`);
|
||||
return fetchApi<{ Items: Album[] }>(({ user_id }) => `/Users/${user_id}/Items?${params}`)
|
||||
.then((d) => d.Items);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
import type { AppState, Store } from '@/store';
|
||||
import { Platform } from 'react-native';
|
||||
import { version } from '../../../package.json';
|
||||
|
||||
type Credentials = AppState['settings']['jellyfin'];
|
||||
|
||||
@@ -10,7 +12,7 @@ type Credentials = AppState['settings']['jellyfin'];
|
||||
function generateConfig(credentials: Credentials): RequestInit {
|
||||
return {
|
||||
headers: {
|
||||
'X-Emby-Authorization': `MediaBrowser Client="", Device="", DeviceId="", Version="", Token="${credentials?.access_token}"`
|
||||
'X-Emby-Authorization': `MediaBrowser Client="Fintunes", Device="${Platform.OS}", DeviceId="${credentials?.device_id}", Version="${version}", Token="${credentials?.access_token}"`
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user