Skip to content

Sync with Upstream#7

Merged
Domoel merged 30 commits intoDomoel:mainfrom
crocodilestick:main
Nov 4, 2025
Merged

Sync with Upstream#7
Domoel merged 30 commits intoDomoel:mainfrom
crocodilestick:main

Conversation

@Domoel
Copy link
Owner

@Domoel Domoel commented Nov 4, 2025

No description provided.

angelicadvocate and others added 30 commits October 9, 2025 19:42
Amazon search for metadata has been returning HTTP 503. This appears to fix that
for `amazon.com`. Also makes some changes to the attributes searched for to
accommodate Amazon changes.

This may fix #701
Fix getting the rating, series info, identifiers, and high-res cover image.
Ignores some non-book and pre-order pages, resilient against pages with no rating yet, and do better getting the description.
Adds the rating field back to the metadata fetch UI, and allows setting the rating on the book edit screen. Rating is not shown in metadata entries if not fetched from the metadata source.
Google Books search has occasionally thrown an exception that "title" is not
a key in `result["volumeInfo"]`. It hasn't happened often, but this makes sure
the title is present before trying to use it.
Similar to ACSM support, a specific calibre extension is required for properly
supporting KFX and KFX-ZIP files.I've added the extensions to the various lists
of allowed extensions, and added their MIME types to the extra types map. This
enables importing KFX and KFX-ZIP files using both the automatic ingestion
process and manually uploading files.
Updates the build script to add CLI flags for a local build. This will
use the existing checked-out repo instead of cloning the repo fresh, for
building images for development and testing before code is ready to push
up.

Also adds CLI flags for the different things the script asks for, mostly
as a convenience for people like me who might just re-run the build with
some things always the same. I added flags for all of them, just seemed
silly to only cover some of them, and the default behavior is the same
as it is today.

Having flags for values let me shuffle some code around to better
reflect what's happening. If a user is provided, for example, there's no
point asking for it again or getting the default user.

And I added a .editorconfig file, to avoid whitespace-only changes. I
took a guess at line width values.
Fixed a couple issues with the local build mode:
- dirname was returning relative paths which broke when running the script from different locations. Now properly resolves to absolute path
- Added error handling for the cd command so it doesn't silently fail if something goes wrong

Also bumped Python line length in editorconfig from 88 to 120 since the existing codebase already has tons of lines over 88 chars anyway. Should cut down on unnecessary warnings.
- Add KFX MIME type registration to cps/__init__.py
- Include kfx/kfx-zip in ignorable_formats (cwa_functions.py)
- Add kfx support to convert_library.py
- Fix duplicate 'epub' entry in hierarchy_of_success
feat(import): Kfx format enable
- URL construction now handles both /path and path formats
- Uses lxml parser (faster) with html.parser fallback
- Added null checks for description DOM navigation
- Added info-level logging when no results found
- Series parsing uses regex pattern matching, handles variations
fix(amazon): Fix Amazon metadata search
Fix getting rating from Amazon.com
fix(google): Fix exception in Google metadata search
…r handling

- Client-side auto-resize to 200×200px using Canvas API with quality preservation
- File size validation (5MB max input, 500KB max output)
- Server-side MIME type and Base64 validation for security
- Comprehensive error handling for FileReader, image loading, and canvas operations
- Form validation: disabled submit until image processed and username entered
- Visual feedback: processing indicator, resize notifications, error messages
- Accessibility improvements: ARIA labels, descriptive help text, proper alt attributes
- Fixed typo: setprofile_picture → set_profile_picture in redirect URL
- Added base64 import to cwa_functions.py
Profile pictures: add live preview and auto Base64 handling
Fixes:
- Custom login button text now displays correctly on login page
- Scope format mismatch resolved (convert string to list for Flask-Dance)
- Admin role delegation now works for existing users, not just new ones

Improvements:
- Case-insensitive group matching (handles "Admin" vs "admin")
- Robust group format handling (list, string, comma/space-separated)
- Atomic transactions (role changes committed with OAuth entry)
- Better error handling and edge case coverage
- Scope parsing filters empty strings and handles whitespace

Files modified:
- cps/web.py: Pass login button text to template
- cps/templates/login.html: Display custom button text with fallback
- cps/oauth_bb.py: Fix scope format, add role sync for existing users

[dev] [bug] Testing OIDC with Authentik. Working - but strange issues...
Fixes #715
…g (Issue #715)

Critical Fixes:
- Remove incorrect token_url_params causing token exchange failures
- Keep OAuth scopes as normalized strings (not lists) for OAuth2Session
- Add compliance hook to handle scope order/format differences in responses
- Create GenericOIDCSession class for proper SSL verification across all requests

Error Handling:
- Catch InvalidGrantError and TokenExpiredError with user-friendly messages
- Add comprehensive exception handling in generic_logged_in callback
- Provide specific error feedback instead of generic 500 errors

Features:
- Custom login button text now displays correctly on login page
- Admin role delegation works for both new and existing users
- Case-insensitive group matching (handles "Admin" vs "admin")
- Robust group format handling (string/list/comma-separated)
- Atomic transaction commits for role updates

Files modified:
- cps/oauth_bb.py: Add GenericOIDCSession, fix scope handling, improve error handling
- cps/web.py: Pass login button text to template
- cps/templates/login.html: Display custom button text with fallback
…ault; decouple cover changes from uploads

cover_enforcer: fallback to safe title/author when metadata fields are empty to avoid ValueError
downloads: admin fallback in get_download_link to prevent false 404s on fresh instances; clearer missing-format logging
ingest/db: harden CalibreDB.reconnect_db to handle None engine so ingest-triggered session refresh works reliably
settings: set _Settings.config_uploading default to 1 (uploads enabled on new instances)
covers: allow cover URL/file updates for users with edit role regardless of global uploads toggle; keep format uploads gated by uploads+role
templates: update book_edit cover section gating to role_edit; format upload section unchanged (still gated by uploads setting)
- Hardened backup() destination lookup and mkdir; prevents crashes and logs issues instead
- Normalized file extension handling; corrected is_target_format logic
- Hardened audiobook ‘calibredb add’ argument construction; added proper identifiers flags and safe coalescing of metadata
…stable DB reads

Start container using only test override compose file; support CWA_TEST_IMAGE and CWA_TEST_PORT
Don’t guess startup time: readiness via HTTP (/, /login) or log signals (ingest watcher/metadata detector); print progress and actual startup duration
Add CWA_TEST_NO_TIMEOUT=true and CWA_TEST_START_TIMEOUT=N to control wait policy (default cap 600s)
Detect when bind mounts aren’t visible in the container and auto-switch to docker cp mode (AUTO_DOCKER_VOLUMES); set USE_DOCKER_VOLUMES=true for test branching compatibility
Introduce DockerPath and update volume_copy to use docker cp in auto mode; ingest_folder/library_folder return DockerPath when auto mode is active
Ensure consistent SQLite reads by copying metadata.db along with -wal/-shm sidecars in auto mode (fixes 0-row reads)
Add DockerPath.iterdir and .glob to support directory iteration/globbing in tests
On startup timeout, print docker compose ps + logs to aid debugging
Outcome: Tests run reliably in local, CI, and remote/DinD environments without arbitrary timeouts and with correct DB visibility.
@Domoel Domoel merged commit 7439cb0 into Domoel:main Nov 4, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants