mirror of
https://github.com/fallenbagel/jellyseerr.git
synced 2025-12-28 20:49:05 -05:00
Compare commits
2 Commits
v1.9.1
...
test-fix-i
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
166796804e | ||
|
|
9aeb3604e6 |
@@ -133,6 +133,11 @@ class JellyfinAPI extends ExternalAPI {
|
||||
}
|
||||
: {};
|
||||
|
||||
logger.debug(`Logging in to Jellyfin server: ${this.jellyfinHost}`, {
|
||||
label: 'Jellyfin API',
|
||||
clientIp: ClientIP,
|
||||
});
|
||||
|
||||
const authResponse = await this.post<JellyfinLoginResponse>(
|
||||
'/Users/AuthenticateByName',
|
||||
{
|
||||
@@ -146,6 +151,12 @@ class JellyfinAPI extends ExternalAPI {
|
||||
|
||||
return authResponse;
|
||||
} catch (e) {
|
||||
logger.error('Failed to login to Jellyfin server', {
|
||||
label: 'Jellyfin API',
|
||||
clientIp: ClientIP,
|
||||
error: e,
|
||||
});
|
||||
|
||||
const status = e.response?.status;
|
||||
|
||||
const networkErrorCodes = new Set([
|
||||
|
||||
@@ -14,6 +14,7 @@ import { ApiError } from '@server/types/error';
|
||||
import * as EmailValidator from 'email-validator';
|
||||
import { Router } from 'express';
|
||||
import gravatarUrl from 'gravatar-url';
|
||||
import net from 'net';
|
||||
|
||||
const authRoutes = Router();
|
||||
|
||||
@@ -271,11 +272,21 @@ authRoutes.post('/jellyfin', async (req, res, next) => {
|
||||
? jellyfinHost.slice(0, -1)
|
||||
: jellyfinHost;
|
||||
|
||||
const ip = req.ip ? req.ip.split(':').reverse()[0] : undefined;
|
||||
const ip = req.ip;
|
||||
let clientIp;
|
||||
|
||||
if (ip) {
|
||||
if (net.isIPv4(ip)) {
|
||||
clientIp = ip;
|
||||
} else if (net.isIPv6(ip)) {
|
||||
clientIp = ip.startsWith('::ffff:') ? ip.substring(7) : ip;
|
||||
}
|
||||
}
|
||||
|
||||
const account = await jellyfinserver.login(
|
||||
body.username,
|
||||
body.password,
|
||||
ip
|
||||
clientIp
|
||||
);
|
||||
|
||||
// Next let's see if the user already exists
|
||||
|
||||
Reference in New Issue
Block a user