From fda7ff5bf2795cb03ee2a5355c8003da31bf24f9 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Tue, 19 Aug 2014 18:28:35 -0400 Subject: chromecast updates --- MediaBrowser.Api/System/SystemService.cs | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) (limited to 'MediaBrowser.Api/System/SystemService.cs') 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 + { + 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; + /// /// Initializes a new instance of the class. /// @@ -75,11 +85,12 @@ namespace MediaBrowser.Api.System /// The application paths. /// The file system. /// jsonSerializer - 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; } } } -- cgit v1.2.3