janeczku / calibre-web

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

Add Kindle-friendly browser interface #3008

Open carderne opened 4 months ago

carderne commented 4 months ago

Relevant issues

Background

It would be great to be able to use calibre-web from a Kindle and directly download books. My current flow is to use calibre-web to manage/explore books, and then a separate process to get the book onto the Kindle.

Description

This PR adds two new routes:

They have no CSS or JavaScript and very basic structure. This is aimed at creating a page that the Kindle web browser can easily handle.

The only features that are maintained:

Comments

I went as basic as possible to create a small diff, demonstrate the purpose, and create a tiny maintenance surface area if this gets merged.

Some functionality could be added back, but it's a trade-off with the limited browser. Search, select and download is all I need, but others may have different requirements.

Obviously happy to implement this in a different way if you think preferable!

Screenshots

Search page, after searching

home-screenshot

Book detail page

detail-screenshot

carderne commented 4 months ago

If anyone wants to try this out with Docker, I've made a custom Docker image carderne/calibre-web based on the linuxserver one but with this modification.

The only difference is these two extra pages /basic and /basic_book. If this change doesn't fit with the main calibre-web project, I'll try to periodically keep the fork up-to-date with upstream, which should be quite straight-forward.

janeczku I've read your README update so I won't expect a prompt response. Let me know if the naming of the forked Docker image or anything else rankles and I'll be happy to change it.

carderne commented 4 months ago

(Could also do this with by detecting the Kindle User-Agent, but that would involve changing the main routes, so I've left it with this light-touch method for now...)

carderne commented 3 months ago

Have updated my fork a bit:

  1. Improved CSS
  2. Added images
  3. Added pagination and a home button
jamescochran commented 3 months ago

This is great! Exactly what I was looking for. The search box is a bit wonky as well as logout appears under home but I assume it should be on the far right. But all in all it does what I was looking for and that was to grab a book from my Calibre library through the Kindle browser.

carderne commented 3 months ago

@jamescochran I had only tested on the latest Kindle Paperwhite, just used an older one and realised it doesn't support flexbox...

Have updated my fork to only use old-school CSS, please try again! (The Docker image is now carderne/calibre-web:0.6.21-3 if that's what you're using.)

DavidGriswoldTeacher commented 3 months ago

Very nice! I like it a lot.

As a Kobo user who prefers this simple system over the more complex kobo syncing, I might at some point fork this myself and try to figure out how to add a link that will download epub in kepub format. I think the logic on this would be...

  1. If the kepub is there, just include its link as normal, but with the logic necessary to convert the download link from .kepub to .kepub.epub (a requirement for the kobo browser to download it). This is a bit broken on the main code right now.

  2. If the .kepub is NOT there, include a link that will convert the epub to kepub using kepubify, then download the .kepub.epub file

this is not a feature request, just thinking "aloud"!

pnatel commented 2 months ago

Same as @jamescochran with the only difference being that I don't have the login/logout option. I think it may be because I have the anonymous login enabled. I also have some screenshots for reference in https://github.com/janeczku/calibre-web/issues/2723#issuecomment-2038092040

pnatel commented 2 months ago

quick update, just installed carderne/calibre-web:0.6.21-3 and the search button is in the proper place.

The size of the search elements looks off, but I guess that this is caused by the way the Kindle browser renders that type of object, or it is getting that from the main site.

carderne commented 2 months ago

@pnatel can you share a photo of what you mean about "the search elements look off"? Maybe I can fix that.

jamescochran commented 2 months ago

Kindle Oasis 3 20240405_083509

carderne commented 2 months ago

Oh damn ok I tested with an old-style Paperwhite and the new Paperwhite, but that's a third target. Not sure how I'll fix that without an Oasis to hand. Any chance you'd be able to run calibre-web locally and fiddle with the CSS?

The <nav> has a fixed height: 50px set, but Kindle's seem to treat px in mysterious ways... It might be as simple as setting it to 3rem or something like that. Alternatively, set a height on the <input element as well maybe...

pnatel commented 2 months ago

Created a pull request to your repo with small changes: https://github.com/carderne/calibre-web/pull/1