mirror of
https://github.com/Kareadita/Kavita.git
synced 2026-06-05 06:15:25 -04:00
Progress Overhaul + Profile Page and a LOT more! (#4262)
Co-authored-by: Amelia <77553571+Fesaa@users.noreply.github.com> Co-authored-by: Robbie Davis <robbie@therobbiedavis.com>
This commit is contained in:
@@ -11,6 +11,8 @@ using API.Exceptions;
|
||||
using API.Extensions;
|
||||
using API.Middleware;
|
||||
using API.Services;
|
||||
using API.Services.Reading;
|
||||
using API.Services.Store;
|
||||
using Kavita.Common;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
@@ -19,14 +21,11 @@ using MimeTypes;
|
||||
namespace API.Controllers;
|
||||
#nullable enable
|
||||
|
||||
|
||||
|
||||
[AllowAnonymous]
|
||||
[ServiceFilter(typeof(OpdsActionFilterAttribute))]
|
||||
[ServiceFilter(typeof(OpdsActiveUserMiddlewareAttribute))]
|
||||
public class OpdsController : BaseApiController
|
||||
{
|
||||
private readonly IOpdsService _opdsService;
|
||||
private readonly IUserContext _userContext;
|
||||
private readonly IUnitOfWork _unitOfWork;
|
||||
private readonly IDownloadService _downloadService;
|
||||
private readonly IDirectoryService _directoryService;
|
||||
@@ -36,12 +35,10 @@ public class OpdsController : BaseApiController
|
||||
private readonly ILocalizationService _localizationService;
|
||||
private readonly XmlSerializer _xmlOpenSearchSerializer;
|
||||
|
||||
public const string UserId = nameof(UserId);
|
||||
|
||||
public OpdsController(IUnitOfWork unitOfWork, IDownloadService downloadService,
|
||||
IDirectoryService directoryService, ICacheService cacheService,
|
||||
IReaderService readerService, IAccountService accountService,
|
||||
ILocalizationService localizationService, IOpdsService opdsService)
|
||||
ILocalizationService localizationService, IOpdsService opdsService, IUserContext userContext)
|
||||
{
|
||||
_unitOfWork = unitOfWork;
|
||||
_downloadService = downloadService;
|
||||
@@ -51,13 +48,14 @@ public class OpdsController : BaseApiController
|
||||
_accountService = accountService;
|
||||
_localizationService = localizationService;
|
||||
_opdsService = opdsService;
|
||||
_userContext = userContext;
|
||||
|
||||
_xmlOpenSearchSerializer = new XmlSerializer(typeof(OpenSearchDescription));
|
||||
}
|
||||
|
||||
private int GetUserIdFromContext()
|
||||
{
|
||||
return (int) HttpContext.Items[UserId]!;
|
||||
return _userContext.GetUserIdOrThrow();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user