feat: Enhance find books page with template options and settings integration

This commit is contained in:
JB
2025-10-30 06:35:33 -07:00
parent e7f6f0221d
commit 013c5c2dbb
3 changed files with 26 additions and 5 deletions
+2
View File
@@ -2759,6 +2759,8 @@ def find_books_page() -> ResponseReturnValue:
"find_books.html", "find_books.html",
integrations=integrations, integrations=integrations,
opds_available=_calibre_integration_enabled(integrations), opds_available=_calibre_integration_enabled(integrations),
options=_template_options(),
settings=_load_settings(),
) )
+15 -4
View File
@@ -367,11 +367,22 @@ if (modal && browser) {
throw new Error(payload.error || 'Unable to queue this book.'); throw new Error(payload.error || 'Unable to queue this book.');
} }
setStatus('Preparing the conversion wizard…', 'success'); setStatus('Preparing the conversion wizard…', 'success');
if (payload.redirect_url) {
closeModal(); closeModal();
window.setTimeout(() => { const redirectUrl = payload.redirect_url || '';
window.location.assign(payload.redirect_url); if (redirectUrl) {
}, 150); 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) { } catch (error) {
setStatus(error instanceof Error ? error.message : 'Unable to queue this book.', 'error'); setStatus(error instanceof Error ? error.message : 'Unable to queue this book.', 'error');
+8
View File
@@ -80,10 +80,18 @@
</div> </div>
</div> </div>
{% endif %} {% endif %}
{% with pending=None, readonly=False, active_step='settings' %}
{% include "partials/upload_modal.html" %}
{% endwith %}
{% include "partials/reader_modal.html" %}
{% endblock %} {% endblock %}
{% block scripts %} {% block scripts %}
{{ super() }} {{ super() }}
<script id="voice-sample-texts" type="application/json">{{ options.sample_voice_texts | tojson }}</script>
<script type="module" src="{{ url_for('static', filename='dashboard.js') }}"></script>
<script type="module" src="{{ url_for('static', filename='prepare.js') }}"></script>
<script type="module" src="{{ url_for('static', filename='speakers.js') }}"></script>
{% if opds_available %} {% if opds_available %}
<script type="module" src="{{ url_for('static', filename='find_books.js') }}"></script> <script type="module" src="{{ url_for('static', filename='find_books.js') }}"></script>
{% endif %} {% endif %}