janeczku / calibre-web

:books: Web app for browsing, reading and downloading eBooks stored in a Calibre database
GNU General Public License v3.0
12.88k stars 1.38k forks source link

[Enhancement] Allow guest to send ebook to Kindle #2614

Closed j00c3 closed 1 year ago

j00c3 commented 1 year ago

Is your feature request related to a problem? Please describe.

I cannot send ebooks to my Kindle while browsing the library as a guest.

I have Gmail oAuth set up correctly, and can send books to my Kindle via the "Send Epub to E-Reader" button when logged in as a user. However, when I am browsing the library anonymously as a guest, clicking the same button results in an HTTP 400 error.

Describe the solution you'd like

If this is intended, then I would like to request a feature when a guest browsing anonymously can send ebooks to a Kindle. I would like to open up my library to my family members without having to go through creating accounts for each person.

OzzieIsaacs commented 1 year ago

Could you please check if there is relevant output in the calibre-web log file? Please also try in debug mode

For normal email accounts the feature works (strangly). The guest user has ONE kindle email address configured, so all books are send to this email address, there is no option to choose individually where to send emails. As the guest user is not identified somehow (all settings are only stored in the session, meaning they get deleted on closing the browser) a user otherwise needs to enter his email address on every sending to a kindle (in this case a user account and a simple password would be much easier)

j00c3 commented 1 year ago

Your point about guest account having one email address is well taken. For some reason, the problem that would pose never crossed my mind. 😣

It turns out when I click "Send Epub to E-Reader" as a guest, there is an apparent error in the POST request. Specifically, it's missing a CSRF token. From calibre-web.log:

[2023-01-24 10:14:49,981] INFO {flask_wtf.csrf:263} The CSRF token is missing.

From the browser:

Screenshot 2023-01-24 at 22 15 21

POST request body contains empty CSRF value.

Screenshot 2023-01-24 at 22 27 00
OzzieIsaacs commented 1 year ago

I don't know what I did yesterday, I wasn't working. If you still need the feature, please update to the newest nightly version from now, and it should work now

j00c3 commented 1 year ago

Apologize for the late follow up, but the feature indeed seems to be working. Finally had a chance to pip upgrade to 0.6.20, and now I can send ebooks while browsing as guest!