Fixed access issues around new Authorize scheme. (#1416)

This commit is contained in:
Joseph Milazzo 2022-08-08 16:41:14 -05:00 committed by GitHub
parent 9c31f7e7c8
commit 5e273d5d9e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 10 additions and 4 deletions

View File

@ -9,6 +9,7 @@ using API.Entities.Enums;
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 @@ namespace API.Controllers
/// <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);

View File

@ -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;

View File

@ -13,6 +13,7 @@ using API.Extensions;
using API.Services;
using API.SignalR;
using Hangfire;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
@ -53,7 +54,6 @@ namespace API.Controllers
[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");
@ -84,6 +84,7 @@ namespace API.Controllers
/// <param name="page"></param>
/// <returns></returns>
[HttpGet("image")]
[AllowAnonymous]
public async Task<ActionResult> GetImage(int chapterId, int page)
{
if (page < 0) page = 0;

View File

@ -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>

View File

@ -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"
@ -16,6 +17,7 @@
[(zoom)]="zoomSetting"
[showSecondaryToolbarButton]="true"
[showBorders]="true"
[theme]="theme"
[formTheme]="theme"

View File

@ -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) {