mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-12-29 20:24:47 +03:00
Use new authorization and session functions
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using MediaBrowser.Controller.Net;
|
||||
using MediaBrowser.Controller.Session;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
|
||||
namespace Jellyfin.Api.Helpers
|
||||
{
|
||||
@@ -28,10 +29,17 @@ namespace Jellyfin.Api.Helpers
|
||||
: value.Split(separator);
|
||||
}
|
||||
|
||||
internal static SessionInfo GetSession(ISessionContext sessionContext)
|
||||
internal static SessionInfo GetSession(ISessionManager sessionManager, IAuthorizationContext authContext, HttpRequest request)
|
||||
{
|
||||
// TODO: how do we get a SessionInfo without IRequest?
|
||||
SessionInfo session = sessionContext.GetSession("Request");
|
||||
var authorization = authContext.GetAuthorizationInfo(request);
|
||||
var user = authorization.User;
|
||||
var session = sessionManager.LogSessionActivity(
|
||||
authorization.Client,
|
||||
authorization.Version,
|
||||
authorization.DeviceId,
|
||||
authorization.Device,
|
||||
request.HttpContext.Connection.RemoteIpAddress.ToString(),
|
||||
user);
|
||||
|
||||
if (session == null)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user