refactor: complete web project consolidation and stabilize identity flow
- Finalized move from NexusReader.Web.New to NexusReader.Web - Implemented robust ServerIdentityService with UserManager and SignInManager - Updated UI components to handle authentication state synchronization via force reload - Refined BookIngestionModal styling following Nexus Neon design system - Resolved namespace conflicts and updated CI/CD/VS Code configurations - Fixes #33
This commit is contained in:
@@ -2,7 +2,6 @@ using System.Net.Http.Json;
|
||||
using FluentResults;
|
||||
using NexusReader.Application.Abstractions.Services;
|
||||
using NexusReader.Application.Queries.Reader;
|
||||
using VersOne.Epub;
|
||||
|
||||
namespace NexusReader.Web.Client.Services;
|
||||
|
||||
@@ -19,19 +18,24 @@ public class WasmEpubReader : IEpubReader
|
||||
{
|
||||
try
|
||||
{
|
||||
var response = await _httpClient.GetAsync($"api/epub/content?index={chapterIndex}&userId={userId}");
|
||||
var response = await _httpClient.GetAsync($"/api/epub/{chapterIndex}");
|
||||
if (response.IsSuccessStatusCode)
|
||||
{
|
||||
var result = await response.Content.ReadFromJsonAsync<ReaderPageViewModel>();
|
||||
return result != null ? Result.Ok(result) : Result.Fail("Failed to deserialize reader page.");
|
||||
var viewModel = await response.Content.ReadFromJsonAsync<ReaderPageViewModel>();
|
||||
return viewModel != null ? Result.Ok(viewModel) : Result.Fail("Failed to deserialize response.");
|
||||
}
|
||||
return Result.Fail("Failed to fetch EPUB content from server.");
|
||||
|
||||
// Try to read the error message from the body
|
||||
var errorBody = await response.Content.ReadAsStringAsync();
|
||||
return Result.Fail($"Server error ({response.StatusCode}): {errorBody}");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return Result.Fail(new Error("Network error while fetching EPUB content.").CausedBy(ex));
|
||||
// Fallback for network errors or parsing exceptions
|
||||
return Result.Fail(new Error($"Network or parsing error: {ex.Message}").CausedBy(ex));
|
||||
}
|
||||
}
|
||||
// Metadata extraction moved to WasmEpubMetadataExtractor
|
||||
}
|
||||
|
||||
public class WasmEpubMetadataExtractor : IEpubMetadataExtractor
|
||||
@@ -40,7 +44,7 @@ public class WasmEpubMetadataExtractor : IEpubMetadataExtractor
|
||||
{
|
||||
try
|
||||
{
|
||||
using var bookRef = await EpubReader.OpenBookAsync(epubStream);
|
||||
using var bookRef = await VersOne.Epub.EpubReader.OpenBookAsync(epubStream);
|
||||
var title = bookRef.Title ?? "Unknown Title";
|
||||
var author = bookRef.Author ?? "Unknown Author";
|
||||
byte[]? cover = await bookRef.ReadCoverAsync();
|
||||
|
||||
Reference in New Issue
Block a user