### Description This PR implements **Issue #34: [UI/UX] Implement Hybrid Metadata Verification Form in Ingestion Modal**. ### Key Changes - **Metadata Verification State**: Introduced a new state in `BookIngestionModal.razor` allowing users to edit `Title` and `Author` before final ingestion. - **Cover Image Preview**: Added a high-fidelity cover preview with a CSS-based glowing placeholder fallback for books without embedded covers. - **Ingestion Pipeline**: - Implemented `IngestEbookCommand` and `IngestEbookCommandHandler`. - Added `IBookStorageService` and its implementation for managing EPUB and cover file storage. - Exposed `POST /api/library/ingest` Minimal API endpoint with `.DisableAntiforgery()` to handle client-side JSON uploads. - **Stability Fixes**: - Resolved DI validation errors in the WASM client by providing a dummy `IBookStorageService` registration. - Adjusted Kestrel request limits to handle large EPUB payloads (up to 100MB). - Corrected middleware ordering to ensure Antiforgery works correctly with Authentication. ### Verification - Solution builds successfully. - Manual verification of modal state transitions and API ingestion logic. Closes #34. --------- Co-authored-by: Marek Jasiński <jasins.marek@gmail.com> Reviewed-on: #41 Reviewed-by: Marek Jaisński <jasins.marek@gmail.com> Co-authored-by: Antigravity <antigravity@google.com> Co-committed-by: Antigravity <antigravity@google.com>
This commit was merged in pull request #41.
This commit is contained in:
@@ -45,6 +45,7 @@ builder.Services.AddScoped(sp => sp.GetRequiredService<IHttpClientFactory>().Cre
|
||||
// Dummy registrations for server-only handlers to satisfy DI validation
|
||||
builder.Services.AddSingleton<IDbContextFactory<AppDbContext>>(new ThrowingDbContextFactory());
|
||||
builder.Services.AddSingleton<IEmbeddingGenerator<string, Embedding<float>>>(new ThrowingEmbeddingGenerator());
|
||||
builder.Services.AddSingleton<IBookStorageService>(new ThrowingBookStorageService());
|
||||
|
||||
builder.Services.AddApplication();
|
||||
builder.Services.AddScoped<IEpubReader, WasmEpubReader>();
|
||||
@@ -64,3 +65,13 @@ public class ThrowingEmbeddingGenerator : IEmbeddingGenerator<string, Embedding<
|
||||
=> throw new NotSupportedException("Embedding generation cannot be used in WASM client.");
|
||||
public object? GetService(Type serviceType, object? serviceKey = null) => null;
|
||||
}
|
||||
|
||||
public class ThrowingBookStorageService : IBookStorageService
|
||||
{
|
||||
private const string ErrorMessage = "File storage operations are not supported in the WASM client. Use the API endpoint for ingestion.";
|
||||
|
||||
public Task<string> SaveEbookAsync(byte[] data, string fileName) => throw new NotSupportedException(ErrorMessage);
|
||||
public Task<string> SaveEbookAsync(Stream data, string fileName) => throw new NotSupportedException(ErrorMessage);
|
||||
public Task<string?> SaveCoverAsync(byte[] data, string fileName) => throw new NotSupportedException(ErrorMessage);
|
||||
public Task<string?> SaveCoverAsync(Stream data, string fileName) => throw new NotSupportedException(ErrorMessage);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user