mirror of
https://github.com/SoPat712/allstarr.git
synced 2026-02-09 15:45:10 -05:00
This commit is contained in:
@@ -1815,6 +1815,25 @@ public class JellyfinController : ControllerBase
|
||||
{
|
||||
_logger.LogInformation("🔧 Ensuring session exists for device: {DeviceId} ({Client} {Version})", deviceId, client, version);
|
||||
|
||||
// First, check if a session exists for this device
|
||||
try
|
||||
{
|
||||
var (sessionsResult, sessionsStatus) = await _proxyService.GetJsonAsync($"Sessions?deviceId={deviceId}", null, Request.Headers);
|
||||
if (sessionsResult != null && sessionsStatus == 200)
|
||||
{
|
||||
var sessions = sessionsResult.RootElement;
|
||||
_logger.LogInformation("📊 Jellyfin sessions for device {DeviceId}: {Sessions}", deviceId, sessions.GetRawText());
|
||||
}
|
||||
else
|
||||
{
|
||||
_logger.LogWarning("⚠ Could not query sessions ({StatusCode})", sessionsStatus);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogWarning(ex, "Failed to query sessions");
|
||||
}
|
||||
|
||||
// Post capabilities - Jellyfin will match this to the authenticated session by device ID
|
||||
// The query parameters tell Jellyfin what this device can do
|
||||
var capabilitiesEndpoint = $"Sessions/Capabilities/Full";
|
||||
@@ -1832,8 +1851,17 @@ public class JellyfinController : ControllerBase
|
||||
};
|
||||
|
||||
var capabilitiesJson = JsonSerializer.Serialize(capabilities);
|
||||
_logger.LogInformation("📤 Posting capabilities: {Json}", capabilitiesJson);
|
||||
var (capResult, capStatus) = await _proxyService.PostJsonAsync(capabilitiesEndpoint, capabilitiesJson, Request.Headers);
|
||||
_logger.LogInformation("✓ Session capabilities posted ({StatusCode})", capStatus);
|
||||
|
||||
// Check sessions again after posting capabilities
|
||||
var (sessionsResult2, sessionsStatus2) = await _proxyService.GetJsonAsync($"Sessions?deviceId={deviceId}", null, Request.Headers);
|
||||
if (sessionsResult2 != null && sessionsStatus2 == 200)
|
||||
{
|
||||
var sessions2 = sessionsResult2.RootElement;
|
||||
_logger.LogInformation("📊 Jellyfin sessions AFTER capabilities: {Sessions}", sessions2.GetRawText());
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user