fix(backend): fix jellyfinHost to not be undefined

Fix jellyfinHost so its not being treated as null or undefined

fix #237
This commit is contained in:
Fallenbagel
2022-10-16 03:50:22 +05:00
parent 0faae20bac
commit ab09664d41
4 changed files with 22 additions and 11 deletions

View File

@@ -245,10 +245,13 @@ authRoutes.post('/jellyfin', async (req, res, next) => {
// First we need to attempt to log the user in to jellyfin
const jellyfinserver = new JellyfinAPI(hostname ?? '', undefined, deviceId);
let jellyfinHost =
externalHostname && externalHostname.length > 0
? externalHostname
: hostname;
jellyfinHost = jellyfinHost.endsWith("/") ? jellyfinHost.slice(0, -1) : jellyfinHost;
externalHostname && externalHostname.length > 0
? externalHostname
: hostname;
jellyfinHost = jellyfinHost!.endsWith('/')
? jellyfinHost!.slice(0, -1)
: jellyfinHost;
const account = await jellyfinserver.login(body.username, body.password);
// Next let's see if the user already exists