From b5acc09ba98e2dd9b61e6b78721e4dd9f42a996c Mon Sep 17 00:00:00 2001 From: fallenbagel <98979876+Fallenbagel@users.noreply.github.com> Date: Tue, 7 Nov 2023 01:47:54 +0500 Subject: [PATCH] revert(jellyfinapi): reverts #450 as it broke library sync support for local accounts using LDAP Reverted #450 which addressed the issue where the automatic grouping enabled libraries were not functioning correctly. The previous fix inadvertently caused a bug for Jellyfin LDAP users, preventing library syncing with a 401 error. Reverting this change temporarily until support for automatic library grouping can be re-implemented fix #489 --- server/api/jellyfin.ts | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/server/api/jellyfin.ts b/server/api/jellyfin.ts index de4e6b7cf..a2fc4b224 100644 --- a/server/api/jellyfin.ts +++ b/server/api/jellyfin.ts @@ -171,25 +171,31 @@ class JellyfinAPI { public async getLibraries(): Promise { try { - const libraries = await this.axios.get('/Library/VirtualFolders'); + // TODO: Try to fix automatic grouping without fucking up LDAP users + // const libraries = await this.axios.get('/Library/VirtualFolders'); - const response: JellyfinLibrary[] = libraries.data - .filter((Item: any) => { + const account = await this.axios.get( + `/Users/${this.userId ?? 'Me'}/Views` + ); + + const response: JellyfinLibrary[] = account.data.Items.filter( + (Item: any) => { return ( + Item.Type === 'CollectionFolder' && Item.CollectionType !== 'music' && Item.CollectionType !== 'books' && Item.CollectionType !== 'musicvideos' && Item.CollectionType !== 'homevideos' ); - }) - .map((Item: any) => { - return { - key: Item.ItemId, - title: Item.Name, - type: Item.CollectionType === 'movies' ? 'movie' : 'show', - agent: 'jellyfin', - }; - }); + } + ).map((Item: any) => { + return { + key: Item.Id, + title: Item.Name, + type: Item.CollectionType === 'movies' ? 'movie' : 'show', + agent: 'jellyfin', + }; + }); return response; } catch (e) {