|
|
@ -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);
|
|
|
|