Commit Graph
485 Commits
Author SHA1 Message Date
Balázs Szücs cea977062a fix(epub): improve date parsing to support year-only formats and add tests (#1735)
Signed-off-by: Balázs Szücs <bszucs1209@gmail.com>
2025-12-02 16:44:19 -07:00
WorldTeacherandWorldTeacher 8e8d57af73 opds sort by addedon Desc by default (#1691)
Co-authored-by: WorldTeacher <admin@theprivateserver.de>
2025-12-02 11:20:40 -07:00
Balázs Szücs ff2654db1b feat(metadata): consider locked, but empty or null metadata valid (#1729)
Signed-off-by: Balázs Szücs <bszucs1209@gmail.com>
2025-12-02 10:13:55 -07:00
Sergio Visinoni d40a650df7 Fix race conditions between Bookdrop and Monitoring Service when importing multiple files (#1709)
* fix(bookdrop): gate library re-registration during single-file moves

- query MonitoringService to see if the library is actively watched before
  unregistering/re-registering it
- lower log noise for these operations and monitoring registration
- expose MonitoringService#isLibraryMonitored via MonitoringRegistrationService
- add FileMoveServiceTest covering monitored vs unmonitored scenarios

This fixes issues when importing multiple files via bookdrop.

Refs: #1608

* fix(bookdrop): avoid unnecessary stacktrace

* Use `deleteIfExists` to avoid trying to delete a missing file

This happens regularly as the file has already been removed by other methods
2025-12-02 10:06:59 -07:00
beedaddy a179749c93 Re-add "description" to epub metadata extraction (#1727)
A former commit accidentially removed the description field from the metadata extraction.

Fixes #1725
2025-12-02 08:07:09 -07:00
Aditya Chandel ff17b74adb Downgrade Java, Spring Boot and Gradle (#1696)
* Revert Spring Boot 4

* Downgrade Java from 25 to 21 and Gradle from 9 to 8
2025-11-30 16:39:56 -07:00
aditya.chandel bdeeee6d8d Fix missing import 2025-11-30 09:55:11 -07:00
CounterClopsandAditya Chandel dfb73d50d9 Feature: Add EPUB conversion support for CBX files to Kobo Sync (#1538)
* Feature/kobo sync cbx support (#3)

* Feature: Add CBX syncing support to Kobo sync (#2)

* feat: add cbx sync support

* fix: phrasing of setting description to align with CBX terminology

* fix: resolve issue with CBX setting persistence

* fix: updated dev docker compose to align with Dockerfile

* feat: add cbx files as allowed entitlements

* fix: relax tomcat query characters for kobo sync

* fix: remove hardcoded epub restrictions

* fix: reduce image size and resolve relative content paths

* fix: resolve issues with the image file encoding

* feat: add rar and cb7 support

* feat: bring generated epub more in line with epub standard

* fix: resolve issues with extra metadata fields

* fix: make css background colour white to improve e-ink performance

* cleanup: code comments

* feat: add cbx unit tests

* fix: update zipfile to use builder pattern as current method is deprecated

* fix: remove comments

* fix: replace regex pattern to a simpler check

* fix: remove unused imports

* fix: update epub template to use standard language string

* fix: missing line end on css

* fix: remove duplicate query characters

* fix: grammer issue

* fix: resolve typo in the entitlement service test

* fix: redundant imports and update long types

* chore: update test descriptions for cbx conversion

* fix: add check for larger images in archive files. unlikely to occur.

* fix: merge temp dir logic for the book download

* fix: update kobo entitlement to always report the format as epub3

* fix: implement suggested changes around javadocs and some edge cases to handle gracefully

* chore: cleanup variable names to be clearer in download service

* feat: change function to extract to disk instead of storing images in memory

* fix: add temp file clean up into the conversion service

* fix: add visual divider to seperate CBX and EPUB settings

* fix: update lambdas to use method references

* fix: reword setting description for cbx to epub sync

---------

Co-authored-by: Aditya Chandel <8075870+adityachandelgit@users.noreply.github.com>
2025-11-30 09:53:26 -07:00
aditya.chandel e47046aa20 Fix flyway versioning 2025-11-30 09:49:20 -07:00
CounterClops 3ef5b60ed6 Feat: Improve kobo reading state sync logic for better bidirectional support (#1644)
* feat: kobo sync improvements (push changes from booklore, and properly delete kobo data on reset)

* fix: issues with sync race conditions and improve readability

* fix: update function names to be clearer and more explicit

* fix: move partially_read to reading status mapping

* fix: make the bufferwindow more explicit in the unsynced progress check

* chore: add unit tests for additional sync logic

* fix: improve bi-directional logic to account for changes in progress and status

* chore: add additional tests to check the kobo sync logic and remove redundant tests
2025-11-30 09:44:11 -07:00
Balázs Szücs 2336d04a46 refactor(exception): modernize exception handling and method signatures across services and controllers (#1670)
* refactor(exception): modernize exception handling and method signatures across services and controllers

- Remove unnecessary checked exceptions from method signatures
- Replace IOException with UncheckedIOException where appropriate
- Update test methods to match new signatures and remove throws declarations
- Improve converter classes with type safety, logging, and null handling
- Simplify collection assignment logic in metadata and book services
- Enhance author and category tokenization in HardcoverParser
- Add equals/hashCode to ShelfEntity for proper set behavior
- Add comprehensive unit tests for converter and service classes

Signed-off-by: Balázs Szücs <bszucs1209@gmail.com>

* refactor(entity): update equality and hashCode for JPA entities to use ID; add comprehensive tests and adjust test data to set IDs

Signed-off-by: Balázs Szücs <bszucs1209@gmail.com>

---------

Signed-off-by: Balázs Szücs <bszucs1209@gmail.com>
2025-11-30 09:41:15 -07:00
Balázs Szücs 965aa9dfab Improve image resource management by ensuring BufferedImage objects are flushed after processing; add tests for cover extraction and image scaling (#1688)
Signed-off-by: Balázs Szücs <bszucs1209@gmail.com>
2025-11-30 08:17:44 -07:00
Balázs Szücs 348e8e9022 fix(pdf): handle out-of-memory errors gracefully during cover generation and limit image size to prevent OOM (#1680)
* fix(pdf): handle out-of-memory errors gracefully during cover generation and limit image size to prevent OOM

Signed-off-by: Balázs Szücs <bszucs1209@gmail.com>

* fix(file): release native resources after saving image to prevent memory leaks

Signed-off-by: Balázs Szücs <bszucs1209@gmail.com>

---------

Signed-off-by: Balázs Szücs <bszucs1209@gmail.com>
2025-11-29 17:00:43 -07:00
beedaddy 357c98b8ce Add actual language to Kobo metadata (#1682)
Fixes #1681
2025-11-29 16:59:17 -07:00
Aditya Chandel 2145683ce0 Expose Magic Shelves through the OPDS feed so clients can access them (#1683) 2025-11-29 16:58:31 -07:00
Aditya Chandel 806ffe22b4 Enable navigation by library, year, language, file type, and read status in metadata viewer (#1672) 2025-11-28 18:22:37 -07:00
Aditya Chandel 81c4424ae6 Fix issue with “unset” read status handling (#1669) 2025-11-28 15:05:23 -07:00
Aditya Chandel 3a9cb965e3 Fix unique file constraint to allow identical filenames in different sub-paths (#1668)
* Upgrade Spring Boot to version 4.0.0

* Fix flyway config

* Fix unique file constraint to allow identical filenames in different sub-paths
2025-11-28 14:10:51 -07:00
Aditya Chandel d647fe401e Upgrade Spring Boot to version 4.0.0 (#1667)
* Upgrade Spring Boot to version 4.0.0

* Fix flyway config
2025-11-28 14:10:14 -07:00
Aditya Chandel 46225a3c0e Upgrade Spring Boot to version 4.0.0 (#1666) 2025-11-28 13:35:40 -07:00
Balázs Szücs 71f02c3238 feat(tests-util): Add comprehensive test coverage for FileService and MetadataChangeDetector (#1658) 2025-11-28 09:35:14 -07:00
Balázs Szücs 900cd0a884 fix(file): truncate long path components and author lists to prevent filesystem errors (#1655) 2025-11-28 09:34:02 -07:00
Balázs Szücs d2c6e535e2 fix(bookdrop): Ensure source file is only deleted after successful import and cleanup target on failure (#1638)
* fix(bookdrop): improve error handling and cleanup for file move failures

- Ensure target file is deleted if processing or metadata refresh fails after move
- Only delete source file on successful processing
- Add tests to verify file cleanup and source preservation on failure scenarios
- Use lenient mocking for Files in tests to support error simulation

* fix(bookdrop): enhance file and cover cleanup logic, improve test coverage for import finalization

* test(bookdrop): improve finalize import test with LibraryPathRepository mock and enhanced stubbing
2025-11-27 06:48:17 -07:00
Balázs Szücs ff052c2fed feat(api): add @Builder.Default to entity fields for safer builder initialization and update mappers to ignore unmapped targets; add tests for builder defaults (#1634)
* feat(api): add @Builder.Default to entity fields for safer builder initialization and update mappers to ignore unmapped targets; add tests for builder defaults

Signed-off-by: Balázs Szücs <bszucs1209@gmail.com>

* test: set isDefaultPassword in test user builder for KoboReadingStateServiceTest

Signed-off-by: Balázs Szücs <bszucs1209@gmail.com>

* test: verify isDefaultPassword is false in BookLoreUserEntityTest

Signed-off-by: Balázs Szücs <bszucs1209@gmail.com>

---------

Signed-off-by: Balázs Szücs <bszucs1209@gmail.com>
2025-11-27 06:46:52 -07:00
beedaddy 47f75c2b9a Add option to force hyphenation in KEPUB (#1656)
* Add option to force hyphenation in KEPUB

Fixes #1465

* Default force hyphenation to false

* Remove commented out code
2025-11-27 06:45:47 -07:00
aditya.chandel aa07f5ee74 Add rollback logic to restore deleted files when move fails 2025-11-25 05:30:12 -07:00
Aditya Chandel 415207d91d Allow duplicate files both within the same library and across different libraries (#1632) 2025-11-25 04:38:18 -07:00
Aditya Chandel b3ae93fc6b Fix: correctly assign main title and subtitle from <dc:title> elements (#1626) 2025-11-24 21:28:07 -07:00
Aditya Chandel 03ad0ca309 Fix Auto Fetch ignoring disabled metadata providers and attempting retrieval from all sources (#1624) 2025-11-24 20:55:52 -07:00
Aditya Chandel 4d9362a1b4 Add a shelf creation button to the left menu bar and improve the layout of the shelf creation page (#1617) 2025-11-24 08:42:07 -07:00
CounterClops 1dbf214199 fix: kobo sync only update finished date when one doesn't already exist (#1614)
* fix: only update finished date on kobo sync when an existing date doesn't exist

* chore: add unit tests to confirm this is the case
2025-11-24 07:26:21 -07:00
Balázs Szücs a0a08080ed fix(metadata-updater): fix partial metadata save on Bookdrop (#1611)
* fix(metadata-refresh): change replace mode to REPLACE_ALL when editing metadata

Signed-off-by: Balázs Szücs <bszucs1209@gmail.com>

* fix(metadata-refresh): update metadata update method to support customizable replace mode

Signed-off-by: Balázs Szücs <bszucs1209@gmail.com>

* fix(metadata-refresh): refactor updateBookMetadata to use MetadataUpdateContext for improved clarity and flexibility

Signed-off-by: Balázs Szücs <bszucs1209@gmail.com>

---------

Signed-off-by: Balázs Szücs <bszucs1209@gmail.com>
2025-11-24 07:25:24 -07:00
Balázs SzücsandAditya Chandel c1e662bde9 refactor(utils): convert utilities to @UtilityClass and add tests (#1609)
Signed-off-by: Balázs Szücs <bszucs1209@gmail.com>
Co-authored-by: Aditya Chandel <8075870+adityachandelgit@users.noreply.github.com>
2025-11-24 07:23:06 -07:00
Balázs SzücsandAditya Chandel 3f3b72248a refactor: use try-with-resources for better resource management in file processing (#1607)
Signed-off-by: Balázs Szücs <bszucs1209@gmail.com>
Co-authored-by: Aditya Chandel <8075870+adityachandelgit@users.noreply.github.com>
2025-11-24 07:20:45 -07:00
Balázs Szücs 746e94983b feat(file-service): implement image downloading using RestTemplate with better headers and error handling (#1605)
* feat(file-service): implement image downloading using RestTemplate with better headers and error handling

Signed-off-by: Balázs Szücs <bszucs1209@gmail.com>

* feat(config): enhance RestTemplate with custom connection and read timeouts

Signed-off-by: Balázs Szücs <bszucs1209@gmail.com>

---------

Signed-off-by: Balázs Szücs <bszucs1209@gmail.com>
2025-11-24 07:18:26 -07:00
Balázs Szücs dddc6d4acf fix(metadata): fallback to filename for title extraction in PDF and EPUB metadata (#1603)
Signed-off-by: Balázs Szücs <bszucs1209@gmail.com>
2025-11-24 07:17:23 -07:00
Aditya Chandel 0190ba8677 Fix: cannot change lower and upper case letters in metadata (#1602) 2025-11-21 10:30:29 -07:00
aditya.chandel a0dcfe68c2 Resolve Flyway migration version conflict 2025-11-21 00:43:22 -07:00
aditya.chandel 8f811bb82d Fixes are PR merges 2025-11-21 00:42:02 -07:00
Chris Debenham 5b6c0b54a0 Fix file moving - fixes issue #1521 (#1582)
* Fix file moving - fixes issue #1521

* Fix metadata writing to file

Fixes bug #1572
2025-11-21 00:18:56 -07:00
CounterClops 7ebdc7b106 Feature: Sync reading progress from Kobo in-built reader (#1541)
* feat: add kobo reading progress sync

* fix: remove old variable references

* fix: avoid changing koreader behaviour

* fix: resolve typo in koreader progress

* fix: remove link between booklore progress and kobo sync progress

* feat: add unit tests for kobo reading status sync

* fix: remove unnecessary conversion value for kobo progress

* fix: resolve issue with kobo_progress beiong optional in template

* fix: update entitlement to provide existing reading progress back to kobo on sync

* fix: use stored bookmark before creating new bookmark

* fix: update default thresholds to full numbers. kobo doesn't report progress with any decimal places

* chore: update unit tests

* fix: remove decimal places in kobo settings progress threshold
2025-11-21 00:17:57 -07:00
Chris Debenham 79ab4ec5a1 Add ability to mark magic shelves as public (#1489)
Adds a checkbox to the create/edit magic shelf dialog to set the shelf
as public.
If public then it shows up for all users.
Only admins can edit public shelves (edit options disabled for
non-admin)
2025-11-20 21:17:10 -07:00
Yann 27033560c0 feat: add language restriction option for google parser and improve search metadata by title/author query (#1502)
* feat: add language restriction option for google parser and improve search metadata by title/author query

* Fix syntax error.
2025-11-20 21:14:12 -07:00
astrodad 3a8a46b3cc Added timestamp from koreader_last_sync_time to returned json on GET for KOReader Sync API (#1518) 2025-11-20 21:12:33 -07:00
beedaddy 278b11e9e1 Enhancement: Import custom pagecount field from calibre (#1486)
* Enhancement: Import custom pagecount field from calibre

Calibre exports custom columns as JSON strings. This PR parses this JSON data and adds the pagecount value to booklore.
By convention, the calibre column must be named "pagecount".

* Don't use another external library for JSON
2025-11-20 21:10:29 -07:00
Balázs Szücs 5c42e2e765 refactor(api, test): improve readability and code quality across services, and tests (#1494)
* refactor(tests): improve readability and consistency across services

- Replace field declarations with local variables in test setup methods to simplify code.
- Introduce constants for patterns and update regex logic in `BookMediaController`.
- Improve assertions and use more precise methods like `getFirst()` in tests.
- Utilize `EnumMap` and `EnumSet` for better performance and memory efficiency in metadata logic.
- Concatenate XML strings using multi-line strings or simplify where applicable.
- Deprecate and refactor user provisioning to ensure consistency and reuse of logic.
- Add additional parameters such as `watch` in `Library` entities and set defaults in builders.
- Replace manual comparator logic with core library features like `Comparator.reverseOrder`.
- Update metadata merging methods to use `getFirst()` for target values.
- Adjust mocked objects to include additional fields in validation methods.

Signed-off-by: Balázs Szücs <bszucs1209@gmail.com>

* refactor(service): remove deprecated user provisioning method

- Remove `provisionRemoteUser` method marked as deprecated in `UserProvisioningService`.
- Encourage use of `provisionRemoteUserFromHeaders` as the preferred entry point.

Signed-off-by: Balázs Szücs <bszucs1209@gmail.com>

---------

Signed-off-by: Balázs Szücs <bszucs1209@gmail.com>
2025-11-20 21:09:39 -07:00
Subhashini Ganesh cb8f5e7a29 Fix: Normalize paths for relative sub-path calculation (#1501)
Fixes a bug preventing import of books with duplicate filenames in
different sub-folders.

The path relativization in FileUtils.getRelativeSubPath would fail in
some cases, yielding an empty sub-path. This caused a database
unique index violation as only the filename was saved as the filePath.

This commit fixes the issue by normalizing both paths before
relativization. Adds FileUtilsTest.java to validate the fix.

Fixes #1499
2025-11-20 21:08:39 -07:00
beedaddy 14692b0176 Fix: Detect ISBN even if "scheme" is empty. (#1484)
This is often the case if book comes from calibre.

Fixes #1483
2025-10-31 01:23:06 -06:00
vhqkze d2db787867 fix: improve KOReader compatibility with Content-Disposition filename encoding (#1475)
Adjust the encoding of the `filename` attribute within the
`Content-Disposition` header to ensure better compatibility with
KOReader.

Previously, `Content-Disposition` was constructed using Spring's
`ContentDisposition.builder()`, which KOReader could not properly get
the correct filename.

This update modifies the `filename` attribute to replace non-ASCII
characters with underscores, providing a more robust fallback filename
that KOReader can correctly process. It also maintains the `filename*`
attribute for UTF-8 encoded filenames, allowing modern clients to
display the full filename.
2025-10-31 01:21:32 -06:00
Balázs Szücs a5183c0953 refactor(api): refactor obsolete APIs including: (#1467)
- obsolete Date APIs
- obsolete Zipfile from Apache Commons Compress Updates
- JWT related obsolete APIs
- deprecated Junrar method
etc...

Signed-off-by: Balázs Szücs <bszucs1209@gmail.com>
2025-10-31 01:20:38 -06:00