Adds book reading support with EPUB and PDF reader plugins

This commit is contained in:
BinaryAlley committed 2026-09-02 04:45:11 -07:00
1 parent 275fd83ff2
commit f7ccdf3d1c
271 files changed
+11501 -361

No files matched your search

@@ -12,10 +12,14 @@ namespace Lumina.Application.Core.UsersManagement.Settings.Commands.UpdateUserSe
/// <param name="ShouldIgnoreThePrefixForAlphaPicker">Whether the "The" prefix of library item titles is ignored by the alpha picker, or not.</param>
/// <param name="IsThemeCachingEnabled">Whether the theme data served to this user is cached, or not.</param>
/// <param name="ShouldAggregateMetadataWhenMissing">Whether the metadata of the media library items is aggregated from multiple providers, when fields are missing, or not.</param>
/// <param name="ShouldRenderPdfAsImages">Whether PDF books are rendered as page images for the user, or not.</param>
/// <param name="ShouldPreserveBookStyles">Whether the styles of the book content are preserved when it is rendered for the user, or not.</param>
public record UpdateUserSettingsCommand(
bool IsPaginationEnabled,
int ItemsPerPage,
bool ShouldIgnoreThePrefixForAlphaPicker,
bool IsThemeCachingEnabled,
bool ShouldAggregateMetadataWhenMissing
bool ShouldAggregateMetadataWhenMissing,
bool ShouldRenderPdfAsImages,
bool ShouldPreserveBookStyles
) : ICommand;
@@ -53,27 +53,29 @@ public class UpdateUserSettingsCommandHandler : ICommandHandler<UpdateUserSettin
if (validationResult.Count > 0)
return validationResult;
// an authenticated request must always carry a user identity
// An authenticated request must always carry a user identity.
Guid? currentUserId = _currentUserService.UserId;
if (currentUserId is null)
return Errors.Authorization.NotAuthorized;
Guid userId = currentUserId.Value;
// get the existing settings of the current user, if any
// Get the existing settings of the current user, if any.
Result<UserSettingsEntity?> getSettingsResult = await _unitOfWork.UserSettingsRepository.GetByUserIdAsync(userId, cancellationToken).ConfigureAwait(false);
if (getSettingsResult.IsFailure)
return getSettingsResult.Errors;
if (getSettingsResult.Value is null)
{
// create the settings of the current user, since they are not stored yet
// Create the settings of the current user, since they are not stored yet.
Result<UserSettings> createSettingsResult = UserSettings.Create(
UserId.Create(userId),
command.IsPaginationEnabled,
command.ItemsPerPage,
command.ShouldIgnoreThePrefixForAlphaPicker,
command.IsThemeCachingEnabled,
command.ShouldAggregateMetadataWhenMissing);
command.ShouldAggregateMetadataWhenMissing,
command.ShouldRenderPdfAsImages,
command.ShouldPreserveBookStyles);
if (createSettingsResult.IsFailure)
return createSettingsResult.Errors;
@@ -83,7 +85,7 @@ public class UpdateUserSettingsCommandHandler : ICommandHandler<UpdateUserSettin
}
else
{
// update the stored settings of the current user
// Update the stored settings of the current user.
Result<UserSettings> toDomainEntityResult = getSettingsResult.Value.ToDomainEntity();
if (toDomainEntityResult.IsFailure)
return toDomainEntityResult.Errors;
@@ -93,7 +95,9 @@ public class UpdateUserSettingsCommandHandler : ICommandHandler<UpdateUserSettin
command.ItemsPerPage,
command.ShouldIgnoreThePrefixForAlphaPicker,
command.IsThemeCachingEnabled,
command.ShouldAggregateMetadataWhenMissing);
command.ShouldAggregateMetadataWhenMissing,
command.ShouldRenderPdfAsImages,
command.ShouldPreserveBookStyles);
if (updateSettingsResult.IsFailure)
return updateSettingsResult.Errors;