mirror of
https://github.com/kikootwo/ReadMeABook.git
synced 2026-06-03 04:40:09 +00:00
Add ROOTLESS_CONTAINER and request UI updates
Introduce ROOTLESS_CONTAINER env to opt out of gosu (replace /proc uid_map detection) and update entrypoint messaging; adjust app-start.sh and redis-start.sh to skip gosu when ROOTLESS_CONTAINER=true and warn on UID/GID mismatch only when applicable. Backend: include audiobook audibleAsin in admin requests response (mapped to asin) and pass baseUrl through test-flaresolverr endpoint to the FlareSolverr tester. Frontend: RecentRequestsTable and RequestActionsDropdown now surface asin, accept/passthrough annasArchiveBaseUrl, and add a "View Details" flow using AudiobookDetailsModal; admin page passes ebook baseUrl from settings. InteractiveTorrentSearchModal refactor: improved UX/UI, keyboard handling, portal/modal mounting, skeleton/loading states, formatting helpers, and richer result display. Tests updated to match changes.
This commit is contained in:
@@ -74,6 +74,29 @@ describe('RequestActionsDropdown', () => {
|
||||
expect(onDelete).toHaveBeenCalledWith('req-1', 'Pending Book');
|
||||
});
|
||||
|
||||
it('uses configured base URL for ebook View Source link', () => {
|
||||
render(
|
||||
<RequestActionsDropdown
|
||||
request={{
|
||||
requestId: 'req-ebook',
|
||||
title: 'Ebook Title',
|
||||
author: 'Author',
|
||||
status: 'downloaded',
|
||||
type: 'ebook',
|
||||
torrentUrl: JSON.stringify(['https://annas-archive.li/slow_download/abc123def456abc123def456abc123de/0/5']),
|
||||
}}
|
||||
onManualSearch={vi.fn().mockResolvedValue(undefined)}
|
||||
onCancel={vi.fn().mockResolvedValue(undefined)}
|
||||
onDelete={vi.fn()}
|
||||
annasArchiveBaseUrl="https://custom-mirror.org"
|
||||
/>
|
||||
);
|
||||
|
||||
fireEvent.click(screen.getByTitle('Actions'));
|
||||
const viewSourceLink = screen.getByText('View Source').closest('a');
|
||||
expect(viewSourceLink).toHaveAttribute('href', 'https://custom-mirror.org/md5/abc123def456abc123def456abc123de');
|
||||
});
|
||||
|
||||
it('shows view source and ebook fetch when available', async () => {
|
||||
const onFetchEbook = vi.fn().mockResolvedValue(undefined);
|
||||
const onDelete = vi.fn();
|
||||
|
||||
@@ -75,7 +75,7 @@ describe('useEbookSettings', () => {
|
||||
expect(result.current.flaresolverrTestResult?.message).toContain('Please enter a FlareSolverr URL');
|
||||
});
|
||||
|
||||
it('tests FlareSolverr connection successfully', async () => {
|
||||
it('tests FlareSolverr connection successfully and sends baseUrl', async () => {
|
||||
fetchWithAuthMock.mockResolvedValueOnce({
|
||||
ok: true,
|
||||
json: async () => ({ success: true, message: 'OK' }),
|
||||
@@ -91,6 +91,10 @@ describe('useEbookSettings', () => {
|
||||
});
|
||||
|
||||
expect(result.current.flaresolverrTestResult?.success).toBe(true);
|
||||
// Verify baseUrl is included in the request body
|
||||
const callBody = JSON.parse(fetchWithAuthMock.mock.calls[0][1].body);
|
||||
expect(callBody.baseUrl).toBe('https://annas-archive.li');
|
||||
expect(callBody.url).toBe('http://flare');
|
||||
});
|
||||
|
||||
it('handles FlareSolverr test failures', async () => {
|
||||
|
||||
Reference in New Issue
Block a user