소스 검색

Populate authentication info with server details if using API key

Cody Robibero 3 년 전
부모
커밋
a532a866e3
1개의 변경된 파일10개의 추가작업 그리고 4개의 파일을 삭제
  1. 10 4
      Jellyfin.Server.Implementations/Security/AuthorizationContext.cs

+ 10 - 4
Jellyfin.Server.Implementations/Security/AuthorizationContext.cs

@@ -4,6 +4,7 @@ using System;
 using System.Collections.Generic;
 using System.Collections.Generic;
 using System.Net;
 using System.Net;
 using System.Threading.Tasks;
 using System.Threading.Tasks;
+using MediaBrowser.Controller;
 using MediaBrowser.Controller.Library;
 using MediaBrowser.Controller.Library;
 using MediaBrowser.Controller.Net;
 using MediaBrowser.Controller.Net;
 using Microsoft.AspNetCore.Http;
 using Microsoft.AspNetCore.Http;
@@ -16,11 +17,16 @@ namespace Jellyfin.Server.Implementations.Security
     {
     {
         private readonly JellyfinDbProvider _jellyfinDbProvider;
         private readonly JellyfinDbProvider _jellyfinDbProvider;
         private readonly IUserManager _userManager;
         private readonly IUserManager _userManager;
+        private readonly IServerApplicationHost _serverApplicationHost;
 
 
-        public AuthorizationContext(JellyfinDbProvider jellyfinDb, IUserManager userManager)
+        public AuthorizationContext(
+            JellyfinDbProvider jellyfinDb,
+            IUserManager userManager,
+            IServerApplicationHost serverApplicationHost)
         {
         {
             _jellyfinDbProvider = jellyfinDb;
             _jellyfinDbProvider = jellyfinDb;
             _userManager = userManager;
             _userManager = userManager;
+            _serverApplicationHost = serverApplicationHost;
         }
         }
 
 
         public Task<AuthorizationInfo> GetAuthorizationInfo(HttpContext requestContext)
         public Task<AuthorizationInfo> GetAuthorizationInfo(HttpContext requestContext)
@@ -187,17 +193,17 @@ namespace Jellyfin.Server.Implementations.Security
                     authInfo.Token = key.AccessToken;
                     authInfo.Token = key.AccessToken;
                     if (string.IsNullOrWhiteSpace(authInfo.DeviceId))
                     if (string.IsNullOrWhiteSpace(authInfo.DeviceId))
                     {
                     {
-                        authInfo.DeviceId = string.Empty;
+                        authInfo.DeviceId = _serverApplicationHost.SystemId;
                     }
                     }
 
 
                     if (string.IsNullOrWhiteSpace(authInfo.Device))
                     if (string.IsNullOrWhiteSpace(authInfo.Device))
                     {
                     {
-                        authInfo.Device = string.Empty;
+                        authInfo.Device = _serverApplicationHost.Name;
                     }
                     }
 
 
                     if (string.IsNullOrWhiteSpace(authInfo.Version))
                     if (string.IsNullOrWhiteSpace(authInfo.Version))
                     {
                     {
-                        authInfo.Version = string.Empty;
+                        authInfo.Version = _serverApplicationHost.ApplicationVersionString;
                     }
                     }
 
 
                     authInfo.IsApiKey = true;
                     authInfo.IsApiKey = true;