mirror of
https://github.com/sct/overseerr.git
synced 2025-12-30 09:41:37 +01:00
fix(backend): update jellyfin.ts for 10.8.0
This commit is contained in:
@@ -151,7 +151,9 @@ class JellyfinAPI {
|
||||
|
||||
public async getLibraries(): Promise<JellyfinLibrary[]> {
|
||||
try {
|
||||
const account = await this.axios.get<any>('/Library/MediaFolders');
|
||||
const account = await this.axios.get<any>(
|
||||
`/Users/${this.userId ?? 'Me'}/Views`
|
||||
);
|
||||
|
||||
const response: JellyfinLibrary[] = account.data.Items.filter(
|
||||
(Item: any) => {
|
||||
@@ -176,7 +178,7 @@ class JellyfinAPI {
|
||||
`Something went wrong while getting libraries from the Jellyfin server: ${e.message}`,
|
||||
{ label: 'Jellyfin API' }
|
||||
);
|
||||
throw new Error('Invalid auth token');
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -246,7 +246,7 @@ settingsRoutes.get('/jellyfin/library', async (req, res) => {
|
||||
if (req.query.sync) {
|
||||
const userRepository = getRepository(User);
|
||||
const admin = await userRepository.findOneOrFail({
|
||||
select: ['id', 'jellyfinAuthToken', 'jellyfinDeviceId'],
|
||||
select: ['id', 'jellyfinAuthToken', 'jellyfinDeviceId', 'jellyfinUserId'],
|
||||
order: { id: 'ASC' },
|
||||
});
|
||||
const jellyfinClient = new JellyfinAPI(
|
||||
@@ -255,6 +255,8 @@ settingsRoutes.get('/jellyfin/library', async (req, res) => {
|
||||
admin.jellyfinDeviceId ?? ''
|
||||
);
|
||||
|
||||
jellyfinClient.setUserId(admin.jellyfinUserId ?? '');
|
||||
|
||||
const libraries = await jellyfinClient.getLibraries();
|
||||
|
||||
const newLibraries: Library[] = libraries.map((library) => {
|
||||
|
||||
Reference in New Issue
Block a user