mirror of
https://github.com/SoPat712/allstarr.git
synced 2026-02-09 23:55:10 -05:00
Fix GetImage endpoint to proxy images instead of redirecting
This commit is contained in:
@@ -940,24 +940,19 @@ public class JellyfinController : ControllerBase
|
||||
|
||||
if (!isExternal)
|
||||
{
|
||||
// Redirect to Jellyfin directly for local content images
|
||||
var queryString = new List<string>();
|
||||
if (maxWidth.HasValue) queryString.Add($"maxWidth={maxWidth.Value}");
|
||||
if (maxHeight.HasValue) queryString.Add($"maxHeight={maxHeight.Value}");
|
||||
// Proxy image from Jellyfin for local content
|
||||
var (imageBytes, contentType) = await _proxyService.GetImageAsync(
|
||||
itemId,
|
||||
imageType,
|
||||
maxWidth,
|
||||
maxHeight);
|
||||
|
||||
var path = $"Items/{itemId}/Images/{imageType}";
|
||||
if (imageIndex > 0)
|
||||
if (imageBytes == null || contentType == null)
|
||||
{
|
||||
path = $"Items/{itemId}/Images/{imageType}/{imageIndex}";
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
if (queryString.Any())
|
||||
{
|
||||
path = $"{path}?{string.Join("&", queryString)}";
|
||||
}
|
||||
|
||||
var jellyfinUrl = $"{_settings.Url?.TrimEnd('/')}/{path}";
|
||||
return Redirect(jellyfinUrl);
|
||||
return File(imageBytes, contentType);
|
||||
}
|
||||
|
||||
// Get external cover art URL
|
||||
|
||||
Reference in New Issue
Block a user