* 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
* 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>
* 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
* 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>
* 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
* 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>
* 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>
* 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>
* 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
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)
* 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
* 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>
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
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.