mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-06-01 04:34:26 -04:00
Merge remote-tracking branch 'origin/authenticationdb-efcore' into authenticationdb-efcore
This commit is contained in:
commit
06d682c296
@ -293,7 +293,7 @@ namespace Emby.Server.Implementations.Session
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
user.LastActivityDate = activityDate;
|
user.LastActivityDate = activityDate;
|
||||||
await _userManager.UpdateUserAsync(user);
|
await _userManager.UpdateUserAsync(user).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
catch (DbUpdateConcurrencyException e)
|
catch (DbUpdateConcurrencyException e)
|
||||||
{
|
{
|
||||||
|
@ -170,6 +170,7 @@ namespace Jellyfin.Server.Implementations.Devices
|
|||||||
{
|
{
|
||||||
await using var dbContext = _dbProvider.CreateContext();
|
await using var dbContext = _dbProvider.CreateContext();
|
||||||
var sessions = dbContext.Devices
|
var sessions = dbContext.Devices
|
||||||
|
.Include(d => d.User)
|
||||||
.AsQueryable()
|
.AsQueryable()
|
||||||
.OrderBy(d => d.DeviceId)
|
.OrderBy(d => d.DeviceId)
|
||||||
.ThenByDescending(d => d.DateLastActivity)
|
.ThenByDescending(d => d.DateLastActivity)
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using Emby.Server.Implementations.Data;
|
using Emby.Server.Implementations.Data;
|
||||||
using Jellyfin.Data.Entities.Security;
|
using Jellyfin.Data.Entities.Security;
|
||||||
@ -53,9 +54,9 @@ namespace Jellyfin.Server.Migrations.Routines
|
|||||||
{
|
{
|
||||||
using var dbContext = _dbProvider.CreateContext();
|
using var dbContext = _dbProvider.CreateContext();
|
||||||
|
|
||||||
var queryResult = connection.Query("SELECT * FROM Tokens");
|
var authenticatedDevices = connection.Query("SELECT * FROM Tokens");
|
||||||
|
|
||||||
foreach (var row in queryResult)
|
foreach (var row in authenticatedDevices)
|
||||||
{
|
{
|
||||||
if (row[6].IsDbNull())
|
if (row[6].IsDbNull())
|
||||||
{
|
{
|
||||||
@ -83,6 +84,29 @@ namespace Jellyfin.Server.Migrations.Routines
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var deviceOptions = connection.Query("SELECT * FROM Devices");
|
||||||
|
var deviceIds = new HashSet<string>();
|
||||||
|
foreach (var row in deviceOptions)
|
||||||
|
{
|
||||||
|
if (row[2].IsDbNull())
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
var deviceId = row[2].ToString();
|
||||||
|
if (deviceIds.Contains(deviceId))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
deviceIds.Add(deviceId);
|
||||||
|
|
||||||
|
dbContext.DeviceOptions.Add(new DeviceOptions(deviceId)
|
||||||
|
{
|
||||||
|
CustomName = row[1].IsDbNull() ? null : row[1].ToString()
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
dbContext.SaveChanges();
|
dbContext.SaveChanges();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user