Skip to content

Commit 5e273d5

Browse files
authored
Fixed access issues around new Authorize scheme. (#1416)
1 parent 9c31f7e commit 5e273d5

File tree

6 files changed

+10
-4
lines changed

6 files changed

+10
-4
lines changed

API/Controllers/BookController.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
using API.Extensions;
1010
using API.Services;
1111
using HtmlAgilityPack;
12+
using Microsoft.AspNetCore.Authorization;
1213
using Microsoft.AspNetCore.Mvc;
1314
using Microsoft.Extensions.Logging;
1415
using VersOne.Epub;
@@ -94,6 +95,7 @@ public async Task<ActionResult<BookInfoDto>> GetBookInfo(int chapterId)
9495
/// <param name="file"></param>
9596
/// <returns></returns>
9697
[HttpGet("{chapterId}/book-resources")]
98+
[AllowAnonymous]
9799
public async Task<ActionResult> GetBookPageResources(int chapterId, [FromQuery] string file)
98100
{
99101
var chapter = await _unitOfWork.ChapterRepository.GetChapterAsync(chapterId);

API/Controllers/ImageController.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ namespace API.Controllers
1212
/// <summary>
1313
/// Responsible for servicing up images stored in Kavita for entities
1414
/// </summary>
15+
[AllowAnonymous]
1516
public class ImageController : BaseApiController
1617
{
1718
private readonly IUnitOfWork _unitOfWork;

API/Controllers/ReaderController.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
using API.Services;
1414
using API.SignalR;
1515
using Hangfire;
16+
using Microsoft.AspNetCore.Authorization;
1617
using Microsoft.AspNetCore.Mvc;
1718
using Microsoft.Extensions.Logging;
1819

@@ -53,7 +54,6 @@ public ReaderController(ICacheService cacheService,
5354
[HttpGet("pdf")]
5455
public async Task<ActionResult> GetPdf(int chapterId)
5556
{
56-
5757
var chapter = await _cacheService.Ensure(chapterId);
5858
if (chapter == null) return BadRequest("There was an issue finding pdf file for reading");
5959

@@ -84,6 +84,7 @@ public async Task<ActionResult> GetPdf(int chapterId)
8484
/// <param name="page"></param>
8585
/// <returns></returns>
8686
[HttpGet("image")]
87+
[AllowAnonymous]
8788
public async Task<ActionResult> GetImage(int chapterId, int page)
8889
{
8990
if (page < 0) page = 0;

Kavita.Common/Kavita.Common.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<TargetFramework>net6.0</TargetFramework>
55
<Company>kavitareader.com</Company>
66
<Product>Kavita</Product>
7-
<AssemblyVersion>0.5.4.1</AssemblyVersion>
7+
<AssemblyVersion>0.5.4.2</AssemblyVersion>
88
<NeutralLanguage>en</NeutralLanguage>
99
</PropertyGroup>
1010

UI/Web/src/app/pdf-reader/pdf-reader/pdf-reader.component.html

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
<div class="{{theme}}">
1+
<div class="{{theme}}" *ngIf="accountService.currentUser$ | async as user">
22
<ngx-extended-pdf-viewer
33
#pdfViewer
44
[src]="readerService.downloadPdf(this.chapterId)"
5+
[authorization]="'Bearer ' + user.token"
56
height="100vh"
67
[(page)]="currentPage"
78
[textLayer]="true"
@@ -16,6 +17,7 @@
1617
[(zoom)]="zoomSetting"
1718
[showSecondaryToolbarButton]="true"
1819

20+
1921
[showBorders]="true"
2022
[theme]="theme"
2123
[formTheme]="theme"

UI/Web/src/app/pdf-reader/pdf-reader/pdf-reader.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ export class PdfReaderComponent implements OnInit, OnDestroy {
7373

7474
private readonly onDestroy = new Subject<void>();
7575

76-
constructor(private route: ActivatedRoute, private router: Router, private accountService: AccountService,
76+
constructor(private route: ActivatedRoute, private router: Router, public accountService: AccountService,
7777
private seriesService: SeriesService, public readerService: ReaderService,
7878
private navService: NavService, private toastr: ToastrService,
7979
private bookService: BookService, private themeService: ThemeService, private location: Location) {

0 commit comments

Comments
 (0)