Merge pull request #3829 from Ullmie02/api-migration

Small fix to api-migration
pull/3812/head
Patrick Barron 4 years ago committed by GitHub
commit 34cf1b1757
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -666,8 +666,7 @@ namespace Jellyfin.Api.Controllers
} }
// TODO determine non-ASCII validity. // TODO determine non-ASCII validity.
using var fileStream = new FileStream(path, FileMode.Open, FileAccess.Read); return PhysicalFile(path, MimeTypes.GetMimeType(path));
return File(fileStream, MimeTypes.GetMimeType(path), filename);
} }
/// <summary> /// <summary>

@ -25,8 +25,7 @@ namespace Jellyfin.Api.Controllers
/// <summary> /// <summary>
/// Remote Images Controller. /// Remote Images Controller.
/// </summary> /// </summary>
[Route("Images")] [Route("")]
[Authorize(Policy = Policies.DefaultAuthorization)]
public class RemoteImageController : BaseJellyfinApiController public class RemoteImageController : BaseJellyfinApiController
{ {
private readonly IProviderManager _providerManager; private readonly IProviderManager _providerManager;
@ -65,7 +64,8 @@ namespace Jellyfin.Api.Controllers
/// <response code="200">Remote Images returned.</response> /// <response code="200">Remote Images returned.</response>
/// <response code="404">Item not found.</response> /// <response code="404">Item not found.</response>
/// <returns>Remote Image Result.</returns> /// <returns>Remote Image Result.</returns>
[HttpGet("{itemId}/RemoteImages")] [HttpGet("Items/{itemId}/RemoteImages")]
[Authorize(Policy = Policies.DefaultAuthorization)]
[ProducesResponseType(StatusCodes.Status200OK)] [ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status404NotFound)] [ProducesResponseType(StatusCodes.Status404NotFound)]
public async Task<ActionResult<RemoteImageResult>> GetRemoteImages( public async Task<ActionResult<RemoteImageResult>> GetRemoteImages(
@ -73,7 +73,7 @@ namespace Jellyfin.Api.Controllers
[FromQuery] ImageType? type, [FromQuery] ImageType? type,
[FromQuery] int? startIndex, [FromQuery] int? startIndex,
[FromQuery] int? limit, [FromQuery] int? limit,
[FromQuery] string providerName, [FromQuery] string? providerName,
[FromQuery] bool includeAllLanguages = false) [FromQuery] bool includeAllLanguages = false)
{ {
var item = _libraryManager.GetItemById(itemId); var item = _libraryManager.GetItemById(itemId);
@ -84,7 +84,7 @@ namespace Jellyfin.Api.Controllers
var images = await _providerManager.GetAvailableRemoteImages( var images = await _providerManager.GetAvailableRemoteImages(
item, item,
new RemoteImageQuery(providerName) new RemoteImageQuery(providerName ?? string.Empty)
{ {
IncludeAllLanguages = includeAllLanguages, IncludeAllLanguages = includeAllLanguages,
IncludeDisabledProviders = true, IncludeDisabledProviders = true,
@ -128,7 +128,8 @@ namespace Jellyfin.Api.Controllers
/// <response code="200">Returned remote image providers.</response> /// <response code="200">Returned remote image providers.</response>
/// <response code="404">Item not found.</response> /// <response code="404">Item not found.</response>
/// <returns>List of remote image providers.</returns> /// <returns>List of remote image providers.</returns>
[HttpGet("{itemId}/RemoteImages/Providers")] [HttpGet("Items/{itemId}/RemoteImages/Providers")]
[Authorize(Policy = Policies.DefaultAuthorization)]
[ProducesResponseType(StatusCodes.Status200OK)] [ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status404NotFound)] [ProducesResponseType(StatusCodes.Status404NotFound)]
public ActionResult<IEnumerable<ImageProviderInfo>> GetRemoteImageProviders([FromRoute] Guid itemId) public ActionResult<IEnumerable<ImageProviderInfo>> GetRemoteImageProviders([FromRoute] Guid itemId)
@ -149,11 +150,11 @@ namespace Jellyfin.Api.Controllers
/// <response code="200">Remote image returned.</response> /// <response code="200">Remote image returned.</response>
/// <response code="404">Remote image not found.</response> /// <response code="404">Remote image not found.</response>
/// <returns>Image Stream.</returns> /// <returns>Image Stream.</returns>
[HttpGet("Remote")] [HttpGet("Images/Remote")]
[Produces(MediaTypeNames.Application.Octet)] [Produces(MediaTypeNames.Application.Octet)]
[ProducesResponseType(StatusCodes.Status200OK)] [ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status404NotFound)] [ProducesResponseType(StatusCodes.Status404NotFound)]
public async Task<ActionResult<FileStreamResult>> GetRemoteImage([FromQuery, BindRequired] string imageUrl) public async Task<ActionResult> GetRemoteImage([FromQuery, BindRequired] string imageUrl)
{ {
var urlHash = imageUrl.GetMD5(); var urlHash = imageUrl.GetMD5();
var pointerCachePath = GetFullCachePath(urlHash.ToString()); var pointerCachePath = GetFullCachePath(urlHash.ToString());
@ -202,7 +203,8 @@ namespace Jellyfin.Api.Controllers
/// <response code="204">Remote image downloaded.</response> /// <response code="204">Remote image downloaded.</response>
/// <response code="404">Remote image not found.</response> /// <response code="404">Remote image not found.</response>
/// <returns>Download status.</returns> /// <returns>Download status.</returns>
[HttpPost("{itemId}/RemoteImages/Download")] [HttpPost("Items/{itemId}/RemoteImages/Download")]
[Authorize(Policy = Policies.RequiresElevation)]
[ProducesResponseType(StatusCodes.Status204NoContent)] [ProducesResponseType(StatusCodes.Status204NoContent)]
[ProducesResponseType(StatusCodes.Status404NotFound)] [ProducesResponseType(StatusCodes.Status404NotFound)]
public async Task<ActionResult> DownloadRemoteImage( public async Task<ActionResult> DownloadRemoteImage(

@ -50,7 +50,7 @@ namespace MediaBrowser.Common.Json.Converters
/// <param name="options">Options.</param> /// <param name="options">Options.</param>
public override void Write(Utf8JsonWriter writer, double value, JsonSerializerOptions options) public override void Write(Utf8JsonWriter writer, double value, JsonSerializerOptions options)
{ {
writer.WriteStringValue(value.ToString(NumberFormatInfo.InvariantInfo)); writer.WriteNumberValue(value);
} }
} }
} }

Loading…
Cancel
Save