Skip to content

feat(opds): stop sharing when the active library changes - #164

Merged
phildenhoff merged 1 commit into
mainfrom
opds-stop-on-library-switch
Sep 22, 2026
Merged

phildenhoff merged 1 commit into
mainfrom
opds-stop-on-library-switch

Conversation

@phildenhoff

Copy link
Copy Markdown
Member

Problem

The OPDS server reads live application state, so switching libraries while sharing was active would silently start serving the new library under the old share — a privacy surprise, and the books a reader has cached would no longer match their ids (OPDS ids derive from library identity).

What this does

init_client — the single path that activates a library — now stops the sharing service after a successful switch. Stopping is instant and idempotent (no-op when sharing was off). Creating a library does not activate one, so the onboarding flow is untouched.

Testing

Existing state-machine tests cover the stop path (including the drain semantics); this PR is the app-side wiring. 57 OPDS tests green, workspace clean.

Follow-up note for #151

The UI should surface this as "sharing stopped — you opened a different library" rather than silently showing Stopped. (Service-side reason payloads deliberately deferred.)

@github-actions

Copy link
Copy Markdown

libcalibre Test Coverage Report

Overall coverage: 80.16%

📊 Download HTML Report

Coverage breakdown available in the artifacts.

@phildenhoff
phildenhoff force-pushed the opds-stop-on-library-switch branch from 0547c88 to 3174a31 Compare September 22, 2026 07:01
@github-actions

Copy link
Copy Markdown

libcalibre Test Coverage Report

Overall coverage: 80.16%

📊 Download HTML Report

Coverage breakdown available in the artifacts.

@phildenhoff
phildenhoff force-pushed the opds-stop-on-library-switch branch from 3174a31 to 21ab9e5 Compare September 22, 2026 07:15
@github-actions

Copy link
Copy Markdown

libcalibre Test Coverage Report

Overall coverage: 80.16%

📊 Download HTML Report

Coverage breakdown available in the artifacts.

@phildenhoff
phildenhoff enabled auto-merge (squash) September 22, 2026 07:26
Opening or creating a library while sharing is active now stops sharing.
The running server reads live state, so without this a switch would
silently start serving the new library - a privacy surprise, and the
books a reader has cached would no longer match their ids.
@phildenhoff
phildenhoff force-pushed the opds-stop-on-library-switch branch from 21ab9e5 to 2a15ea4 Compare September 22, 2026 07:29
@github-actions

Copy link
Copy Markdown

libcalibre Test Coverage Report

Overall coverage: 80.16%

📊 Download HTML Report

Coverage breakdown available in the artifacts.

@phildenhoff
phildenhoff merged commit 0af3c0e into main Sep 22, 2026
7 checks passed
@phildenhoff
phildenhoff deleted the opds-stop-on-library-switch branch September 22, 2026 07:36
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