aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Api
diff options
context:
space:
mode:
Diffstat (limited to 'MediaBrowser.Api')
-rw-r--r--MediaBrowser.Api/MediaBrowser.Api.csproj4
-rw-r--r--MediaBrowser.Api/System/SystemService.cs27
2 files changed, 29 insertions, 2 deletions
diff --git a/MediaBrowser.Api/MediaBrowser.Api.csproj b/MediaBrowser.Api/MediaBrowser.Api.csproj
index 9e516f463a..5cb9ebb1b0 100644
--- a/MediaBrowser.Api/MediaBrowser.Api.csproj
+++ b/MediaBrowser.Api/MediaBrowser.Api.csproj
@@ -49,6 +49,9 @@
<RunPostBuildEvent>Always</RunPostBuildEvent>
</PropertyGroup>
<ItemGroup>
+ <Reference Include="MoreLinq">
+ <HintPath>..\packages\morelinq.1.0.16006\lib\net35\MoreLinq.dll</HintPath>
+ </Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="Microsoft.CSharp" />
@@ -161,7 +164,6 @@
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
- <ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>
diff --git a/MediaBrowser.Api/System/SystemService.cs b/MediaBrowser.Api/System/SystemService.cs
index 3913275eee..cb9d019566 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; }
}
}