1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-12-16 11:37:58 +02:00
Sonarr/NzbDrone.Api/System/SystemModule.cs

38 lines
1.3 KiB
C#
Raw Normal View History

using Nancy;
using NzbDrone.Common;
using NzbDrone.Api.Extensions;
namespace NzbDrone.Api.System
{
public class SystemModule : NzbDroneApiModule
{
private readonly IEnvironmentProvider _environmentProvider;
public SystemModule(IEnvironmentProvider environmentProvider)
: base("system")
{
_environmentProvider = environmentProvider;
Get["/status"] = x => GetStatus();
}
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();
}
}
}