From 5e273d5d9e521f5a126a2eda551024292705f2f1 Mon Sep 17 00:00:00 2001 From: Joseph Milazzo Date: Mon, 8 Aug 2022 16:41:14 -0500 Subject: [PATCH] Fixed access issues around new Authorize scheme. (#1416) --- API/Controllers/BookController.cs | 2 ++ API/Controllers/ImageController.cs | 1 + API/Controllers/ReaderController.cs | 3 ++- Kavita.Common/Kavita.Common.csproj | 2 +- .../src/app/pdf-reader/pdf-reader/pdf-reader.component.html | 4 +++- UI/Web/src/app/pdf-reader/pdf-reader/pdf-reader.component.ts | 2 +- 6 files changed, 10 insertions(+), 4 deletions(-) diff --git a/API/Controllers/BookController.cs b/API/Controllers/BookController.cs index 9585823380..a4b729187c 100644 --- a/API/Controllers/BookController.cs +++ b/API/Controllers/BookController.cs @@ -9,6 +9,7 @@ using API.Extensions; using API.Services; using HtmlAgilityPack; +using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Logging; using VersOne.Epub; @@ -94,6 +95,7 @@ public async Task> GetBookInfo(int chapterId) /// /// [HttpGet("{chapterId}/book-resources")] + [AllowAnonymous] public async Task GetBookPageResources(int chapterId, [FromQuery] string file) { var chapter = await _unitOfWork.ChapterRepository.GetChapterAsync(chapterId); diff --git a/API/Controllers/ImageController.cs b/API/Controllers/ImageController.cs index 1a19666d64..fe52b67ef1 100644 --- a/API/Controllers/ImageController.cs +++ b/API/Controllers/ImageController.cs @@ -12,6 +12,7 @@ namespace API.Controllers /// /// Responsible for servicing up images stored in Kavita for entities /// + [AllowAnonymous] public class ImageController : BaseApiController { private readonly IUnitOfWork _unitOfWork; diff --git a/API/Controllers/ReaderController.cs b/API/Controllers/ReaderController.cs index 3aab19e897..df36d71b84 100644 --- a/API/Controllers/ReaderController.cs +++ b/API/Controllers/ReaderController.cs @@ -13,6 +13,7 @@ using API.Services; using API.SignalR; using Hangfire; +using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Logging; @@ -53,7 +54,6 @@ public ReaderController(ICacheService cacheService, [HttpGet("pdf")] public async Task GetPdf(int chapterId) { - var chapter = await _cacheService.Ensure(chapterId); if (chapter == null) return BadRequest("There was an issue finding pdf file for reading"); @@ -84,6 +84,7 @@ public async Task GetPdf(int chapterId) /// /// [HttpGet("image")] + [AllowAnonymous] public async Task GetImage(int chapterId, int page) { if (page < 0) page = 0; diff --git a/Kavita.Common/Kavita.Common.csproj b/Kavita.Common/Kavita.Common.csproj index debd9b5a94..7762f097c2 100644 --- a/Kavita.Common/Kavita.Common.csproj +++ b/Kavita.Common/Kavita.Common.csproj @@ -4,7 +4,7 @@ net6.0 kavitareader.com Kavita - 0.5.4.1 + 0.5.4.2 en diff --git a/UI/Web/src/app/pdf-reader/pdf-reader/pdf-reader.component.html b/UI/Web/src/app/pdf-reader/pdf-reader/pdf-reader.component.html index 12467fa61b..b3cafee5db 100644 --- a/UI/Web/src/app/pdf-reader/pdf-reader/pdf-reader.component.html +++ b/UI/Web/src/app/pdf-reader/pdf-reader/pdf-reader.component.html @@ -1,7 +1,8 @@ -
+
(); - constructor(private route: ActivatedRoute, private router: Router, private accountService: AccountService, + constructor(private route: ActivatedRoute, private router: Router, public accountService: AccountService, private seriesService: SeriesService, public readerService: ReaderService, private navService: NavService, private toastr: ToastrService, private bookService: BookService, private themeService: ThemeService, private location: Location) {