feat: eReader email labels + AnythingLLM integration#3655
Open
allencai222 wants to merge 3 commits into
Open
Conversation
Allow users with multiple Kindle emails to choose a specific recipient via dropdown (format → email). Backend validates selected email against the user's own kindle_mail list before sending. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Allows admins to configure an AnythingLLM server (URL + API key) via
the Basic Configuration page. When configured, a "Send to AnythingLLM"
button appears on book detail pages for EPUB/PDF files. Clicking it
uploads the book and embeds it into a per-book workspace named
"calibre-{title}", creating the workspace if it does not exist.
- config_sql.py: add config_anythingllm_url / config_anythingllm_api_key
- admin.py: persist the two new config fields
- config_edit.html: admin UI with enable checkbox + URL + API key inputs
- web.py: POST /send-to-anythingllm/<book_id>/<format> route
- detail.html: conditional button shown only when integration is enabled
- details.js: click handler with loading state and error feedback
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Users can now enter entries as 'My Kindle <user@kindle.com>' in their profile alongside plain addresses. The book detail dropdown shows the label instead of the raw address, and each click sends to only that one device. extract_email() is added to helper.py to parse both formats. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR introduces two independent UX improvements for Calibre-Web users:
1. eReader email label support + send to specific address
Problem: Users with multiple Kindle/eReader email addresses configured (comma-separated in their profile) cannot choose which device to send a book to — it always sends to all addresses simultaneously.
Changes:
cps/helper.py:valid_email()now acceptsName <email>entries alongside plain addresses. A newextract_email()helper extracts the bare address from either format.cps/templates/user_edit.html: Input type changed fromemailtotext; label updated to explain theName <email>syntax.cps/web.py(send_to_ereader): Reads aemailPOST parameter and validates it against the current user's own address list before sending to that single address.cps/templates/detail.html: Dropdown items showFormat → Label(using the configured label/name, falling back to the raw address). Each item passes the bare address viadata-email.cps/static/js/details.js: AJAX POST now includes the selectedemailfield.Backward compatibility: Existing plain-address entries continue to work without changes. The fallback for missing/invalid
emailPOST param is the first configured address.2. AnythingLLM integration
Problem: There is no built-in way to push books from Calibre-Web into a local AI knowledge base.
Changes:
cps/config_sql.py: Two new config fields —config_anythingllm_urlandconfig_anythingllm_api_key.cps/admin.py: Persists the two new fields via_config_string.cps/templates/config_edit.html: Admin UI — enable checkbox + server URL + API key inputs (collapsed when disabled, styled consistently with the Goodreads section).cps/web.py(send_to_anythingllm): POST route that uploads the book file (EPUB or PDF) to AnythingLLM's document API, then embeds it into a per-book workspace namedcalibre-{title}(auto-created if absent).cps/templates/detail.html: "Send to AnythingLLM" button rendered only when the integration is configured, for books that have an EPUB or PDF.cps/static/js/details.js: Click handler with spinner/disabled state during the (potentially slow) embedding request.No external dependencies: Uses Python's standard
urllib.requestonly.Test plan
My Kindle <user@kindle.com>, Backup <other@kindle.com>— save succeeds, plain addresses also still acceptedFormat → Labelper entry; clicking sends only to that address🤖 Generated with Claude Code