From 013c5c2dbb6391500886d9bb8631c426b1701700 Mon Sep 17 00:00:00 2001 From: JB Date: Thu, 30 Oct 2025 06:35:33 -0700 Subject: [PATCH] feat: Enhance find books page with template options and settings integration --- abogen/web/routes.py | 2 ++ abogen/web/static/find_books.js | 21 ++++++++++++++++----- abogen/web/templates/find_books.html | 8 ++++++++ 3 files changed, 26 insertions(+), 5 deletions(-) diff --git a/abogen/web/routes.py b/abogen/web/routes.py index 9d5ccd5..34fc7f9 100644 --- a/abogen/web/routes.py +++ b/abogen/web/routes.py @@ -2759,6 +2759,8 @@ def find_books_page() -> ResponseReturnValue: "find_books.html", integrations=integrations, opds_available=_calibre_integration_enabled(integrations), + options=_template_options(), + settings=_load_settings(), ) diff --git a/abogen/web/static/find_books.js b/abogen/web/static/find_books.js index a25c004..b767bb1 100644 --- a/abogen/web/static/find_books.js +++ b/abogen/web/static/find_books.js @@ -367,11 +367,22 @@ if (modal && browser) { throw new Error(payload.error || 'Unable to queue this book.'); } setStatus('Preparing the conversion wizard…', 'success'); - if (payload.redirect_url) { - closeModal(); - window.setTimeout(() => { - window.location.assign(payload.redirect_url); - }, 150); + closeModal(); + const redirectUrl = payload.redirect_url || ''; + if (redirectUrl) { + const wizard = window.AbogenWizard; + if (wizard?.requestStep) { + try { + const target = new URL(redirectUrl, window.location.origin); + target.searchParams.set('format', 'json'); + await wizard.requestStep(target.toString(), { method: 'GET' }); + } catch (wizardError) { + console.error('Unable to open wizard via JSON payload', wizardError); + window.location.assign(redirectUrl); + } + } else { + window.location.assign(redirectUrl); + } } } catch (error) { setStatus(error instanceof Error ? error.message : 'Unable to queue this book.', 'error'); diff --git a/abogen/web/templates/find_books.html b/abogen/web/templates/find_books.html index b4ce63e..6ecb54c 100644 --- a/abogen/web/templates/find_books.html +++ b/abogen/web/templates/find_books.html @@ -80,10 +80,18 @@ {% endif %} +{% with pending=None, readonly=False, active_step='settings' %} + {% include "partials/upload_modal.html" %} +{% endwith %} +{% include "partials/reader_modal.html" %} {% endblock %} {% block scripts %} {{ super() }} + + + + {% if opds_available %} {% endif %}