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

Kobo reader browser not working #62

Closed
peroksid5 opened this issue Oct 2, 2023 · 14 comments
Closed

Kobo reader browser not working #62

peroksid5 opened this issue Oct 2, 2023 · 14 comments
Labels
e-readers About e-readers or client apps

Comments

@peroksid5
Copy link

peroksid5 commented Oct 2, 2023

Hi.

Since upgrading to this version of COPS, I cannot browse my library from my Kobo Libra H2O.

The Kobo is upgraded to the latest software, and I am using the latest version of Linuxserver's Docker container for COPS.

When trying to load the page, the browser shows the title of the page, but no content is rendered (I get a blank page). Opening the same page on a phone or desktop works flawlessly.

I've set my default template to default/kindle and deleted cookies on the Kobo to force the default view, but that doesn't help.

Has anyone managed to open the COPS website on a Kobo?

@dunxd
Copy link

dunxd commented Oct 2, 2023

Can you check to see if anything is rendered if you add checkconfig.php to the end of the URL in your Kobo browser this should show some diagnostic checks.

If the checkconfig page displays, what does it say under Check if the rendering will be done on client side or server side?

Please confirm if the page is completely blank - or if you are seeing the title text at the top of the page (as opposed to what might be displayed in the app title bar).

@peroksid5
Copy link
Author

peroksid5 commented Oct 2, 2023

I only see the library title on the app title bar, not on top of the actual page, which is completely blank. It's not scrollable and nothing is selectable, so it is empty, not just "white".

Rendering is done client side, according to the configuration check. checkconfig.php loads and renders without problems.

The rest of the configuration checks are ok for all libraries (I do use multiple libraries, is that perhaps a possible source of a problem?). I do see the footer credits of the kindle theme at the bottom of the checks, which don't show on the frontpage.

Edit: it's not a problem with multiple libraries, just checked now.

@dunxd
Copy link

dunxd commented Oct 2, 2023

Those credits are added by the CSS for the Kindle theme.

So we can see that PHP is working fine and at least the code for getting the theme from your cookie is also working.

Unfortunately I don't have a Kobo to check with - just a 10 year old Kindle Paperwhite. For me the container is working fine, but the Kindle is forced to use server side rendering.

As far as I know, the Kobo's worked with client side rendering fine, and I'd be surprised if that had changed. However, you could force server side rendering just to check - to do this add the following line to your config_local.php file:

$config['cops_server_side_render'] = ".";

This should take effect immediately - no need to restart the container or anything. The checkconfig.php page should show Server side rendering after making the change and refreshing the page.

If you do this does the home page of the library work?

@dunxd
Copy link

dunxd commented Oct 2, 2023

Just looking at the container - If you edit /config/config_local.php it does require restarting the container to take effect.

You can edit /app/www/public/config_local.php to get immediate effect.

@peroksid5
Copy link
Author

With server-side rendering it works, woohoo. :)
But I guess that doesn't explain why it stopped working with Kobos...

@dunxd
Copy link

dunxd commented Oct 2, 2023

Some recent code changes didn't work great with older browsers (those supporting ES5) so it could be that, in which case there may be a fix in the next release as we resolved some issues with Kindle which is really out of date! No guarantees, as I'm not exactly sure what your issue is caused by.

If you share your Kobo browser's user agent string I can let you know how to configure COPS to use server side with it in the meantime. Could you browse to https://whatmyuseragent.com/ with your Kobo browser and share what it shows here?

Or you could just run server side on every platform, which is what the config line I shared does. If you are running in a container that probably isn't the worst.

@peroksid5
Copy link
Author

peroksid5 commented Oct 2, 2023

No problem with running it server-side, it's for family use only.

User agent:
Mozilla/5.0(Linux; U; Android 2.0; en-us;)
AppleWebKit/538.1 (KHTML, like Gecko)
Version/4.0 Mobile Safari/538.1 (Kobo Touch 0384/4.38.21908)

@dunxd
Copy link

dunxd commented Oct 2, 2023

Thanks. The Kindle browser on my old Paperwhite reports AppleWebKit/531.2, so I expect the level of support for JavaScript is similar.

@mikespub maybe we should be checking for support for ES6 and above to enable client side rendering, rather than an increasingly complex preg of the user agent string. Maybe something like this: https://www.bram.us/2016/10/31/checking-if-a-browser-supports-es6/

@dunxd
Copy link

dunxd commented Oct 3, 2023

@peroksid5 if you update your config file to replace the line I gave you with this -it will force server-side rendering on your Kobo, and use client side elsewhere:

$config['cops_server_side_render'] = 'Kindle\/1\.0|Kindle\/2\.0|Kindle\/3\.0|EBRD1101|EBRD1201|cybook|Kobo';

Would appreciate if you could confirm this works.

Probably needs a little finesse since newer Kobo readers may support client side rendering and users might want it, but it should fix things for you without forcing everything server side.

@peroksid5
Copy link
Author

peroksid5 commented Oct 3, 2023

@dunxd It works. COPS now does server-side rendering on my Kobo and client-side on phone and computer.

Apropos Kobo versions: Kobos are (with the exception of the mini model, and even that one can be upgraded manually) all on the same software version - even the oldest models can be upgraded to the latest firmware, with just some specific features available only in newer models (and those can often be turned on for older ones too - it's super easy to access system files and configs, so you don't have to be an expert to "hack" it). So my guess would be none of them currently support client-side rendering with the latest COPS updates (but someone with a latest model can confirm/deny this probably, I'm on a Libra H2O).

@dunxd
Copy link

dunxd commented Oct 3, 2023

Thanks - that is super helpful. None of these browsers are particularly popular (in the grand scheme of the WWW) and not particularly well documented so your input is valuable.

@mikespub what do you think to keeping things simple and just adding "Kobo" to the default regex check for server side? I've spent a ton of time looking for a smarter method to detect what should be server side and it feels like less effort overall might be spent just adding device names to the regex as people report problems.

Update see PR #64

@mikespub
Copy link
Member

mikespub commented Oct 3, 2023

Thanks for picking this up @dunxd - I'm glad that @peroksid5 can at least continue working with the latest version for now...

PR #64 has been merged along with #61 but I haven't had the time to try it out myself - no Kobo, Kindle or other e-reader here except an Android tablet with recent Chrome version :-)

@mikespub mikespub added the e-readers About e-readers or client apps label Oct 3, 2023
@peroksid5
Copy link
Author

Thank you for the help @dunxd, this improves the WAF of my homelab by a lot. :)

@dunxd
Copy link

dunxd commented Oct 4, 2023

My pleasure. I've submitted a pull request to make Kobo default to server side, which should make it into the next release, which should in turn make it into the docker container version. At that point you can remove the custom setting if you want.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
e-readers About e-readers or client apps
Projects
None yet
Development

No branches or pull requests

3 participants