Skip to content

Calibre content server - #89

Open
benjitobz wants to merge 5 commits into
Chaptarr:developfrom
benjitobz:calibre-content-server
Open

Calibre content server#89
benjitobz wants to merge 5 commits into
Chaptarr:developfrom
benjitobz:calibre-content-server

Conversation

@benjitobz

Copy link
Copy Markdown

Description

Adds a connect notification for the "Calibre Content Server":

  • URL (required), username and password (optional, only needed if the server has auth), and an
    "Allow Edits & Deletes" checkbox that's off by default.
  • On import every ebook file in the release is POSTed to cdb/add-book, sequentially — the
    content server would rather take them one at a time. Audiobook files are skipped.
  • Adds go up with add_duplicates=0, so a book the library already has is skipped and logged
    instead of duplicated.
  • With edits and deletes enabled, deleting a book or a book file in Chaptarr deletes the
    matching book on the server, and a retag or an upgrade replaces it. With it off none of those
    handlers do anything, so the integration stays add-only until you opt in.

Quick note on "edits and deletes":
Edits and deletes have to find the book in the calibre db first. That match is by author, then by title, with case and punctuation removed and a trailing parenthetical stripped from both sides. calibre takes its title from inside the epub, and those usually carry decorations the Chaptarr title doesn't — "Out of Spite, Out of Mind (Magic 2.0 Book 5)" where Chaptarr has plain "Out of Spite, Out of Mind" — so comparing the two literally matches nothing, quietly. Normalising keeps it an equality test rather than a fuzzy one, so it can't wander onto a neighbouring book in the same series, and a delete that comes up empty logs that instead of reporting success.

Validation

  • The connection test POSTs an empty body to cdb/add-book, the same endpoint pushes use.
    calibre checks auth and the write permission before it looks for a body, so a server that
    would accept books answers 400 ("A request body containing the file data must be
    specified") and one that wouldn't answers 401 or 403. Nothing is added — checked against
    a live library by count.
  • With the credential fields empty the test sends throwaway sentinel credentials, so the shared
    credential cache can't answer the challenge on its behalf.
  • A username without a password is rejected before any request goes out, since calibre's 400
    for that case is indistinguishable from the "authenticated, no body" 400 the test wants.
  • An empty URL says so, instead of Invalid Url: '{url}' with the placeholder unfilled.
  • 401 reports authentication failed, 403 reports that the server doesn't accept anonymous
    changes and needs credentials, 404 and redirects report that the URL isn't a content server
    — pointing at Calibre-Web's web UI instead of the content server port lands here.

Related PRs

Calibre-Web can't run calibre's content server itself, which is the other half of this. PRs are
up for Calibre-Web and both forks:

Database Migration

NO.

How was this tested?

  • Tested against Calibre-Web-Automated running its bundled content server: imports from a
    tracked download push and show up in the library, re-imports skip as duplicates, a delete
    with the option off leaves the server alone and with it on removes the right book, and each
    of the failing test cases above against both an authenticated and an anonymous server.
  • Setup: Docker / Docker Compose for Chaptarr and CW / CWA

Screenshots - Not really a change but this is how it looks

add-connection-form connection-tile

benjitobz and others added 5 commits August 20, 2026 21:56
Pushes imported ebooks to a calibre content server (e.g. Calibre-Web
Automated) one at a time, skipping duplicates. Optional edit and delete
sync, off by default: when enabled, book deletes, retags and upgrades in
Chaptarr are propagated to the content server. Connection URL is
required; username and password are optional and the connection can be
verified with the standard test button.
Calibre stores the title embedded in the pushed file, which can carry
series decorations the Chaptarr title lacks (and vice versa), so both
sides are compared with trailing parentheticals stripped and
punctuation-insensitive normalization. No-match on delete now logs at
info so it is visible without debug logging.
Testing with a read endpoint gave false passes: the shared credential
cache answers auth challenges with credentials cached by other requests
to the same host, and open-mode servers accept anonymous reads while
rejecting remote anonymous writes. The test now POSTs an empty body to
cdb/add-book (no side effects) with sentinel credentials when none are
configured, so missing or wrong credentials fail deterministically.
Empty URL now validates with a clear message instead of a raw
placeholder.
Calibre answers malformed Basic credentials (empty password) with 400
rather than 401, which the connection test read as passing the auth
gate. Validation now rejects a username without a password before any
request is made, mirroring the existing password-without-username rule.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant