OPDS Flattening (#1904)
* Flattening OPDS Structure # Changed - Flattened OPDS structure to reduce user taps. * Fixing format * Fixing book series titles * Optimized file size to use pre-calculated data to avoid an I/O touch. * Fixes #1898 by aligning all content headers to the correct MIME types * Remove dead code * Fixed a bug with continue point where it fails on chapters or volumes tagged with a range --------- Co-authored-by: Robbie Davis <robbie@therobbiedavis.com>
This commit is contained in:
parent
449827f285
commit
a8f48a6e9d
9 changed files with 122 additions and 80 deletions
|
|
@ -19,6 +19,7 @@ using Microsoft.AspNetCore.Authorization;
|
|||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.IdentityModel.Tokens;
|
||||
using MimeTypes;
|
||||
|
||||
namespace API.Controllers;
|
||||
|
||||
|
|
@ -103,9 +104,9 @@ public class ReaderController : BaseApiController
|
|||
{
|
||||
var path = _cacheService.GetCachedPagePath(chapter.Id, page);
|
||||
if (string.IsNullOrEmpty(path) || !System.IO.File.Exists(path)) return BadRequest($"No such image for page {page}. Try refreshing to allow re-cache.");
|
||||
var format = Path.GetExtension(path).Replace(".", string.Empty);
|
||||
var format = Path.GetExtension(path);
|
||||
|
||||
return PhysicalFile(path, "image/" + format, Path.GetFileName(path), true);
|
||||
return PhysicalFile(path, MimeTypeMap.GetMimeType(format), Path.GetFileName(path), true);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
|
|
@ -124,8 +125,8 @@ public class ReaderController : BaseApiController
|
|||
var images = _cacheService.GetCachedPages(chapterId);
|
||||
|
||||
var path = await _readerService.GetThumbnail(chapter, pageNum, images);
|
||||
var format = Path.GetExtension(path).Replace(".", string.Empty); // TODO: Make this an extension
|
||||
return PhysicalFile(path, "image/" + format, Path.GetFileName(path), true);
|
||||
var format = Path.GetExtension(path);
|
||||
return PhysicalFile(path, MimeTypeMap.GetMimeType(format), Path.GetFileName(path), true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -154,9 +155,9 @@ public class ReaderController : BaseApiController
|
|||
{
|
||||
var path = _cacheService.GetCachedBookmarkPagePath(seriesId, page);
|
||||
if (string.IsNullOrEmpty(path) || !System.IO.File.Exists(path)) return BadRequest($"No such image for page {page}");
|
||||
var format = Path.GetExtension(path).Replace(".", string.Empty);
|
||||
var format = Path.GetExtension(path);
|
||||
|
||||
return PhysicalFile(path, "image/" + format, Path.GetFileName(path));
|
||||
return PhysicalFile(path, MimeTypeMap.GetMimeType(format), Path.GetFileName(path));
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue