aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Api/System/SystemService.cs
diff options
context:
space:
mode:
Diffstat (limited to 'MediaBrowser.Api/System/SystemService.cs')
-rw-r--r--MediaBrowser.Api/System/SystemService.cs27
1 files changed, 26 insertions, 1 deletions
diff --git a/MediaBrowser.Api/System/SystemService.cs b/MediaBrowser.Api/System/SystemService.cs
index 3913275ee..cb9d01956 100644
--- a/MediaBrowser.Api/System/SystemService.cs
+++ b/MediaBrowser.Api/System/SystemService.cs
@@ -1,5 +1,6 @@
using MediaBrowser.Common.Configuration;
using MediaBrowser.Common.IO;
+using MediaBrowser.Common.Net;
using MediaBrowser.Controller;
using MediaBrowser.Controller.Net;
using MediaBrowser.Model.System;
@@ -49,6 +50,13 @@ namespace MediaBrowser.Api.System
{
}
+ [Route("/System/Endpoint", "GET", Summary = "Gets information about the request endpoint")]
+ [Authenticated]
+ public class GetEndpointInfo : IReturn<EndpointInfo>
+ {
+ public string Endpoint { get; set; }
+ }
+
[Route("/System/Logs/Log", "GET", Summary = "Gets a log file")]
public class GetLogFile
{
@@ -68,6 +76,8 @@ namespace MediaBrowser.Api.System
private readonly IApplicationPaths _appPaths;
private readonly IFileSystem _fileSystem;
+ private readonly INetworkManager _network;
+
/// <summary>
/// Initializes a new instance of the <see cref="SystemService" /> class.
/// </summary>
@@ -75,11 +85,12 @@ namespace MediaBrowser.Api.System
/// <param name="appPaths">The application paths.</param>
/// <param name="fileSystem">The file system.</param>
/// <exception cref="ArgumentNullException">jsonSerializer</exception>
- public SystemService(IServerApplicationHost appHost, IApplicationPaths appPaths, IFileSystem fileSystem)
+ public SystemService(IServerApplicationHost appHost, IApplicationPaths appPaths, IFileSystem fileSystem, INetworkManager network)
{
_appHost = appHost;
_appPaths = appPaths;
_fileSystem = fileSystem;
+ _network = network;
}
public object Get(GetServerLogs request)
@@ -174,5 +185,19 @@ namespace MediaBrowser.Api.System
});
}
+ public object Get(GetEndpointInfo request)
+ {
+ return ToOptimizedResult(new EndpointInfo
+ {
+ IsLocal = Request.IsLocal,
+ IsInNetwork = _network.IsInLocalNetwork(request.Endpoint ?? Request.RemoteIp)
+ });
+ }
+ }
+
+ public class EndpointInfo
+ {
+ public bool IsLocal { get; set; }
+ public bool IsInNetwork { get; set; }
}
}