|
|
@ -1,18 +1,23 @@
|
|
|
|
using Nancy;
|
|
|
|
using Nancy;
|
|
|
|
|
|
|
|
using Nancy.Routing;
|
|
|
|
using NzbDrone.Common;
|
|
|
|
using NzbDrone.Common;
|
|
|
|
using NzbDrone.Api.Extensions;
|
|
|
|
using NzbDrone.Api.Extensions;
|
|
|
|
|
|
|
|
using System.Linq;
|
|
|
|
|
|
|
|
|
|
|
|
namespace NzbDrone.Api.System
|
|
|
|
namespace NzbDrone.Api.System
|
|
|
|
{
|
|
|
|
{
|
|
|
|
public class SystemModule : NzbDroneApiModule
|
|
|
|
public class SystemModule : NzbDroneApiModule
|
|
|
|
{
|
|
|
|
{
|
|
|
|
private readonly IEnvironmentProvider _environmentProvider;
|
|
|
|
private readonly IEnvironmentProvider _environmentProvider;
|
|
|
|
|
|
|
|
private readonly IRouteCacheProvider _routeCacheProvider;
|
|
|
|
|
|
|
|
|
|
|
|
public SystemModule(IEnvironmentProvider environmentProvider)
|
|
|
|
public SystemModule(IEnvironmentProvider environmentProvider, IRouteCacheProvider routeCacheProvider)
|
|
|
|
: base("system")
|
|
|
|
: base("system")
|
|
|
|
{
|
|
|
|
{
|
|
|
|
_environmentProvider = environmentProvider;
|
|
|
|
_environmentProvider = environmentProvider;
|
|
|
|
|
|
|
|
_routeCacheProvider = routeCacheProvider;
|
|
|
|
Get["/status"] = x => GetStatus();
|
|
|
|
Get["/status"] = x => GetStatus();
|
|
|
|
|
|
|
|
Get["/routes"] = x => GetRoutes();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private Response GetStatus()
|
|
|
|
private Response GetStatus()
|
|
|
@ -29,9 +34,15 @@ namespace NzbDrone.Api.System
|
|
|
|
IsMono = EnvironmentProvider.IsMono,
|
|
|
|
IsMono = EnvironmentProvider.IsMono,
|
|
|
|
IsProduction = EnvironmentProvider.IsProduction,
|
|
|
|
IsProduction = EnvironmentProvider.IsProduction,
|
|
|
|
IsDebug = EnvironmentProvider.IsDebug,
|
|
|
|
IsDebug = EnvironmentProvider.IsDebug,
|
|
|
|
IsLinux = EnvironmentProvider.IsLinux
|
|
|
|
IsLinux = EnvironmentProvider.IsLinux,
|
|
|
|
}.AsResponse();
|
|
|
|
}.AsResponse();
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private Response GetRoutes()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return _routeCacheProvider.GetCache().Values.AsResponse();
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|