Require ApiKey for all actions in SonarrImport

pull/5752/head
Bogdan 1 year ago committed by Mark McDowall
parent 2603138975
commit 19b8fbe13b

@ -87,37 +87,35 @@ namespace NzbDrone.Core.ImportLists.Sonarr
}; };
} }
Settings.Validate().Filter("ApiKey").ThrowOnError();
if (action == "getProfiles") if (action == "getProfiles")
{ {
Settings.Validate().Filter("ApiKey").ThrowOnError();
var profiles = _sonarrV3Proxy.GetQualityProfiles(Settings); var profiles = _sonarrV3Proxy.GetQualityProfiles(Settings);
return new return new
{ {
options = profiles.OrderBy(d => d.Name, StringComparer.InvariantCultureIgnoreCase) options = profiles.OrderBy(d => d.Name, StringComparer.InvariantCultureIgnoreCase)
.Select(d => new .Select(d => new
{ {
value = d.Id, value = d.Id,
name = d.Name name = d.Name
}) })
}; };
} }
if (action == "getLanguageProfiles") if (action == "getLanguageProfiles")
{ {
Settings.Validate().Filter("ApiKey").ThrowOnError();
var langProfiles = _sonarrV3Proxy.GetLanguageProfiles(Settings); var langProfiles = _sonarrV3Proxy.GetLanguageProfiles(Settings);
return new return new
{ {
options = langProfiles.OrderBy(d => d.Name, StringComparer.InvariantCultureIgnoreCase) options = langProfiles.OrderBy(d => d.Name, StringComparer.InvariantCultureIgnoreCase)
.Select(d => new .Select(d => new
{ {
value = d.Id, value = d.Id,
name = d.Name name = d.Name
}) })
}; };
} }
@ -138,18 +136,16 @@ namespace NzbDrone.Core.ImportLists.Sonarr
if (action == "getRootFolders") if (action == "getRootFolders")
{ {
Settings.Validate().Filter("ApiKey").ThrowOnError(); var remoteRootFolders = _sonarrV3Proxy.GetRootFolders(Settings);
var remoteRootfolders = _sonarrV3Proxy.GetRootFolders(Settings);
return new return new
{ {
options = remoteRootfolders.OrderBy(d => d.Path, StringComparer.InvariantCultureIgnoreCase) options = remoteRootFolders.OrderBy(d => d.Path, StringComparer.InvariantCultureIgnoreCase)
.Select(d => new .Select(d => new
{ {
value = d.Path, value = d.Path,
name = d.Path name = d.Path
}) })
}; };
} }

Loading…
Cancel
Save