53219 Commits

Author SHA1 Message Date
Victor239
ba5555303e E-book viewer: track pending annotation uploads per-book in IDB
Previously a single 'pending-annot-upload' IDB key was used, so only
the last-annotated book's pending upload survived an app kill. With
multiple books annotated offline (or across multiple tabs), earlier
books' uploads were silently dropped from the queue. A related bug
caused stale in-memory state from a previous book to be used on Sync
after navigating between books in the same tab, potentially sending the
wrong annotations to the wrong book endpoint.

Changes:
- IDB key is now 'pending-annot-upload:{library_id}/{book_id}/{fmt}',
  one entry per book, so all books' pending uploads survive independently
- New get_all_pending_annot_uploads() uses an IDB cursor range query to
  retrieve every pending entry
- clear_pending_annot_upload() now takes book identity params and a
  completion callback so the next upload starts only after the IDB
  delete has committed
- _make_annot_upload_done() returns a per-book closure used as the ajax
  callback, replacing the single _annot_upload_done method
- After each successful upload, _upload_next_from_idb() fetches and
  uploads the next pending entry, draining the queue sequentially
- _on_network_restored() no longer requires a book to be open, so
  pending uploads from other books are flushed even from the homepage
- load_book() clears unsynced_amap and the indicator timer/state so
  stale in-memory state from the previous book is never used
2026-03-22 14:15:42 +00:00
Victor239
215caf3525 E-book viewer: use Web Locks to prevent duplicate storage.persist() prompts
When multiple tabs open simultaneously, coordinate with navigator.locks
using ifAvailable so only the first tab calls persist(). Tabs that lose
the lock skip the call entirely, preventing the browser from showing
redundant permission prompts. Falls back to the persisted() check for
browsers without Web Locks support.
2026-03-22 12:24:43 +00:00
Victor239
466e357975 E-book viewer: skip storage.persist() if persistence already granted
Check navigator.storage.persisted() before calling persist(), so tabs
opened after permission was already granted do not trigger a redundant
browser prompt.
2026-03-22 12:13:37 +00:00
Victor239
9826040725 E-book viewer: use builtin highlight yellow for unsynced sync button tint
Replace hardcoded #d4a017 with builtin_color('yellow', is_dark_theme()),
which resolves to #ffeb6b (light theme) or #906e00 (dark theme) — the
same values used for yellow text highlights. Single source of truth in
calibre/constants.py.
2026-03-22 11:24:12 +00:00
Victor239
f5197fc6c0 Revert: remove resend on auth failure 2026-03-22 11:12:38 +00:00
Victor239
b3c2191022 E-book viewer: retry annotation upload every 5s after 401 auth
Replace the single 1.5s one-shot retry with a repeating 5s timer loop.
Each 401 response cancels any pending retry and schedules a new one 5s
later, so auth retries continue indefinitely until the upload succeeds —
regardless of how long the user takes to submit credentials in the
browser auth dialog.

On success the retry timer is cancelled. A manually triggered
upload_pending_annotations call also cancels any pending retry before
firing its own request.
2026-03-22 01:07:48 +00:00
Victor239
0969737df7 E-book viewer: retry annotation upload once after 401 auth challenge
When the calibre server restarts with user/password auth, an in-flight
annotation upload receives a 401. The browser shows the auth dialog and
the user provides credentials, but nothing retried the upload afterward.

Fix: on a 401 response, schedule one retry 1.5s later (giving the
browser time to process the auth dialog and store credentials). A flag
prevents cascading retries — if the second attempt also fails the
indicator stays on and the user can sync manually via the Sync button.
The flag resets on success or at the start of any new upload attempt.
2026-03-22 00:51:33 +00:00
Victor239
049b91580a E-book viewer: fix unsynced indicator missing after Android app kill
When the page reloads after an app kill, upload_pending_annotations
finds the surviving IDB entry and sets unsynced_amap, but never called
_reschedule_unsynced_indicator — so the 60s timer never started and
the indicator never appeared even if the upload failed.

Fix: call _reschedule_unsynced_indicator after loading unsynced_amap
from IDB, giving the same behaviour as a fresh annotation upload.
2026-03-22 00:49:58 +00:00
Victor239
0d9371bd62 E-book viewer: show unsynced changes indicator after 60s
- Tint the Sync button icon amber (#d4a017) when annotation uploads
  have been failing for >60s
- Show persistent "Unsynced changes" text in the bottom footer margin
  at the same 60s threshold, using the existing current_status_message
  override slot in update_header_footer
- Track indicator state with a reschedulable timer in ReadUI so rapid
  annotation saves don't flicker the indicator; cleared automatically
  on successful upload
2026-03-22 00:35:40 +00:00
Victor239
530b42b748 E-book viewer: survive Android app kills without losing annotations
- Request persistent IDB storage so Firefox Android never evicts origin data
- Persist pending annotation uploads to IDB so they survive page reloads
- Auto-retry upload on network recovery and on book open
- Fix SyncBook race: upload annotations and position before downloading
2026-03-21 22:39:50 +00:00
Kovid Goyal
2c9af589ed
Update Naked Capitalism 2026-03-21 17:25:54 +05:30
copilot-swe-agent[bot]
f23369204d
E-book viewer: Do not store searches performed via the --open-at command line flag in search history
Fixes #3056
2026-03-21 06:22:17 +05:30
Kovid Goyal
a18618015c
Bump preview version 2026-03-21 05:54:18 +05:30
copilot-swe-agent[bot]
fbb043698b
Fix FTS snippet highlight off-by-one: suppress colocated tokens in AUX mode
Fixes #3055
2026-03-21 05:50:41 +05:30
Kovid Goyal
6ae23bf06c
... 2026-03-21 05:03:48 +05:30
Kovid Goyal
d3e78c3fdd
Ignore shutdown error on re-render 2026-03-21 04:34:35 +05:30
Kovid Goyal
3e5e170156
Exit with exit code 0 when killed by hangcheck 2026-03-20 15:13:46 +05:30
Kovid Goyal
d81c6ed0cc
Make test a bit more robust
Use a fixed exit code to communicate parent process was killed
2026-03-20 15:09:12 +05:30
copilot-swe-agent[bot]
101f4c0e62
Make workaround_windows_shutdown_hang more robust against PID reuse
Use a process handle instead of PIDs

Fixes #3054
2026-03-20 15:02:56 +05:30
Kovid Goyal
500958021e
... 2026-03-20 14:05:51 +05:30
Kovid Goyal
d9bee21a51
Windows: Force kill calibre.exe on quit to workaround hang in interpreter shutdown on some systems 2026-03-20 14:03:28 +05:30
Kovid Goyal
6d02a8161a
FTS dialog: Allow sorting by any column 2026-03-20 12:36:17 +05:30
Kovid Goyal
62150573cb
Only show most pages sort option if page counting is enabled 2026-03-20 12:09:48 +05:30
copilot-swe-agent[bot]
efc3b650a5
Fix stale cards in FTS card view when a new search is conducted
Fixes #3053
2026-03-20 11:46:47 +05:30
Kovid Goyal
e6510a5388
Ignore CVEs in unreleased dependency versions 2026-03-20 11:40:55 +05:30
Kovid Goyal
e98d4bb409
... 2026-03-20 11:32:51 +05:30
Kovid Goyal
b1ee068587
Bump version for preview 2026-03-20 10:51:58 +05:30
Kovid Goyal
981f052894
... 2026-03-19 21:49:34 +05:30
Kovid Goyal
9ee89a25ec
Fix async worker on macOS 2026-03-19 21:48:32 +05:30
Kovid Goyal
ed7bc9a699
... 2026-03-19 21:07:34 +05:30
Kovid Goyal
a140e88a60
Finish the async worker implementation 2026-03-19 21:01:15 +05:30
Kovid Goyal
f6465046fe
More work on automate worker backend 2026-03-19 10:02:06 +05:30
copilot-swe-agent[bot]
ee6e7d8d71
TXT Output: Fix asciiize option not applying to generated inline TOC
Fixes #3051
2026-03-19 08:19:09 +05:30
Kovid Goyal
08801be3a9
Update Le Canard Enchaine 2026-03-19 08:09:06 +05:30
Kovid Goyal
e17d2c7449
L'Humanite by Kabonix 2026-03-19 08:05:42 +05:30
Kovid Goyal
3d863073e0
Fix #2144787 [Stabilize order of tag_browser_hidden_categories](https://bugs.launchpad.net/calibre/+bug/2144787) 2026-03-19 07:50:31 +05:30
Kovid Goyal
ecaad32bd4
Get the worker running in tty on Linux 2026-03-18 14:59:49 +05:30
Kovid Goyal
f9aa890fb8
Start work on new web scraper framework 2026-03-18 14:38:39 +05:30
copilot-swe-agent[bot]
40c8603c16
E-book viewer: Fix using the slower/faster buttons causing a chapter skip when using the Piper neural speech backend
Fixes #3050
2026-03-18 13:18:38 +05:30
Kovid Goyal
b49b0d3bc4
Update Le Monde 2026-03-18 08:36:02 +05:30
Kovid Goyal
1f76bb161c
Telerama by Kabonix 2026-03-18 08:32:15 +05:30
Kovid Goyal
049cdb9c61
Le Parisien by Kabonix 2026-03-18 08:29:20 +05:30
Kovid Goyal
130c9d2eca
Update Courrier International 2026-03-18 08:26:05 +05:30
Kovid Goyal
7005304d87
L'Equipe by Kabonix 2026-03-18 08:23:41 +05:30
copilot-swe-agent[bot]
992977b32c
Convert METH_VARARGS functions in speedup.c to METH_FASTCALL
Fixes #3048
2026-03-16 16:43:56 +05:30
copilot-swe-agent[bot]
b0abad9610
Convert METH_VARARGS functions in icu.c to METH_FASTCALL/METH_NOARGS
Fixes #3047
2026-03-16 14:37:51 +05:30
Kovid Goyal
8844a0aeef
... 2026-03-16 13:47:27 +05:30
Kovid Goyal
86e2403595
Cleanup copilot code 2026-03-16 13:41:59 +05:30
copilot-swe-agent[bot]
267a89a0dd
Implement word_prefix_find() in C in the icu.c module
Fixes #3046
2026-03-16 13:37:41 +05:30
Kovid Goyal
ed76e7ad7c
Further optimisation of word prefix matching 2026-03-16 12:57:12 +05:30