Google jackets are not displayed in OPAC if site is configured to server HTTPS. It looks like the google-jackets.js file is hard coded to request the content via HTTP. Most browsers will block this mixed content. Changing the google-jackets.js to "https://books.google.com" resolves the problems - and displays the image correctly. Maybe we should pass another variable to GetCoverFromIsbn() specifying if we are using HTTPS or not?
Created attachment 40988 [details] [review] Change Google books URL from HTTP to HTTPS When Koha is using HTTPS the Google books (jackets) content isn't served up. The simplest solution is to change the URL to HTTPS as almost all clients will have access to the HTTPS resource. This bug changes the google-jacket.js file to use HTTPS. Test Plan: 1) Enable Google Jackets 2) Ensure the Koha OPAC instance is configued to use HTTPS 3) Confirm Google jackets display correctly.
Wouldn't it better to detect in JavaScript the protocol used to serve the page? using window.location.protocol.
Created attachment 47385 [details] [review] Checks current URL and connects to appropriate google resource This patch adds prefix variable to the google-jackets.js file. This detects the current URL prefix and uses that to connect to google to retrieve images. Test Plan: 1) Enable Google Jackets 2) Ensure the Koha OPAC instance is configued to use HTTPS 3) Confirm Google jackets display correctly.
Seems OK to me, except that you're creating a 'prefix' variable which pollutes the Javascript global namespace. Your variable name could potentially be used elsewhere by another JS portion of code. You should rather use directly location.protocol.
Created attachment 47500 [details] [review] Corrects problem with https sites accessing google jackets This patch adds prefix variable to the google-jackets.js file. This detects the current URL prefix and uses that to connect to google to retrieve images. Test Plan: 1) Enable Google Jackets 2) Ensure the Koha OPAC instance is configued to use HTTPS 3) Confirm Google jackets display correctly.
Created attachment 47501 [details] [review] Bug 14523 - Google jackets being blocked when OPAC using HTTPS Get the protocol of the current URL. This results is the correct prefix being used to serve the google jackets regarless of koha apache server setup. Signed-off-by: Frédéric Demians <f.demians@tamil.fr>
On bug 14571, we always use https for the amazon images, it would make sense to do the same here.
(In reply to Jonathan Druart from comment #7) > On bug 14571, we always use https for the amazon images, it would make sense > to do the same here. You're correct. If Google Books is requested exclusively in https, it works. If the OPAC is HTTP, there isn't 'mixed content' error. And if the OPAC is HTTPS, there isn't anymore 'mixed content' error since OPAC and Google Books are requested with https. Barry: would you mind modifying your patch to request Google Books in https, whatever the OPAC protocol? I can do it if you prefer.
My very first patch on this thread, 40988, did exactly that! Can that be re-used?
Created attachment 47511 [details] [review] Bug 14523 - Google jackets being blocked when OPAC using HTTPS This patch changes the Google jackets URL to use HTTPS instead of HTTP. Signed-off-by: Frédéric Demians <f.demians@tamil.fr>
(In reply to Barry Cannon from comment #9) > My very first patch on this thread, 40988, did exactly that! Can that be > re-used? Yes! Done.
Created attachment 47544 [details] [review] Bug 14523 - Google jackets being blocked when OPAC using HTTPS This patch changes the Google jackets URL to use HTTPS instead of HTTP. Test Plan: 1) Enable Google Jackets 2) Ensure the Koha OPAC instance is configued to use HTTPS 3) Confirm Google jackets display correctly. Signed-off-by: Frédéric Demians <f.demians@tamil.fr> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
*** Bug 13527 has been marked as a duplicate of this bug. ***
Pushed to master! Should be in Koha 3.24, thanks Barry!
How google-jackets.js can be used to fetch images in php