mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-04-24 22:17:25 -04:00
Merge pull request #11738 from crobibero/non-user-session
Don't require user when getting current session
This commit is contained in:
commit
4fcbeef5e6
1 changed files with 6 additions and 1 deletions
|
@ -120,7 +120,12 @@ public static class RequestHelpers
|
||||||
internal static async Task<SessionInfo> GetSession(ISessionManager sessionManager, IUserManager userManager, HttpContext httpContext, Guid? userId = null)
|
internal static async Task<SessionInfo> GetSession(ISessionManager sessionManager, IUserManager userManager, HttpContext httpContext, Guid? userId = null)
|
||||||
{
|
{
|
||||||
userId ??= httpContext.User.GetUserId();
|
userId ??= httpContext.User.GetUserId();
|
||||||
var user = userManager.GetUserById(userId.Value);
|
User? user = null;
|
||||||
|
if (!userId.IsNullOrEmpty())
|
||||||
|
{
|
||||||
|
user = userManager.GetUserById(userId.Value);
|
||||||
|
}
|
||||||
|
|
||||||
var session = await sessionManager.LogSessionActivity(
|
var session = await sessionManager.LogSessionActivity(
|
||||||
httpContext.User.GetClient(),
|
httpContext.User.GetClient(),
|
||||||
httpContext.User.GetVersion(),
|
httpContext.User.GetVersion(),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue