fix(tautulli): only test connection if hostname is defined (#3573)

pull/3574/head
TheCatLady 1 year ago committed by GitHub
parent a686d31e4d
commit f7b4dfcac4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -254,25 +254,27 @@ settingsRoutes.post('/tautulli', async (req, res, next) => {
Object.assign(settings.tautulli, req.body); Object.assign(settings.tautulli, req.body);
try { if (settings.tautulli.hostname) {
const tautulliClient = new TautulliAPI(settings.tautulli); try {
const tautulliClient = new TautulliAPI(settings.tautulli);
const result = await tautulliClient.getInfo(); const result = await tautulliClient.getInfo();
if (!semver.gte(semver.coerce(result?.tautulli_version) ?? '', '2.9.0')) { if (!semver.gte(semver.coerce(result?.tautulli_version) ?? '', '2.9.0')) {
throw new Error('Tautulli version not supported'); throw new Error('Tautulli version not supported');
} }
settings.save(); settings.save();
} catch (e) { } catch (e) {
logger.error('Something went wrong testing Tautulli connection', { logger.error('Something went wrong testing Tautulli connection', {
label: 'API', label: 'API',
errorMessage: e.message, errorMessage: e.message,
}); });
return next({ return next({
status: 500, status: 500,
message: 'Unable to connect to Tautulli.', message: 'Unable to connect to Tautulli.',
}); });
}
} }
return res.status(200).json(settings.tautulli); return res.status(200).json(settings.tautulli);

Loading…
Cancel
Save