aboutsummaryrefslogtreecommitdiff
path: root/Emby.Server.Implementations/HttpServer/Security/AuthorizationContext.cs
diff options
context:
space:
mode:
authorLuke Pulverenti <luke.pulverenti@gmail.com>2017-10-17 15:50:10 -0400
committerLuke Pulverenti <luke.pulverenti@gmail.com>2017-10-17 15:50:10 -0400
commit32e89f6debd79c4383320b2fbd42224fc2dce891 (patch)
tree799e6fb1b1acad0f39d5f3ab26496bbfbd5887cc /Emby.Server.Implementations/HttpServer/Security/AuthorizationContext.cs
parent7adb3e4a238dc9139ec6873546759ebc36444610 (diff)
resolve version changing in now playing display
Diffstat (limited to 'Emby.Server.Implementations/HttpServer/Security/AuthorizationContext.cs')
-rw-r--r--Emby.Server.Implementations/HttpServer/Security/AuthorizationContext.cs26
1 files changed, 24 insertions, 2 deletions
diff --git a/Emby.Server.Implementations/HttpServer/Security/AuthorizationContext.cs b/Emby.Server.Implementations/HttpServer/Security/AuthorizationContext.cs
index c9d5ed007..a41c51d1a 100644
--- a/Emby.Server.Implementations/HttpServer/Security/AuthorizationContext.cs
+++ b/Emby.Server.Implementations/HttpServer/Security/AuthorizationContext.cs
@@ -5,6 +5,7 @@ using System;
using System.Collections.Generic;
using MediaBrowser.Model.Services;
using System.Linq;
+using System.Threading;
namespace Emby.Server.Implementations.HttpServer.Security
{
@@ -95,23 +96,44 @@ namespace Emby.Server.Implementations.HttpServer.Security
{
info.UserId = tokenInfo.UserId;
+ var updateToken = false;
+
// TODO: Remove these checks for IsNullOrWhiteSpace
if (string.IsNullOrWhiteSpace(info.Client))
{
info.Client = tokenInfo.AppName;
}
+
+ if (string.IsNullOrWhiteSpace(info.DeviceId))
+ {
+ info.DeviceId = tokenInfo.DeviceId;
+ }
+
+
if (string.IsNullOrWhiteSpace(info.Device))
{
info.Device = tokenInfo.DeviceName;
}
- if (string.IsNullOrWhiteSpace(info.DeviceId))
+ else if (!string.Equals(info.Device, tokenInfo.DeviceName, StringComparison.OrdinalIgnoreCase))
{
- info.DeviceId = tokenInfo.DeviceId;
+ updateToken = true;
+ tokenInfo.DeviceName = info.Device;
}
+
if (string.IsNullOrWhiteSpace(info.Version))
{
info.Version = tokenInfo.AppVersion;
}
+ else if (!string.Equals(info.Version, tokenInfo.AppVersion, StringComparison.OrdinalIgnoreCase))
+ {
+ updateToken = true;
+ tokenInfo.AppVersion = info.Version;
+ }
+
+ if (updateToken)
+ {
+ _authRepo.Update(tokenInfo, CancellationToken.None);
+ }
}
else
{