Die max()-Semantik aus v14 verglich nur die grobe scroll_fraction. Da
scroll_fraction und position_anchor gemeinsam, aber entkoppelt gespeichert
werden, konnte ein einzelner Save mit transient zu hoher fraction (z.B.
instabiles Layout beim Laden) die Position dauerhaft einfrieren: jeder
spätere echte Fortschritt hatte eine kleinere fraction und wurde inklusive
Anker verworfen — der Leser landete immer wieder an derselben Stelle.
Fix: Vergleich läuft jetzt über den Blockindex im Anker (die Größe, die
auch die Sprungposition bestimmt), mit innerFraction als Tiebreaker.
scroll_fraction dient nur noch als Fallback für PDFs ohne Anker. Server
(_progress_is_further) und Client (_cmpProgress) nutzen identische Logik;
loadBookList-Push und lokaler Cache ebenfalls. Bestehende eingefrorene
Einträge entfrieren sich beim ersten Weiterlesen selbst.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Der am weitesten gelesene Wert hat immer Vorrang:
- Server: scroll_fraction = max(neu, aktuell) — ein afk-Fenster bei 10%
kann nicht mehr 80% überschreiben
- Client loadBookList: wenn lokaler Fortschritt > Server, wird gepusht
und für die Anzeige verwendet (deckt Offline-Lesen ab)
- Pending-Flag-Logik entfernt — nicht mehr nötig dank max-Semantik
- saveReaderProgress(force=true): neuer force-Parameter schreibt
Position unabhängig vom gespeicherten Maximum; Button ⚑ im
Reader-Header für den Ausnahmefall "zurück-zum-Anfang"
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Timestamp-Vergleich in _saveBookMeta entfernt: client-seitige
ISO-Strings (new Date().toISOString) lagen fast immer leicht vor dem
Serverwert und haben dadurch regelmässig korrekten Online-Fortschritt
überschrieben.
Neu: explizites Pending-Flag (localStorage diora_pending_progress) —
gesetzt wenn saveReaderProgress offline scheitert, gelöscht nach
erfolgreicher Synchronisierung.
- _saveBookMeta nutzt das Flag statt Zeitstempel: Server-Daten
überschreiben lokalen Fortschritt nur wenn kein Pending-Flag gesetzt
- _syncPendingProgress: pusht ausstehenden Fortschritt beim
online-Event bevor loadBookList läuft
- saveReaderProgress setzt das Flag nur wenn !navigator.onLine
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- _saveBookMeta vergleicht local vs. Server last_read — neuere lokale
Daten (offline gelesen) überleben den nächsten Server-Abruf
- loadBookList pusht beim Online-Werden automatisch lokal neueren
Fortschritt an den Server bevor die Liste gerendert wird
- saveBookmarks/saveHighlights markieren fehlgeschlagene Saves als
pending sync (localStorage); beim nächsten online-Event werden alle
pending Annotationen zuerst gepusht, dann erst die Buchliste geladen
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Statt padding-top gegen die Navbar zu kämpfen ist #tabs jetzt
position:fixed direkt unterhalb der Navbar (top:var(--nav-h),
z-index:150). Damit ist die Leiste garantiert immer sichtbar,
unabhängig vom Scroll-Zustand oder Offline-Status.
main-content padding-top auf calc(var(--nav-h)+3rem) erhöht um
Platz für Navbar+Tabs zu schaffen. Offline-Banner vereinfacht zu
einer body-Klasse (kein fixed DOM-Element mehr).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- main-content padding-top auf calc(var(--nav-h) + 0.75rem) erhöht
damit die Tab-Leiste (Radio/Focus/Podcasts/Books) sicher unterhalb
der fixed Navbar liegt — auf Desktop und Mobile
- SW v10: sendet SW_ACTIVATED an alle offenen Tabs wenn ein neuer SW
übernimmt; app.js lädt daraufhin neu (außer wenn ein Buch geöffnet
ist) — verhindert dass der Browser eine uralte HTTP-gecachte Version
ausliefert
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Bei Offline-Start oder Wechsel in Flugzeugmodus: roter Banner
unterhalb der Navbar, automatischer Wechsel zum Books-Tab (einziger
sinnvoller Tab offline), Upload-Zone wird ausgeblendet
- Bei Rückkehr online: Banner verschwindet, Upload-Zone erscheint wieder,
Buchliste wird neu synchronisiert
- openBook unterscheidet jetzt zwischen "nicht gecacht" (Toast-Hinweis
zum einmaligen Online-Öffnen) und echtem Defekt (markBookBroken wie
bisher) — kein stilles Scheitern mehr
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Ohne diesen Fix schlägt das Öffnen der App im Flugzeug fehl, weil der
Service Worker die HTML-Seite (/) nicht cached — der Browser zeigt
dann eine Netzwerkfehler-Seite bevor JS überhaupt startet.
Strategie: Network-first für Navigationsanfragen, bei Netzwerkfehler
die zuletzt gecachte Version ausliefern. Nach dem ersten Online-Besuch
funktioniert die App vollständig offline.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Ohne navigator.storage.persist() ist der IndexedDB-Speicher "best-effort"
und kann vom Browser bei Speicherknappheit still gelöscht werden. Der
Aufruf erfolgt beim ersten Schreiben eines Buches in den Cache — Chrome
gewährt das für installierte PWAs automatisch, Firefox kann einen Dialog
zeigen.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Chrome 98+ hat Probleme mit kombinierten purpose-Werten ("any maskable")
auf einem einzelnen Icon-Eintrag. Separate Einträge für "any" und
"maskable" sind zuverlässiger und entsprechen der Spec-Empfehlung.
SW-Version auf v8 erhöht, um nach den JS-Änderungen einen sauberen
Cache-Neustart zu erzwingen.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Popover had transparent background because --bg-card is explicitly
transparent; now uses hardcoded colors with theme-aware overrides.
Also strips title attributes during EPUB sanitization to prevent
native browser tooltips from appearing while reading.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- IndexedDB v2 mit zwei neuen Stores: book_meta (Buchliste +
Lesefortschritt) und book_annotations (Lesezeichen & Highlights)
- loadBookList fällt bei Netzwerkfehler auf lokalen Meta-Cache zurück,
blendet Upload-Zone aus und zeigt Offline-Hinweis
- Leseposition (scroll_fraction + position_anchor) wird bei jedem
Auto-Save lokal gecacht, sodass offline-Öffnen am richtigen Ort
landet
- Lesezeichen und Highlights werden nach Server-Abruf lokal gecacht
und bei Netzwerkfehler von dort geladen; Änderungen offline bleiben
bis zur nächsten Synchronisierung erhalten
- Mobile Reader-Header: kompaktere Abstände, Fortschritts-Input auf
kleinen Screens ausgeblendet
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Hovering over a footnote reference shows the footnote content in a
floating popover; moving the mouse away dismisses it. On mobile, a
tap toggles the popover with an ✕ close button.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
replace-data endpoint now optionally accepts meta_ct/meta_iv.
The client extracts title/author from the uploaded file (same as
normal upload), re-encrypts metadata with the current key, and sends
both data and meta together — so broken books are fully restored
including their displayed title and author.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
When a book fails to open, a '!' button appears next to it in the list.
Clicking it prompts for the original file; the file is re-encrypted with
the current key and replaces the broken ciphertext on the server while
keeping all metadata, progress, highlights and bookmarks intact.
- Add POST /books/<pk>/replace-data/ endpoint (updates data only)
- Add _evictCachedBook() to clear IndexedDB cache for a single book
- Replace complex client-side re-encryption on password change with a
simple confirm() warning that books will need to be re-uploaded
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The old key comparison was wrong — the localStorage key may have been
randomly generated rather than PBKDF2-derived. Fix:
- Add /accounts/check-password/ to validate the old password server-side
before touching any keys
- Use the localStorage key directly as the old decryption key (it is
always the correct source of truth, regardless of how it was generated)
- Derive the new key from the new password via PBKDF2
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The encryption key is PBKDF2-derived from the login password. Changing
the password without migrating the key would make all books undecryptable
on the next login.
- Add POST /books/<pk>/rekey/ endpoint to replace a book's ciphertexts
- Password change form is now JS-driven: before submitting to the server,
derives the old key, verifies it matches localStorage, derives the new
key, re-encrypts all books (data + meta) and their highlights/bookmarks,
updates localStorage, then submits the Django form
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Uses Django's built-in PasswordChangeForm and update_session_auth_hash
so the session stays valid after the change. Form is hidden in a
<details> element and opens automatically on validation errors.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Publisher EPUBs often set font-weight via <b>/<strong> tags or inline
style attributes. A new toggle in the settings panel adds the
.reader-no-bold class which overrides all font weights to normal.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Add font family selector (Serif/Sans/Verdana/Mono) to reader settings panel,
saved per book in localStorage
- Strip <style>/<script> blocks before regex and DOMParser processing to avoid
working over large base64-embedded font CSS in publisher EPUBs
- Parallelize image blob URL creation with Promise.all instead of sequential await
- Inject chapter HTML progressively in batches with requestAnimationFrame yields
to keep the UI responsive when loading many-chapter books
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Current page renders almost instantly, no overlay needed.
Overlay stays for initial book open only.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
renderPdf now takes an optional pivotPage. Pass 1 builds the full DOM
and sizes all canvases (instant). Then scrolls to the pivot page
immediately so the user stays in place. Pass 2 renders pixels from
pivot→end, then pivot-1→start.
reRenderPdf detects the current visible page before re-rendering and
passes it as pivot, so zoom no longer resets scroll position.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Scroll position was restored before browser finished layout, so
scrollHeight was still wrong. Now waits two animation frames after
reRenderPdf completes before restoring position.
Also shows loading overlay during zoom re-renders, not just on initial load.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Uses a 16ms interval (~60fps) instead of per-event smooth scroll,
so holding j/k scrolls fluidly. d/u/f/b remain one-shot with smooth.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Moved overlay out of contentEl (which renderPdf clears immediately)
into the reader-overlay element. It now stays visible for the entire
render duration and is removed only after renderPdf resolves.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Displays a dark background with a spinning indicator in the reader
content area before renderPdf starts. renderPdf clears innerHTML
itself when it begins, so no explicit cleanup needed.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
html/body no longer scroll — overflow: hidden on both.
.main-content gets height: calc(100% - nav-h) and overflow-y: auto
so it's the single scroll container. The reader overlay is
position: fixed so it's unaffected.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adds display_override: window-controls-overlay to the manifest so
the app extends into the titlebar area. The navbar becomes draggable
and uses env(titlebar-area-*) to avoid the window controls buttons.
Interactive elements stay clickable via -webkit-app-region: no-drag.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Inline onclick='playStation("url", "name", null)' broke because
JSON.stringify wraps strings in double quotes, conflicting with the
onclick attribute quotes. Replaced with data attributes + addEventListener.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Zoom is now baked into the canvas render scale instead of being applied
via CSS zoom. CSS zoom only scales pixels already on the canvas, causing
blurriness at high DPR (e.g. PWA on mobile). Now the canvas is rendered
at the correct resolution for the chosen zoom level.
Also: stop nulling currentPdfDoc on re-render so PDF.js page cache is
preserved, making zoom re-renders significantly faster.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The 📻 button now opens a sidebar with the currently playing station/track,
play/stop + volume control, and the saved stations list. The old focus
station configuration UI (presets, custom URL input, save-to-server) and
the auto-play-on-book-open behavior are removed.
Closes#6
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Each book gets its own key (diora_reader_settings_{bookId}).
Opening a book resets to defaults then applies book-specific overrides,
so zoom, spread, invert, theme etc. are remembered independently per book.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Spread mode: new toggle in reader settings renders pages side-by-side
(cover alone, then pairs 2-3, 4-5...) using full screen width. Each
page scales to half the container. Navigation and scroll position
tracking are unchanged since per-page IDs are preserved.
Pinch-to-zoom: captures 2-finger pinch on the PDF reader, blocking
native browser zoom. Live CSS zoom during gesture, snaps to nearest
10% step on release. Single-finger scroll unaffected. applyPdfZoom
moved to module level so touch handlers can call it. Touch listeners
cleaned up on reader close.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- HIGHLIGHTS_MAX_BYTES, BOOKMARKS_MAX_BYTES: books size limits now in settings
- PODCAST_INBOX_PAGE_SIZE: shared between podcasts/views.py and app.js via DIORA_CONFIG
- VOLUME_DEFAULT: radio stream player default volume
- ITUNES_TIMEOUT: unified iTunes API timeout (was 5s vs 6s inconsistency)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Backend settings are now the single source of truth for EBOOK_MAX_BYTES
and BG_MAX_BYTES. A new context processor exposes them to all templates,
and base.html injects them as window.DIORA_CONFIG so app.js reads from
there instead of hardcoded values.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Create EBookProgress on upload so new books get a last_read timestamp
and sort to the top of the book list
- Update frontend file size check from 10 MB to 50 MB
- Fix backend error message to say 50 MB instead of 10 MB
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Listens for navigator.mediaDevices.devicechange and re-routes the
audio element to the new default output device without a page reload.
Debounced 500ms to handle BT device bursts. Podcasts resume at the
correct timestamp via loadedmetadata.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Hide volume label/slider/input on mobile (≤600px)
- Add − and + buttons flanking the PDF zoom slider
- Preserve scroll fraction across zoom changes in PDF scroll mode
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Move auto-save timer setup to after position restore so an early
visibilitychange can't overwrite the saved position with 0
- Add missing restore path for non-paginated PDF scroll mode
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Cache encrypted book data in IndexedDB (cache-first on open)
- Evict books not read for 4 weeks on book list load
- Fix PDF paginated mode not activating on book open (mobile)
- enterPdfPaginatedMode() now called after position restore in openBook()
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Replace timer/edge-hover system with a simple click-to-toggle.
Tapping interactive elements (buttons, links, settings) is ignored.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Scale canvas by devicePixelRatio and constrain CSS size to logical
pixels so PDF pages render crisp on Retina and mobile displays.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Replaces scroll_fraction-only position tracking with element-based
anchors ("{index}:{innerFraction}"). Position is now stable across
font size changes and different screen sizes. A ResizeObserver
restores the anchor on viewport/orientation changes.
Falls back to scroll_fraction for books without a saved anchor.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>