mirror of
https://github.com/Kareadita/Kavita.git
synced 2025-07-09 03:04:19 -04:00
Fixed access issues around new Authorize scheme. (#1416)
This commit is contained in:
parent
9c31f7e7c8
commit
5e273d5d9e
@ -9,6 +9,7 @@ using API.Entities.Enums;
|
|||||||
using API.Extensions;
|
using API.Extensions;
|
||||||
using API.Services;
|
using API.Services;
|
||||||
using HtmlAgilityPack;
|
using HtmlAgilityPack;
|
||||||
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using VersOne.Epub;
|
using VersOne.Epub;
|
||||||
@ -94,6 +95,7 @@ namespace API.Controllers
|
|||||||
/// <param name="file"></param>
|
/// <param name="file"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpGet("{chapterId}/book-resources")]
|
[HttpGet("{chapterId}/book-resources")]
|
||||||
|
[AllowAnonymous]
|
||||||
public async Task<ActionResult> GetBookPageResources(int chapterId, [FromQuery] string file)
|
public async Task<ActionResult> GetBookPageResources(int chapterId, [FromQuery] string file)
|
||||||
{
|
{
|
||||||
var chapter = await _unitOfWork.ChapterRepository.GetChapterAsync(chapterId);
|
var chapter = await _unitOfWork.ChapterRepository.GetChapterAsync(chapterId);
|
||||||
|
@ -12,6 +12,7 @@ namespace API.Controllers
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Responsible for servicing up images stored in Kavita for entities
|
/// Responsible for servicing up images stored in Kavita for entities
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[AllowAnonymous]
|
||||||
public class ImageController : BaseApiController
|
public class ImageController : BaseApiController
|
||||||
{
|
{
|
||||||
private readonly IUnitOfWork _unitOfWork;
|
private readonly IUnitOfWork _unitOfWork;
|
||||||
|
@ -13,6 +13,7 @@ using API.Extensions;
|
|||||||
using API.Services;
|
using API.Services;
|
||||||
using API.SignalR;
|
using API.SignalR;
|
||||||
using Hangfire;
|
using Hangfire;
|
||||||
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
@ -53,7 +54,6 @@ namespace API.Controllers
|
|||||||
[HttpGet("pdf")]
|
[HttpGet("pdf")]
|
||||||
public async Task<ActionResult> GetPdf(int chapterId)
|
public async Task<ActionResult> GetPdf(int chapterId)
|
||||||
{
|
{
|
||||||
|
|
||||||
var chapter = await _cacheService.Ensure(chapterId);
|
var chapter = await _cacheService.Ensure(chapterId);
|
||||||
if (chapter == null) return BadRequest("There was an issue finding pdf file for reading");
|
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>
|
/// <param name="page"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpGet("image")]
|
[HttpGet("image")]
|
||||||
|
[AllowAnonymous]
|
||||||
public async Task<ActionResult> GetImage(int chapterId, int page)
|
public async Task<ActionResult> GetImage(int chapterId, int page)
|
||||||
{
|
{
|
||||||
if (page < 0) page = 0;
|
if (page < 0) page = 0;
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
<TargetFramework>net6.0</TargetFramework>
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
<Company>kavitareader.com</Company>
|
<Company>kavitareader.com</Company>
|
||||||
<Product>Kavita</Product>
|
<Product>Kavita</Product>
|
||||||
<AssemblyVersion>0.5.4.1</AssemblyVersion>
|
<AssemblyVersion>0.5.4.2</AssemblyVersion>
|
||||||
<NeutralLanguage>en</NeutralLanguage>
|
<NeutralLanguage>en</NeutralLanguage>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
<div class="{{theme}}">
|
<div class="{{theme}}" *ngIf="accountService.currentUser$ | async as user">
|
||||||
<ngx-extended-pdf-viewer
|
<ngx-extended-pdf-viewer
|
||||||
#pdfViewer
|
#pdfViewer
|
||||||
[src]="readerService.downloadPdf(this.chapterId)"
|
[src]="readerService.downloadPdf(this.chapterId)"
|
||||||
|
[authorization]="'Bearer ' + user.token"
|
||||||
height="100vh"
|
height="100vh"
|
||||||
[(page)]="currentPage"
|
[(page)]="currentPage"
|
||||||
[textLayer]="true"
|
[textLayer]="true"
|
||||||
@ -16,6 +17,7 @@
|
|||||||
[(zoom)]="zoomSetting"
|
[(zoom)]="zoomSetting"
|
||||||
[showSecondaryToolbarButton]="true"
|
[showSecondaryToolbarButton]="true"
|
||||||
|
|
||||||
|
|
||||||
[showBorders]="true"
|
[showBorders]="true"
|
||||||
[theme]="theme"
|
[theme]="theme"
|
||||||
[formTheme]="theme"
|
[formTheme]="theme"
|
||||||
|
@ -73,7 +73,7 @@ export class PdfReaderComponent implements OnInit, OnDestroy {
|
|||||||
|
|
||||||
private readonly onDestroy = new Subject<void>();
|
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 seriesService: SeriesService, public readerService: ReaderService,
|
||||||
private navService: NavService, private toastr: ToastrService,
|
private navService: NavService, private toastr: ToastrService,
|
||||||
private bookService: BookService, private themeService: ThemeService, private location: Location) {
|
private bookService: BookService, private themeService: ThemeService, private location: Location) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user