mirror of
https://github.com/lidarr/Lidarr
synced 2024-12-30 19:45:57 +00:00
90fa261a00
stopped scheduler from running during integration tests.
48 lines
1.6 KiB
C#
48 lines
1.6 KiB
C#
using Nancy;
|
|
using Nancy.Routing;
|
|
using NzbDrone.Common;
|
|
using NzbDrone.Api.Extensions;
|
|
using System.Linq;
|
|
|
|
namespace NzbDrone.Api.System
|
|
{
|
|
public class SystemModule : NzbDroneApiModule
|
|
{
|
|
private readonly IEnvironmentProvider _environmentProvider;
|
|
private readonly IRouteCacheProvider _routeCacheProvider;
|
|
|
|
public SystemModule(IEnvironmentProvider environmentProvider, IRouteCacheProvider routeCacheProvider)
|
|
: base("system")
|
|
{
|
|
_environmentProvider = environmentProvider;
|
|
_routeCacheProvider = routeCacheProvider;
|
|
Get["/status"] = x => GetStatus();
|
|
Get["/routes"] = x => GetRoutes();
|
|
}
|
|
|
|
private Response GetStatus()
|
|
{
|
|
return new
|
|
{
|
|
Version = _environmentProvider.Version,
|
|
AppData = _environmentProvider.GetAppDataPath(),
|
|
IsAdmin = _environmentProvider.IsAdmin,
|
|
IsUserInteractive = _environmentProvider.IsUserInteractive,
|
|
BuildTime = _environmentProvider.BuildDateTime,
|
|
StartupPath = _environmentProvider.StartUpPath,
|
|
OsVersion = _environmentProvider.GetOsVersion(),
|
|
IsMono = EnvironmentProvider.IsMono,
|
|
IsProduction = EnvironmentProvider.IsProduction,
|
|
IsDebug = EnvironmentProvider.IsDebug,
|
|
IsLinux = EnvironmentProvider.IsLinux,
|
|
}.AsResponse();
|
|
|
|
}
|
|
|
|
|
|
private Response GetRoutes()
|
|
{
|
|
return _routeCacheProvider.GetCache().Values.AsResponse();
|
|
}
|
|
}
|
|
}
|