mikespub-org / seblucas-cops

Calibre OPDS (and HTML) PHP Server : web-based light alternative to Calibre content server / Calibre2OPDS to serve ebooks (epub, mobi, pdf, ...)
http://blog.slucas.fr/en/oss/calibre-opds-php-server
GNU General Public License v2.0
55 stars 7 forks source link

Problems with "Full URL prefix" #75

Closed marioscube closed 4 months ago

marioscube commented 4 months ago

Used to work with:

Now only http://192.168.1.xxx/cops/ works. :-(

I hardly ever use Opensearch with Marvin but .......

mikespub commented 4 months ago

Hi @marioscube are you saying you don't want to use cops_full_url except for opensearch with Marvin?

That's not quite how it works these days I'm afraid, as all generated URLs are now prefixed with cops_full_url. So your best bet might be to use:

$config['cops_full_url'] = '/cops/';

without the http://hostname part so that localhost and DomainName will keep being used.

That only leaves Opensearch on Marvin as a potential problem, and that might already work fine just with the /cops/ part - can you check it out?

Note: with the hostname included, the initial page load with http://localhost/cops/ or http://DomainName/cops/ could still work too, but you may get some browser restrictions on script origin etc.

mikespub commented 4 months ago

And if Marvin doesn't work, I'd probably use something like this in your config_local.php

if (preg_match('/Marvin/', $_SERVER['HTTP_USER_AGENT'])) {
    $config['cops_full_url'] = 'http://192.168.1.xxx/cops/';
} else {
    $config['cops_full_url'] = '/cops/';
}

That way everyone is happy :-)

marioscube commented 4 months ago

Full URL prefix (with trailing /) useful especially for Opensearch where a full URL is often required For example Mantano, Aldiko and Marvin require it.

For the reference to Marvin I had to go back to 2013 with old(er) versions of both COPS and Marvin. Since then I had the habit of entering $config['cops_full_url'] = 'http://192.168.1.xxx/cops/'; in config-local.ohp.

Trying out the latest version op COPS I encountered a white screen when I opened COPS with http://localhost/cops/ (localhost = something I almost never do). Also when I used a domain name i get a white screen in COPS.

You must have changed something in COPS. This setting was introduced in COPS for use with OPDS. You now seem to use it for something else (http://). Well I think Mantano, Aldiko and Marvin are no longer actively developed with us, so why not?

Changing $config['cops_full_url'] = 'http://192.168.1.xxx/cops/'; to $config['cops_full_url'] = '/cops/'; seems to fix the white screens.

Using opensearch in Marvin OPDS worked as well. It even worked without setting this variable. As I said it was introduced in old(er) versions of both COPS and Marvin going back to 2013.

mikespub commented 4 months ago

Excellent news, and thanks for the feedback

mikespub commented 4 months ago

Clarified use of cops_full_url + reporting javascript errors instead of white screen for visibility