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)
|
if (!isExternal)
|
||||||
{
|
{
|
||||||
// Redirect to Jellyfin directly for local content images
|
// Proxy image from Jellyfin for local content
|
||||||
var queryString = new List<string>();
|
var (imageBytes, contentType) = await _proxyService.GetImageAsync(
|
||||||
if (maxWidth.HasValue) queryString.Add($"maxWidth={maxWidth.Value}");
|
itemId,
|
||||||
if (maxHeight.HasValue) queryString.Add($"maxHeight={maxHeight.Value}");
|
imageType,
|
||||||
|
maxWidth,
|
||||||
|
maxHeight);
|
||||||
|
|
||||||
var path = $"Items/{itemId}/Images/{imageType}";
|
if (imageBytes == null || contentType == null)
|
||||||
if (imageIndex > 0)
|
|
||||||
{
|
{
|
||||||
path = $"Items/{itemId}/Images/{imageType}/{imageIndex}";
|
return NotFound();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (queryString.Any())
|
return File(imageBytes, contentType);
|
||||||
{
|
|
||||||
path = $"{path}?{string.Join("&", queryString)}";
|
|
||||||
}
|
|
||||||
|
|
||||||
var jellyfinUrl = $"{_settings.Url?.TrimEnd('/')}/{path}";
|
|
||||||
return Redirect(jellyfinUrl);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get external cover art URL
|
// Get external cover art URL
|
||||||
|
|||||||
Reference in New Issue
Block a user