mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-07-09 03:04:24 -04:00
Merge pull request #10197 from thornbill/multiple-sessions
Remove one session per device id limitation
This commit is contained in:
commit
a35a74ce38
@ -1509,35 +1509,20 @@ namespace Emby.Server.Implementations.Session
|
|||||||
new DeviceQuery
|
new DeviceQuery
|
||||||
{
|
{
|
||||||
DeviceId = deviceId,
|
DeviceId = deviceId,
|
||||||
UserId = user.Id,
|
UserId = user.Id
|
||||||
Limit = 1
|
|
||||||
}).ConfigureAwait(false)).Items.FirstOrDefault();
|
|
||||||
|
|
||||||
var allExistingForDevice = (await _deviceManager.GetDevices(
|
|
||||||
new DeviceQuery
|
|
||||||
{
|
|
||||||
DeviceId = deviceId
|
|
||||||
}).ConfigureAwait(false)).Items;
|
}).ConfigureAwait(false)).Items;
|
||||||
|
|
||||||
foreach (var auth in allExistingForDevice)
|
foreach (var auth in existing)
|
||||||
{
|
{
|
||||||
if (existing is null || !string.Equals(auth.AccessToken, existing.AccessToken, StringComparison.Ordinal))
|
try
|
||||||
{
|
{
|
||||||
try
|
// Logout any existing sessions for the user on this device
|
||||||
{
|
await Logout(auth).ConfigureAwait(false);
|
||||||
await Logout(auth).ConfigureAwait(false);
|
}
|
||||||
}
|
catch (Exception ex)
|
||||||
catch (Exception ex)
|
{
|
||||||
{
|
_logger.LogError(ex, "Error while logging out existing session.");
|
||||||
_logger.LogError(ex, "Error while logging out.");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (existing is not null)
|
|
||||||
{
|
|
||||||
_logger.LogInformation("Reissuing access token: {Token}", existing.AccessToken);
|
|
||||||
return existing.AccessToken;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_logger.LogInformation("Creating new access token for user {0}", user.Id);
|
_logger.LogInformation("Creating new access token for user {0}", user.Id);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user