mirror of
https://github.com/Kareadita/Kavita.git
synced 2025-05-24 00:52:23 -04:00
* Fixed a bug where chapter cover images weren't being updated due to a missed not. * Removed a piece of code that was needed for upgrading, since all beta users agreed to wipe db. * Fixed InProgress to properly respect order and show more recent activity first. Issue is with IEntityDate LastModified not updating in DataContext. * Updated dependencies to lastest stable. * LastModified on Volumes wasn't updating, validated it does update when data is changed.
50 lines
1.7 KiB
C#
50 lines
1.7 KiB
C#
using System.Threading.Tasks;
|
|
using API.Extensions;
|
|
using API.Interfaces;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
namespace API.Controllers
|
|
{
|
|
public class ImageController : BaseApiController
|
|
{
|
|
private readonly IUnitOfWork _unitOfWork;
|
|
|
|
public ImageController(IUnitOfWork unitOfWork)
|
|
{
|
|
_unitOfWork = unitOfWork;
|
|
}
|
|
|
|
[HttpGet("chapter-cover")]
|
|
public async Task<ActionResult> GetChapterCoverImage(int chapterId)
|
|
{
|
|
var content = await _unitOfWork.VolumeRepository.GetChapterCoverImageAsync(chapterId);
|
|
if (content == null) return BadRequest("No cover image");
|
|
const string format = "jpeg";
|
|
|
|
Response.AddCacheHeader(content);
|
|
return File(content, "image/" + format, $"chapterId");
|
|
}
|
|
|
|
[HttpGet("volume-cover")]
|
|
public async Task<ActionResult> GetVolumeCoverImage(int volumeId)
|
|
{
|
|
var content = await _unitOfWork.SeriesRepository.GetVolumeCoverImageAsync(volumeId);
|
|
if (content == null) return BadRequest("No cover image");
|
|
const string format = "jpeg";
|
|
|
|
Response.AddCacheHeader(content);
|
|
return File(content, "image/" + format, $"volumeId");
|
|
}
|
|
|
|
[HttpGet("series-cover")]
|
|
public async Task<ActionResult> GetSeriesCoverImage(int seriesId)
|
|
{
|
|
var content = await _unitOfWork.SeriesRepository.GetSeriesCoverImageAsync(seriesId);
|
|
if (content == null) return BadRequest("No cover image");
|
|
const string format = "jpeg";
|
|
|
|
Response.AddCacheHeader(content);
|
|
return File(content, "image/" + format, $"seriesId");
|
|
}
|
|
}
|
|
} |