diff options
| author | crobibero <cody@robibe.ro> | 2020-06-04 10:10:36 -0600 |
|---|---|---|
| committer | crobibero <cody@robibe.ro> | 2020-06-04 10:10:36 -0600 |
| commit | fd913d73e35491c64e39a76a266689c302a91b11 (patch) | |
| tree | b52c3b6c19a2aaced975e7b2284351d9632ce8bd /Jellyfin.Api/Controllers/Images/ImageByNameController.cs | |
| parent | 070edd9e5bff63d3f158b6ca8b37095adc686492 (diff) | |
Revert authorized endpoints to legacy api
Diffstat (limited to 'Jellyfin.Api/Controllers/Images/ImageByNameController.cs')
| -rw-r--r-- | Jellyfin.Api/Controllers/Images/ImageByNameController.cs | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/Jellyfin.Api/Controllers/Images/ImageByNameController.cs b/Jellyfin.Api/Controllers/Images/ImageByNameController.cs index fa6080977..db475d6b4 100644 --- a/Jellyfin.Api/Controllers/Images/ImageByNameController.cs +++ b/Jellyfin.Api/Controllers/Images/ImageByNameController.cs @@ -21,7 +21,6 @@ namespace Jellyfin.Api.Controllers.Images /// Images By Name Controller. /// </summary> [Route("Images")] - [Authorize] public class ImageByNameController : BaseJellyfinApiController { private readonly IServerApplicationPaths _applicationPaths; @@ -46,6 +45,7 @@ namespace Jellyfin.Api.Controllers.Images /// <response code="200">Retrieved list of images.</response> /// <returns>An <see cref="OkResult"/> containing the list of images.</returns> [HttpGet("General")] + [Authorize] [ProducesResponseType(StatusCodes.Status200OK)] public ActionResult<IEnumerable<ImageByNameInfo>> GetGeneralImages() { @@ -61,6 +61,7 @@ namespace Jellyfin.Api.Controllers.Images /// <response code="404">Image not found.</response> /// <returns>A <see cref="FileStreamResult"/> containing the image contents on success, or a <see cref="NotFoundResult"/> if the image could not be found.</returns> [HttpGet("General/{Name}/{Type}")] + [AllowAnonymous] [Produces(MediaTypeNames.Application.Octet)] [ProducesResponseType(StatusCodes.Status200OK)] [ProducesResponseType(StatusCodes.Status404NotFound)] @@ -70,11 +71,11 @@ namespace Jellyfin.Api.Controllers.Images ? "folder" : type; - var paths = BaseItem.SupportedImageExtensions - .Select(i => Path.Combine(_applicationPaths.GeneralPath, name, filename + i)).ToList(); + var path = BaseItem.SupportedImageExtensions + .Select(i => Path.Combine(_applicationPaths.GeneralPath, name, filename + i)) + .FirstOrDefault(System.IO.File.Exists); - var path = paths.FirstOrDefault(System.IO.File.Exists) ?? paths.FirstOrDefault(); - if (path == null || !System.IO.File.Exists(path)) + if (path == null) { return NotFound(); } @@ -89,6 +90,7 @@ namespace Jellyfin.Api.Controllers.Images /// <response code="200">Retrieved list of images.</response> /// <returns>An <see cref="OkResult"/> containing the list of images.</returns> [HttpGet("Ratings")] + [Authorize] [ProducesResponseType(StatusCodes.Status200OK)] public ActionResult<IEnumerable<ImageByNameInfo>> GetRatingImages() { @@ -104,6 +106,7 @@ namespace Jellyfin.Api.Controllers.Images /// <response code="404">Image not found.</response> /// <returns>A <see cref="FileStreamResult"/> containing the image contents on success, or a <see cref="NotFoundResult"/> if the image could not be found.</returns> [HttpGet("Ratings/{Theme}/{Name}")] + [AllowAnonymous] [Produces(MediaTypeNames.Application.Octet)] [ProducesResponseType(StatusCodes.Status200OK)] [ProducesResponseType(StatusCodes.Status404NotFound)] @@ -120,6 +123,7 @@ namespace Jellyfin.Api.Controllers.Images /// <response code="200">Image list retrieved.</response> /// <returns>An <see cref="OkResult"/> containing the list of images.</returns> [HttpGet("MediaInfo")] + [Authorize] [ProducesResponseType(StatusCodes.Status200OK)] public ActionResult<IEnumerable<ImageByNameInfo>> GetMediaInfoImages() { @@ -135,6 +139,7 @@ namespace Jellyfin.Api.Controllers.Images /// <response code="404">Image not found.</response> /// <returns>A <see cref="FileStreamResult"/> containing the image contents on success, or a <see cref="NotFoundResult"/> if the image could not be found.</returns> [HttpGet("MediaInfo/{Theme}/{Name}")] + [AllowAnonymous] [Produces(MediaTypeNames.Application.Octet)] [ProducesResponseType(StatusCodes.Status200OK)] [ProducesResponseType(StatusCodes.Status404NotFound)] |
