Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add POST method to /v1/library/<dummy> redirect route #3296

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

formed2forge
Copy link

@formed2forge formed2forge commented Jan 25, 2025

ANONYMIZED_KOBOPLUSPurchase-DefaultCWA-250219-1509h39.log
Adding POST method to /v1/library/ redirect implementation allows for syncing of notebooks on pen-enabled devices.

EDIT 1: Upon reverting the change, syncing of notebooks persists. I'm missing something...

EDIT 2: This change also fixes an issue where clicking "Read with Kobo Plus" silently fails to add a Kobo Plus book to a users account from the Kobo Store on device. (Device tested: Libra Colour). The following log is relevant to the error that lead me to open this PR.

Feb 19 15:09:44 nickel: (  1826.473 @ 0x2571038 / packetdump.debug) -------------------------- REQUEST --------------------------- 
Feb 19 15:09:44 nickel: (  1826.473 @ 0x2571038 / packetdump.debug) "POST" > To:  "https://CWDOMAIN.TLD/kobo/PERSONALAPI/v1/library/055ce5dd-9fe5-442e-a49b-8a754db0a6bf?BookSubId=416bfce4-e4ae-4730-8314-5857dece58a6" 
...
Feb 19 15:09:44 nickel: (  1826.474 @ 0x2571038 / packetdump.debug) 	---------------------- BODY --------------------------- 
Feb 19 15:09:44 nickel: (  1826.474 @ 0x2571038 / packetdump.debug) "" 
Feb 19 15:09:44 nickel: (  1826.474 @ 0x2571038 / packetdump.debug) -------------------------- END OF REQUEST --------------------------- 
Feb 19 15:09:44 nickel: (  1826.571 @ 0x2571038 / packetdump.warning) "https://CWDOMAIN.TLD/kobo/PERSONALAPI/v1/library/055ce5dd-9fe5-442e-a49b-8a754db0a6bf?BookSubId=416bfce4-e4ae-4730-8314-5857dece58a6" => "Error downloading https://CWDOMAIN.TLD/kobo/PERSONALAPI/v1/library/055ce5dd-9fe5-442e-a49b-8a754db0a6bf?BookSubId=416bfce4-e4ae-4730-8314-5857dece58a6 - server replied: METHOD NOT ALLOWED" 
Feb 19 15:09:44 nickel: (  1826.572 @ 0x2571038 / packetdump.warning) HTTP Status Code: 405 
Feb 19 15:09:44 nickel: (  1826.572 @ 0x2571038 / packetdump.warning) Error: 202

By adding the POST method to the /v1/library/ route, Calibre-Web correctly redirects the request generated by the "Read with Kobo Plus" button via the store on-device along with similar requests generated the addition of new notebooks.

…r syncing of notebooks on pen-enabled devices."

This reverts commit 166308a.
@vahtos
Copy link

vahtos commented Feb 12, 2025

@formed2forge I was going to submit this PR until I saw yours. I saw your edit here, have you tried creating a new notebook and syncing again? The POST might only be required on new notebook syncing/creation?

@formed2forge
Copy link
Author

@formed2forge I was going to submit this PR until I saw yours. I saw your edit here, have you tried creating a new notebook and syncing again? The POST might only be required on new notebook syncing/creation?

Creating a new notebook and syncing again continues to work on a device that is already synced from my initial tests.

My theory is that there is something that is getting communicated in the initial transfer of notebooks that allows for them to subsequently work with calibre-web's forwarding of requests. (This might be the one-time 'activation' that the software references when a compatible pen has been detected.) I'm in the midst of testing this and I have header and packet dumps to sift through to try to determine what's being sent and received and how so we can figure out how to direct/redirect the flow of traffic to allow for both the initial sync of notebooks to happen as well as the subsequent syncs.

…or syncing of notebooks on pen-enabled devices."

This reverts commit 4cbafc9.
@formed2forge formed2forge marked this pull request as ready for review February 19, 2025 19:33
@formed2forge formed2forge changed the title Fix for sync failure with pen-enabled devices. Adding POST method to /v1/library/<dummy> redirect fixes some notebook sync issues and "Read with Kobo Plus" button in Kobo Store. Feb 19, 2025
@formed2forge
Copy link
Author

@formed2forge I was going to submit this PR until I saw yours. I saw your edit here, have you tried creating a new notebook and syncing again? The POST might only be required on new notebook syncing/creation?

Looks like it's also used to apply Kobo Plus titles to user accounts. I've opened the PR back up because it appears to solve a couple of issues at this point.

@formed2forge formed2forge changed the title Adding POST method to /v1/library/<dummy> redirect fixes some notebook sync issues and "Read with Kobo Plus" button in Kobo Store. Add POST method to /v1/library/<dummy> redirect route Feb 19, 2025
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.

2 participants