aboutsummaryrefslogtreecommitdiff
path: root/Jellyfin.Server.Implementations
diff options
context:
space:
mode:
authorLJQ <leejunquan7@gmail.com>2023-10-17 17:25:41 +0800
committerLJQ <leejunquan7@gmail.com>2023-10-17 17:25:41 +0800
commit259fe4522c4fdcd7467500780fc70ccd75108bf2 (patch)
tree74b998371579ca832a31f9565462398bffaf78f3 /Jellyfin.Server.Implementations
parent6fce863146edd6ab33b09e18025cce97cc9e85f5 (diff)
Update /Device endpoint to return CustomName
Diffstat (limited to 'Jellyfin.Server.Implementations')
-rw-r--r--Jellyfin.Server.Implementations/Devices/DeviceManager.cs10
1 files changed, 9 insertions, 1 deletions
diff --git a/Jellyfin.Server.Implementations/Devices/DeviceManager.cs b/Jellyfin.Server.Implementations/Devices/DeviceManager.cs
index a4b4c1959..80abe01ab 100644
--- a/Jellyfin.Server.Implementations/Devices/DeviceManager.cs
+++ b/Jellyfin.Server.Implementations/Devices/DeviceManager.cs
@@ -177,7 +177,7 @@ namespace Jellyfin.Server.Implementations.Devices
.OrderByDescending(d => d.DateLastActivity)
.ThenBy(d => d.DeviceId)
.AsAsyncEnumerable();
-
+ IAsyncEnumerable<DeviceOptions> deviceOptions = dbContext.DeviceOptions.AsAsyncEnumerable();
if (supportsSync.HasValue)
{
sessions = sessions.Where(i => GetCapabilities(i.DeviceId).SupportsSync == supportsSync.Value);
@@ -195,6 +195,14 @@ namespace Jellyfin.Server.Implementations.Devices
}
var array = await sessions.Select(device => ToDeviceInfo(device)).ToArrayAsync().ConfigureAwait(false);
+ await foreach (var deviceOption in deviceOptions)
+ {
+ var deviceInfo = array.FirstOrDefault(d => d.Id.Equals(deviceOption.DeviceId, StringComparison.OrdinalIgnoreCase));
+ if (deviceInfo != null)
+ {
+ deviceInfo.CustomName = deviceOption.CustomName;
+ }
+ }
return new QueryResult<DeviceInfo>(array);
}