Browse Source

Merge pull request #1412 from MediaBrowser/beta

merge from beta
Luke 9 years ago
parent
commit
f58503b28c

+ 2 - 2
MediaBrowser.Api/ApiEntryPoint.cs

@@ -294,7 +294,7 @@ namespace MediaBrowser.Api
         public void OnTranscodeEndRequest(TranscodingJob job)
         public void OnTranscodeEndRequest(TranscodingJob job)
         {
         {
             job.ActiveRequestCount--;
             job.ActiveRequestCount--;
-            Logger.Debug("OnTranscodeEndRequest job.ActiveRequestCount={0}", job.ActiveRequestCount);
+            //Logger.Debug("OnTranscodeEndRequest job.ActiveRequestCount={0}", job.ActiveRequestCount);
             if (job.ActiveRequestCount <= 0)
             if (job.ActiveRequestCount <= 0)
             {
             {
                 PingTimer(job, false);
                 PingTimer(job, false);
@@ -307,7 +307,7 @@ namespace MediaBrowser.Api
                 throw new ArgumentNullException("playSessionId");
                 throw new ArgumentNullException("playSessionId");
             }
             }
 
 
-            Logger.Debug("PingTranscodingJob PlaySessionId={0}", playSessionId);
+            //Logger.Debug("PingTranscodingJob PlaySessionId={0}", playSessionId);
 
 
             var jobs = new List<TranscodingJob>();
             var jobs = new List<TranscodingJob>();
 
 

+ 2 - 1
MediaBrowser.Api/Session/SessionsService.cs

@@ -355,7 +355,8 @@ namespace MediaBrowser.Api.Session
         {
         {
             var result = _authRepo.Get(new AuthenticationInfoQuery
             var result = _authRepo.Get(new AuthenticationInfoQuery
             {
             {
-                IsActive = true
+                IsActive = true,
+                HasUser = false
             });
             });
 
 
             return ToOptimizedResult(result);
             return ToOptimizedResult(result);

+ 6 - 0
MediaBrowser.Controller/Security/AuthenticationInfoQuery.cs

@@ -27,6 +27,12 @@ namespace MediaBrowser.Controller.Security
         /// <value><c>null</c> if [is active] contains no value, <c>true</c> if [is active]; otherwise, <c>false</c>.</value>
         /// <value><c>null</c> if [is active] contains no value, <c>true</c> if [is active]; otherwise, <c>false</c>.</value>
         public bool? IsActive { get; set; }
         public bool? IsActive { get; set; }
 
 
+        /// <summary>
+        /// Gets or sets a value indicating whether this instance has user.
+        /// </summary>
+        /// <value><c>null</c> if [has user] contains no value, <c>true</c> if [has user]; otherwise, <c>false</c>.</value>
+        public bool? HasUser { get; set; }
+        
         /// <summary>
         /// <summary>
         /// Gets or sets the start index.
         /// Gets or sets the start index.
         /// </summary>
         /// </summary>

+ 18 - 2
MediaBrowser.Server.Implementations/HttpServer/SocketSharp/WebSocketSharpRequest.cs

@@ -136,11 +136,27 @@ namespace MediaBrowser.Server.Implementations.HttpServer.SocketSharp
             {
             {
                 return remoteIp ??
                 return remoteIp ??
                     (remoteIp = XForwardedFor ??
                     (remoteIp = XForwardedFor ??
-                                (XRealIp ??
-                                ((request.RemoteEndPoint != null) ? request.RemoteEndPoint.Address.ToString() : null)));
+                                (NormalizeIp(XRealIp) ??
+                                ((request.RemoteEndPoint != null) ? NormalizeIp(request.RemoteEndPoint.Address.ToString()) : null)));
             }
             }
         }
         }
 
 
+        private string NormalizeIp(string ip)
+        {
+            if (!string.IsNullOrWhiteSpace(ip))
+            {
+                // Handle ipv4 mapped to ipv6
+                const string srch = "::ffff:";
+                var index = ip.IndexOf(srch, StringComparison.OrdinalIgnoreCase);
+                if (index == 0)
+                {
+                    ip = ip.Substring(srch.Length);
+                }
+            }
+
+            return ip;
+        }
+
         public bool IsSecureConnection
         public bool IsSecureConnection
         {
         {
             get { return request.IsSecureConnection || XForwardedProtocol == "https"; }
             get { return request.IsSecureConnection || XForwardedProtocol == "https"; }

+ 12 - 0
MediaBrowser.Server.Implementations/Security/AuthenticationRepository.cs

@@ -185,6 +185,18 @@ namespace MediaBrowser.Server.Implementations.Security
                     cmd.Parameters.Add(cmd, "@IsActive", DbType.Boolean).Value = query.IsActive.Value;
                     cmd.Parameters.Add(cmd, "@IsActive", DbType.Boolean).Value = query.IsActive.Value;
                 }
                 }
 
 
+                if (query.HasUser.HasValue)
+                {
+                    if (query.HasUser.Value)
+                    {
+                        whereClauses.Add("UserId not null");
+                    }
+                    else
+                    {
+                        whereClauses.Add("UserId is null");
+                    }
+                }
+
                 var whereTextWithoutPaging = whereClauses.Count == 0 ?
                 var whereTextWithoutPaging = whereClauses.Count == 0 ?
                     string.Empty :
                     string.Empty :
                     " where " + string.Join(" AND ", whereClauses.ToArray());
                     " where " + string.Join(" AND ", whereClauses.ToArray());

+ 6 - 0
MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj

@@ -293,6 +293,9 @@
     <Content Include="dashboard-ui\scripts\secondaryitems.js">
     <Content Include="dashboard-ui\scripts\secondaryitems.js">
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     </Content>
     </Content>
+    <Content Include="dashboard-ui\scripts\serversecurity.js">
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </Content>
     <Content Include="dashboard-ui\scripts\shared.js">
     <Content Include="dashboard-ui\scripts\shared.js">
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     </Content>
     </Content>
@@ -323,6 +326,9 @@
     <Content Include="dashboard-ui\secondaryitems.html">
     <Content Include="dashboard-ui\secondaryitems.html">
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     </Content>
     </Content>
+    <Content Include="dashboard-ui\serversecurity.html">
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </Content>
     <Content Include="dashboard-ui\shared.html">
     <Content Include="dashboard-ui\shared.html">
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     </Content>
     </Content>

+ 1 - 1
SharedVersion.cs

@@ -1,4 +1,4 @@
 using System.Reflection;
 using System.Reflection;
 
 
 //[assembly: AssemblyVersion("3.0.*")]
 //[assembly: AssemblyVersion("3.0.*")]
-[assembly: AssemblyVersion("3.0.5814")]
+[assembly: AssemblyVersion("3.0.5816")]