Skip to content

Commit

Permalink
Fixed access issues around new Authorize scheme. (#1416)
Browse files Browse the repository at this point in the history
  • Loading branch information
majora2007 authored Aug 8, 2022
1 parent 9c31f7e commit 5e273d5
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 4 deletions.
2 changes: 2 additions & 0 deletions API/Controllers/BookController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -94,6 +95,7 @@ public async Task<ActionResult<BookInfoDto>> GetBookInfo(int chapterId)
/// <param name="file"></param>
/// <returns></returns>
[HttpGet("{chapterId}/book-resources")]
[AllowAnonymous]
public async Task<ActionResult> GetBookPageResources(int chapterId, [FromQuery] string file)
{
var chapter = await _unitOfWork.ChapterRepository.GetChapterAsync(chapterId);
Expand Down
1 change: 1 addition & 0 deletions API/Controllers/ImageController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ namespace API.Controllers
/// <summary>
/// Responsible for servicing up images stored in Kavita for entities
/// </summary>
[AllowAnonymous]
public class ImageController : BaseApiController
{
private readonly IUnitOfWork _unitOfWork;
Expand Down
3 changes: 2 additions & 1 deletion API/Controllers/ReaderController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
using API.Services;
using API.SignalR;
using Hangfire;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;

Expand Down Expand Up @@ -53,7 +54,6 @@ public ReaderController(ICacheService cacheService,
[HttpGet("pdf")]
public async Task<ActionResult> GetPdf(int chapterId)
{

var chapter = await _cacheService.Ensure(chapterId);
if (chapter == null) return BadRequest("There was an issue finding pdf file for reading");

Expand Down Expand Up @@ -84,6 +84,7 @@ public async Task<ActionResult> GetPdf(int chapterId)
/// <param name="page"></param>
/// <returns></returns>
[HttpGet("image")]
[AllowAnonymous]
public async Task<ActionResult> GetImage(int chapterId, int page)
{
if (page < 0) page = 0;
Expand Down
2 changes: 1 addition & 1 deletion Kavita.Common/Kavita.Common.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<TargetFramework>net6.0</TargetFramework>
<Company>kavitareader.com</Company>
<Product>Kavita</Product>
<AssemblyVersion>0.5.4.1</AssemblyVersion>
<AssemblyVersion>0.5.4.2</AssemblyVersion>
<NeutralLanguage>en</NeutralLanguage>
</PropertyGroup>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<div class="{{theme}}">
<div class="{{theme}}" *ngIf="accountService.currentUser$ | async as user">
<ngx-extended-pdf-viewer
#pdfViewer
[src]="readerService.downloadPdf(this.chapterId)"
[authorization]="'Bearer ' + user.token"
height="100vh"
[(page)]="currentPage"
[textLayer]="true"
Expand All @@ -16,6 +17,7 @@
[(zoom)]="zoomSetting"
[showSecondaryToolbarButton]="true"


[showBorders]="true"
[theme]="theme"
[formTheme]="theme"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export class PdfReaderComponent implements OnInit, OnDestroy {

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

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) {
Expand Down

0 comments on commit 5e273d5

Please sign in to comment.