mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-01-07 20:50:18 -05:00
Merge commit from fork
Remove server side processing for profile picture and splash screen
This commit is contained in:
commit
a2c0799489
@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||
using System.Collections.Immutable;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Drawing;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
@ -1458,19 +1459,6 @@ public class ImageController : BaseJellyfinApiController
|
||||
/// <param name="userId">User id.</param>
|
||||
/// <param name="tag">Optional. Supply the cache tag from the item object to receive strong caching headers.</param>
|
||||
/// <param name="format">Determines the output format of the image - original,gif,jpg,png.</param>
|
||||
/// <param name="maxWidth">The maximum image width to return.</param>
|
||||
/// <param name="maxHeight">The maximum image height to return.</param>
|
||||
/// <param name="percentPlayed">Optional. Percent to render for the percent played overlay.</param>
|
||||
/// <param name="unplayedCount">Optional. Unplayed count overlay to render.</param>
|
||||
/// <param name="width">The fixed image width to return.</param>
|
||||
/// <param name="height">The fixed image height to return.</param>
|
||||
/// <param name="quality">Optional. Quality setting, from 0-100. Defaults to 90 and should suffice in most cases.</param>
|
||||
/// <param name="fillWidth">Width of box to fill.</param>
|
||||
/// <param name="fillHeight">Height of box to fill.</param>
|
||||
/// <param name="blur">Optional. Blur image.</param>
|
||||
/// <param name="backgroundColor">Optional. Apply a background color for transparent images.</param>
|
||||
/// <param name="foregroundLayer">Optional. Apply a foreground layer on top of the image.</param>
|
||||
/// <param name="imageIndex">Image index.</param>
|
||||
/// <response code="200">Image stream returned.</response>
|
||||
/// <response code="400">User id not provided.</response>
|
||||
/// <response code="404">Item not found.</response>
|
||||
@ -1487,20 +1475,7 @@ public class ImageController : BaseJellyfinApiController
|
||||
public async Task<ActionResult> GetUserImage(
|
||||
[FromQuery] Guid? userId,
|
||||
[FromQuery] string? tag,
|
||||
[FromQuery] ImageFormat? format,
|
||||
[FromQuery] int? maxWidth,
|
||||
[FromQuery] int? maxHeight,
|
||||
[FromQuery] double? percentPlayed,
|
||||
[FromQuery] int? unplayedCount,
|
||||
[FromQuery] int? width,
|
||||
[FromQuery] int? height,
|
||||
[FromQuery] int? quality,
|
||||
[FromQuery] int? fillWidth,
|
||||
[FromQuery] int? fillHeight,
|
||||
[FromQuery] int? blur,
|
||||
[FromQuery] string? backgroundColor,
|
||||
[FromQuery] string? foregroundLayer,
|
||||
[FromQuery] int? imageIndex)
|
||||
[FromQuery] ImageFormat? format)
|
||||
{
|
||||
var requestUserId = userId ?? User.GetUserId();
|
||||
if (requestUserId.IsEmpty())
|
||||
@ -1521,34 +1496,24 @@ public class ImageController : BaseJellyfinApiController
|
||||
DateModified = user.ProfileImage.LastModified
|
||||
};
|
||||
|
||||
if (width.HasValue)
|
||||
{
|
||||
info.Width = width.Value;
|
||||
}
|
||||
|
||||
if (height.HasValue)
|
||||
{
|
||||
info.Height = height.Value;
|
||||
}
|
||||
|
||||
return await GetImageInternal(
|
||||
user.Id,
|
||||
ImageType.Profile,
|
||||
imageIndex,
|
||||
null,
|
||||
tag,
|
||||
format,
|
||||
maxWidth,
|
||||
maxHeight,
|
||||
percentPlayed,
|
||||
unplayedCount,
|
||||
width,
|
||||
height,
|
||||
quality,
|
||||
fillWidth,
|
||||
fillHeight,
|
||||
blur,
|
||||
backgroundColor,
|
||||
foregroundLayer,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
90,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
info)
|
||||
.ConfigureAwait(false);
|
||||
@ -1608,20 +1573,7 @@ public class ImageController : BaseJellyfinApiController
|
||||
=> GetUserImage(
|
||||
userId,
|
||||
tag,
|
||||
format,
|
||||
maxWidth,
|
||||
maxHeight,
|
||||
percentPlayed,
|
||||
unplayedCount,
|
||||
width,
|
||||
height,
|
||||
quality,
|
||||
fillWidth,
|
||||
fillHeight,
|
||||
blur,
|
||||
backgroundColor,
|
||||
foregroundLayer,
|
||||
imageIndex);
|
||||
format);
|
||||
|
||||
/// <summary>
|
||||
/// Get user profile image.
|
||||
@ -1677,36 +1629,13 @@ public class ImageController : BaseJellyfinApiController
|
||||
=> GetUserImage(
|
||||
userId,
|
||||
tag,
|
||||
format,
|
||||
maxWidth,
|
||||
maxHeight,
|
||||
percentPlayed,
|
||||
unplayedCount,
|
||||
width,
|
||||
height,
|
||||
quality,
|
||||
fillWidth,
|
||||
fillHeight,
|
||||
blur,
|
||||
backgroundColor,
|
||||
foregroundLayer,
|
||||
imageIndex);
|
||||
format);
|
||||
|
||||
/// <summary>
|
||||
/// Generates or gets the splashscreen.
|
||||
/// </summary>
|
||||
/// <param name="tag">Supply the cache tag from the item object to receive strong caching headers.</param>
|
||||
/// <param name="format">Determines the output format of the image - original,gif,jpg,png.</param>
|
||||
/// <param name="maxWidth">The maximum image width to return.</param>
|
||||
/// <param name="maxHeight">The maximum image height to return.</param>
|
||||
/// <param name="width">The fixed image width to return.</param>
|
||||
/// <param name="height">The fixed image height to return.</param>
|
||||
/// <param name="fillWidth">Width of box to fill.</param>
|
||||
/// <param name="fillHeight">Height of box to fill.</param>
|
||||
/// <param name="blur">Blur image.</param>
|
||||
/// <param name="backgroundColor">Apply a background color for transparent images.</param>
|
||||
/// <param name="foregroundLayer">Apply a foreground layer on top of the image.</param>
|
||||
/// <param name="quality">Quality setting, from 0-100.</param>
|
||||
/// <response code="200">Splashscreen returned successfully.</response>
|
||||
/// <returns>The splashscreen.</returns>
|
||||
[HttpGet("Branding/Splashscreen")]
|
||||
@ -1714,17 +1643,7 @@ public class ImageController : BaseJellyfinApiController
|
||||
[ProducesImageFile]
|
||||
public async Task<ActionResult> GetSplashscreen(
|
||||
[FromQuery] string? tag,
|
||||
[FromQuery] ImageFormat? format,
|
||||
[FromQuery] int? maxWidth,
|
||||
[FromQuery] int? maxHeight,
|
||||
[FromQuery] int? width,
|
||||
[FromQuery] int? height,
|
||||
[FromQuery] int? fillWidth,
|
||||
[FromQuery] int? fillHeight,
|
||||
[FromQuery] int? blur,
|
||||
[FromQuery] string? backgroundColor,
|
||||
[FromQuery] string? foregroundLayer,
|
||||
[FromQuery, Range(0, 100)] int quality = 90)
|
||||
[FromQuery] ImageFormat? format)
|
||||
{
|
||||
var brandingOptions = _serverConfigurationManager.GetConfiguration<BrandingOptions>("branding");
|
||||
var isAdmin = User.IsInRole(Constants.UserRoles.Administrator);
|
||||
@ -1763,16 +1682,16 @@ public class ImageController : BaseJellyfinApiController
|
||||
{
|
||||
Path = splashscreenPath
|
||||
},
|
||||
Height = height,
|
||||
MaxHeight = maxHeight,
|
||||
MaxWidth = maxWidth,
|
||||
FillHeight = fillHeight,
|
||||
FillWidth = fillWidth,
|
||||
Quality = quality,
|
||||
Width = width,
|
||||
Blur = blur,
|
||||
BackgroundColor = backgroundColor,
|
||||
ForegroundLayer = foregroundLayer,
|
||||
Height = null,
|
||||
MaxHeight = null,
|
||||
MaxWidth = null,
|
||||
FillHeight = null,
|
||||
FillWidth = null,
|
||||
Quality = 90,
|
||||
Width = null,
|
||||
Blur = null,
|
||||
BackgroundColor = null,
|
||||
ForegroundLayer = null,
|
||||
SupportedOutputFormats = outputFormats
|
||||
};
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user