diff --git a/server/api/jellyfin.ts b/server/api/jellyfin.ts index d0c4d7c74..622415b17 100644 --- a/server/api/jellyfin.ts +++ b/server/api/jellyfin.ts @@ -1,6 +1,7 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ import ExternalAPI from '@server/api/externalapi'; import { ApiErrorCode } from '@server/constants/error'; +import { MediaServerType } from '@server/constants/server'; import availabilitySync from '@server/lib/availabilitySync'; import logger from '@server/logger'; import { ApiError } from '@server/types/error'; @@ -117,11 +118,20 @@ class JellyfinAPI extends ExternalAPI { public async login( Username?: string, Password?: string, - ClientIP?: string + ClientIP?: string, + serverType?: MediaServerType ): Promise { const authenticate = async (useHeaders: boolean) => { - const headers: { [key: string]: string } = - useHeaders && ClientIP ? { 'X-Forwarded-For': ClientIP } : {}; + let headers: { [key: string]: string } = {}; + if (useHeaders && ClientIP) { + headers = { 'X-Forwarded-For': ClientIP }; + } + if (serverType === MediaServerType.EMBY) { + headers = { + ...headers, + 'Accept-Encoding': 'gzip', + }; + } return this.post( '/Users/AuthenticateByName', diff --git a/server/routes/auth.ts b/server/routes/auth.ts index 19e99a8ed..458aab4cb 100644 --- a/server/routes/auth.ts +++ b/server/routes/auth.ts @@ -291,7 +291,8 @@ authRoutes.post('/jellyfin', async (req, res, next) => { const account = await jellyfinserver.login( body.username, body.password, - clientIp + clientIp, + body.serverType || settings.main.mediaServerType ); // Next let's see if the user already exists