Commit Graph

40154 Commits

Author SHA1 Message Date
Kovid Goyal 44e40b34f5 Cleanup previous PR 2026-04-29 09:43:45 +05:30
Kovid Goyal 28f6558ad8 Merge branch 'auto-close-jobs' of https://github.com/un-pogaz/calibre 2026-04-29 09:18:50 +05:30
ishanray bf30123fb8 Fix viewer not updating dark/light mode on system theme change
When the system color scheme changes (e.g. light to dark), the viewer's
change_color_scheme handler updates opts.color_scheme but never updates
opts.is_dark_theme, which remains at its initialization value.

This causes set_color_scheme_class() to use a stale value, so the
calibre-viewer-dark-colors / calibre-viewer-light-colors class on body
never updates. When override_book_colors is set to 'dark', the CSS
override rule only matches when the dark class is present, so the book
content stays in the old theme.

Fix by updating opts.is_dark_theme from the incoming color scheme data
before calling apply_colors() and set_color_scheme_class().
2026-04-28 12:11:35 -04:00
un-pogaz 815fb4bc30 allow auto close when all jobs finished 2026-04-27 20:02:05 +02:00
copilot-swe-agent[bot] cf1073a2e7 Add reset zoom to 100% to preview pane right-click menu
Agent-Logs-Url: https://github.com/kovidgoyal/calibre/sessions/ce72136c-a4a4-4bc6-b03f-711888d9d266

Co-authored-by: kovidgoyal <1308621+kovidgoyal@users.noreply.github.com>
2026-04-27 00:52:29 +00:00
Kovid Goyal 388f978f7d Escape HTML in legacy details page 2026-04-23 17:12:10 +05:30
Kovid Goyal 091b409e3f ... 2026-04-23 09:31:54 +05:30
Kovid Goyal af8a6e142d Dont print useless tracebacks in functiondispatcher 2026-04-23 09:29:30 +05:30
Kovid Goyal 0e529de1b2 Cleanup previous PR 2026-04-21 20:34:26 +05:30
Kovid Goyal 7bf64008b1 Merge branch 'legacy-book-fix' of https://github.com/lgdeysel1980/calibre 2026-04-21 20:34:22 +05:30
Kovid Goyal 7b7a1c6b94 Cleanup previous PR 2026-04-21 19:25:50 +05:30
lgdeysel1980@gmail.com be839bf8ca Fix legacy book details endpoint routing and rendering; improve mobile styling 2026-04-21 13:55:52 +02:00
ECB b0c4ba1968 Fix security vulnerabilities and code quality issues
High severity:
- Fix typo normapth -> normpath in srv/content.py (broken endpoint)
- Replace eval() with ast.literal_eval() in catalogs/epub_mobi.py
- Log exceptions in FunctionDispatcher.dispatch instead of swallowing

Medium severity:
- Add path traversal protection to DirContainer read/write/exists
- Fix XPath injection in comments_editor.py merge_contiguous_links
- Use parameterized SQL queries in database2.py library_id setter
- Add safety comment to pickle_loads in utils/serialize.py
2026-04-21 12:48:42 +02:00
Kovid Goyal 9fba48765a Remove some eval() calls
They are perfectly harmless but I dont want to have to deal with endless
cargo cult security advisories about them.
2026-04-19 12:03:52 +05:30
un-pogaz ad798fc988 DRY 2026-04-17 11:29:52 +02:00
Kovid Goyal 771315bb3e Fix multiprocessing forkserver not working with python 3.14.4
Because of this: https://github.com/python/cpython/pull/148195
2026-04-17 13:48:56 +05:30
Kovid Goyal cfb2e7566e pep8 2026-04-17 09:44:11 +05:30
Kovid Goyal 073f67522a Merge branch 'codex/add-openai-compatible-provider' of https://github.com/lazydao/calibre 2026-04-17 09:43:29 +05:30
Kovid Goyal 0b91aa8354 ... 2026-04-17 09:41:29 +05:30
Kovid Goyal 5379b5bb62 Cleanup previous PR 2026-04-17 09:19:28 +05:30
Kovid Goyal ad1da12068 Merge branch 'codex/throttle-ai-chat-streaming' of https://github.com/lazydao/calibre 2026-04-17 09:15:30 +05:30
Kovid Goyal ab24d2e152 Native TTS engine: Normalize text to NFKC so that word tracking works when the native engine reports spoken word with different normal form 2026-04-17 08:51:55 +05:30
Kovid Goyal 1a87b70c12 When converting GIF images to PNG workaround bug in PIL causing exception when checking if the GIF is animated. Fixes #2148533 [Failure converting MOBI file to EPUB](https://bugs.launchpad.net/calibre/+bug/2148533) 2026-04-16 13:15:01 +05:30
Kovid Goyal d5c887d569 Use paths for another instance of safe_replace 2026-04-15 04:53:42 +05:30
copilot-swe-agent[bot] dede73a0cc Add tests for safe_replace() in zipfile.py and register in run_tests.py
Agent-Logs-Url: https://github.com/kovidgoyal/calibre/sessions/ae87adbf-5df0-4d0c-aeb2-27cb25a97469

Co-authored-by: kovidgoyal <1308621+kovidgoyal@users.noreply.github.com>
2026-04-14 15:04:31 +00:00
Kovid Goyal c5639d4428 Use atomic replace when updating epub files 2026-04-14 20:26:28 +05:30
un-pogaz 51b4739aca clean "running from source" try catch 2026-04-14 10:20:09 +02:00
lazydao b462171750 move AI chat disclaimer out of scroll area 2026-04-14 15:20:55 +08:00
lazydao a40a29936f add streaming render demo for AI chat 2026-04-14 14:40:49 +08:00
lazydao f84f3ca7ba add OpenAI-compatible AI provider 2026-04-14 10:24:18 +08:00
lazydao 04bcc7e7c3 throttle AI chat streaming re-renders 2026-04-14 10:23:04 +08:00
Kovid Goyal 4c1041b23f Preserve existing conversation with AI when there is an error talking to it. Fixes #3085 (Preserve AI chat history when a follow-up request fails) 2026-04-13 20:02:21 +05:30
Kovid Goyal 1914d15fd3 Make clearing conversation optional when showing a message 2026-04-13 19:56:23 +05:30
Kovid Goyal e5e9ad4055 Remove unused code 2026-04-13 19:54:53 +05:30
Kovid Goyal 0d64020b05 Ignore AppleDouble files when looking for missing formats 2026-04-11 09:41:26 +05:30
Kovid Goyal e3c6aef3dd version 9.7.0 2026-04-10 08:08:46 +05:30
copilot-swe-agent[bot] 72f403d52a Fix regression: EPUB annotations not saved due to immediate queue shutdown
Agent-Logs-Url: https://github.com/kovidgoyal/calibre/sessions/171c5cc8-db33-468a-9656-d88b8b95ff40

Co-authored-by: kovidgoyal <1308621+kovidgoyal@users.noreply.github.com>
2026-04-08 13:39:27 +00:00
Kovid Goyal fa2cce533d pep8 2026-04-08 08:26:33 +05:30
Kovid Goyal 089dad329a AI: Make the GitHub backend a bit more robust
Fixes #2147495 [Github backend errors silently](https://bugs.launchpad.net/calibre/+bug/2147495)
2026-04-08 08:25:53 +05:30
Kovid Goyal 4242c5c30b Viewer: have the native pinch act exactly the touch screen pinch
Now only on completing the gesture does the font size change.
2026-04-07 19:28:38 +05:30
Kovid Goyal 3013076808 E-book viewer: Handle native pinch to zoom gesture to change font size and persist the changes using the same mechanism as regular font size adjustment 2026-04-07 15:37:30 +05:30
Kovid Goyal 9f0bf3a685 Remove unused code 2026-04-07 14:43:33 +05:30
Kovid Goyal 24a7abd0af Be a bit more robust against external software corrupting calnotes 2026-04-07 07:07:00 +05:30
adar2378 927744673e Fix ValueError in remove_namespaces when tag name contains colon
When an EPUB contains elements with custom namespace prefixes (e.g.
<vita:metadata>), the remove_namespaces method in the KF8 writer
crashes with `ValueError: Invalid tag name 'vita:'`.

The existing except ValueError block only strips colons from attribute
names but does not handle the tag name itself. This causes the second
makeelement call to raise the same ValueError.

Fix: replace colons with hyphens in the tag name before retrying,
consistent with how colon-containing attributes are already handled.
2026-04-05 22:31:26 +06:00
Kovid Goyal ee3166cc5b Fix status tip for context menus not working 2026-04-05 10:26:28 +05:30
Kovid Goyal 89b907546f clone action should also copy status tip 2026-04-05 10:14:13 +05:30
Kovid Goyal f8df3d90db Add status tips to copy to library actions 2026-04-05 10:01:18 +05:30
Kovid Goyal bd4d9390bc Content server: Fix regression causing error during searching. Fixes #2147261 [Search fucntion in calibre server 9.6.0 (search in epub-File) fails, works in 9.3.0](https://bugs.launchpad.net/calibre/+bug/2147261) 2026-04-05 09:40:56 +05:30
ktetzlaff e0324c7ae8 Fix opening a book from the FTS search result dialog
Since version 9.6.0, pressing `v` in the FTS search result pane results in
the following error:

```
Traceback (most recent call last):
  File "/usr/lib/calibre/calibre/gui2/fts/dialog.py", line 32, in view_current_book
    if not self.results_panel.view_current_result():
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/usr/lib/calibre/calibre/gui2/fts/search.py", line 1062, in view_current_result
    open_book(results, match)
    ~~~~~~~~~^^^^^^^^^^^^^^^^
  File "/usr/lib/calibre/calibre/gui2/fts/search.py", line 115, in open_book
    result_dict = results.result_dicts[match_index]
                  ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^
TypeError: list indices must be integers or slices, not dict
```

I traced this back to commit b10e56d9e5 (Refactor FTS dialog to allow multiple
result visualisations) which refactored `ResultsView.view_current_result` in
`src/calibre/gui2/fts/search.py` from:

``` python
    def view_current_result(self):
        idx = self.currentIndex()
        if idx.isValid():
            results, match = self.m.data_for_index(idx)
            if results:
                if match is not None:
                    match = idx.row()
                open_book(results, match)
                return True
        return False
```

to `ResultsPanel.view_current_result`:

``` python
    def view_current_result(self):
        results, match = self.current_view.current_result()
        if results:
            open_book(results, match)
            return True
        return False
```

and `SplitView.current_result`:

``` python
    def current_result(self):
        idx = self.results_view.currentIndex()
        if idx.isValid():
            results, match = self.results_view.model().data_for_index(idx)
            if match is None:
                match = idx.row()
            return results, match
        return None, None
```

As can be seen in the latter, the condition in the original
`ResultsView.view_current_result`:

``` python
           if match is not None:
                match = idx.row()
```

has changed to:

``` python
           if match is None:
                match = idx.row()
```

in `SplitView.current_result` which is causing the error.

This bug is fixed in the current commit.
2026-04-04 13:55:22 +02:00
Kovid Goyal cef0b976a1 Annots browser: Fix searching with restriction to type of annotation not working 2026-04-04 09:15:26 +05:30