mirror of
https://github.com/SoPat712/allstarr.git
synced 2026-02-09 23:55:10 -05:00
websocket 2.0
This commit is contained in:
@@ -148,6 +148,15 @@ public class JellyfinProxyService
|
|||||||
|
|
||||||
bool authHeaderAdded = false;
|
bool authHeaderAdded = false;
|
||||||
|
|
||||||
|
// Check if this is a browser request for static assets (favicon, etc.)
|
||||||
|
bool isBrowserStaticRequest = url.Contains("/favicon.ico", StringComparison.OrdinalIgnoreCase) ||
|
||||||
|
url.Contains("/web/", StringComparison.OrdinalIgnoreCase) ||
|
||||||
|
(clientHeaders?.Any(h => h.Key.Equals("User-Agent", StringComparison.OrdinalIgnoreCase) &&
|
||||||
|
h.Value.ToString().Contains("Mozilla", StringComparison.OrdinalIgnoreCase)) == true &&
|
||||||
|
clientHeaders?.Any(h => h.Key.Equals("sec-fetch-dest", StringComparison.OrdinalIgnoreCase) &&
|
||||||
|
(h.Value.ToString().Contains("image", StringComparison.OrdinalIgnoreCase) ||
|
||||||
|
h.Value.ToString().Contains("document", StringComparison.OrdinalIgnoreCase))) == true);
|
||||||
|
|
||||||
// Forward authentication headers from client if provided
|
// Forward authentication headers from client if provided
|
||||||
if (clientHeaders != null && clientHeaders.Count > 0)
|
if (clientHeaders != null && clientHeaders.Count > 0)
|
||||||
{
|
{
|
||||||
@@ -195,20 +204,21 @@ public class JellyfinProxyService
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!authHeaderAdded)
|
// Only log warnings for non-browser static requests
|
||||||
|
if (!authHeaderAdded && !isBrowserStaticRequest)
|
||||||
{
|
{
|
||||||
_logger.LogWarning("✗ No auth header found. Available headers: {Headers}",
|
_logger.LogWarning("✗ No auth header found. Available headers: {Headers}",
|
||||||
string.Join(", ", clientHeaders.Select(h => $"{h.Key}={h.Value}")));
|
string.Join(", ", clientHeaders.Select(h => $"{h.Key}={h.Value}")));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else if (!isBrowserStaticRequest)
|
||||||
{
|
{
|
||||||
_logger.LogWarning("✗ No client headers provided for {Url}", url);
|
_logger.LogWarning("✗ No client headers provided for {Url}", url);
|
||||||
}
|
}
|
||||||
|
|
||||||
// DO NOT use server API key as fallback - let Jellyfin handle unauthenticated requests
|
// DO NOT use server API key as fallback - let Jellyfin handle unauthenticated requests
|
||||||
// If client doesn't provide auth, they get what they deserve (401 from Jellyfin)
|
// If client doesn't provide auth, they get what they deserve (401 from Jellyfin)
|
||||||
if (!authHeaderAdded)
|
if (!authHeaderAdded && !isBrowserStaticRequest)
|
||||||
{
|
{
|
||||||
_logger.LogInformation("No client auth provided for {Url} - forwarding without auth", url);
|
_logger.LogInformation("No client auth provided for {Url} - forwarding without auth", url);
|
||||||
}
|
}
|
||||||
@@ -229,7 +239,7 @@ public class JellyfinProxyService
|
|||||||
{
|
{
|
||||||
_logger.LogWarning("Jellyfin returned 401 Unauthorized for {Url} - passing through to client", url);
|
_logger.LogWarning("Jellyfin returned 401 Unauthorized for {Url} - passing through to client", url);
|
||||||
}
|
}
|
||||||
else
|
else if (!isBrowserStaticRequest) // Don't log 404s for browser static requests
|
||||||
{
|
{
|
||||||
_logger.LogWarning("Jellyfin request failed: {StatusCode} for {Url}", response.StatusCode, url);
|
_logger.LogWarning("Jellyfin request failed: {StatusCode} for {Url}", response.StatusCode, url);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user