Add a new config parameter to make COPS generate an unvalid OPDS feed.

That unvalid feed will allow some non compliant OPDS client to perform search.

Note that Mantano Reader is the only reader so far that works with COPS's
perfectly valid feed.

FBReaderJ was working fine in May 2012 ans is not working anymore : see https://github.com/geometer/FBReaderJ/issues/70
Moon+ Reader is also not working without modification.

Not really happy about that. Fix #14
This commit is contained in:
Sébastien Lucas 2012-09-08 15:09:52 +02:00
parent bc4bb716e4
commit 98d479df0f
2 changed files with 19 additions and 1 deletions

View file

@ -114,7 +114,15 @@ class OPDSRenderer
self::renderLink ($link);
$link = new LinkNavigation ("?" . $_SERVER['QUERY_STRING'], "self");
self::renderLink ($link);
if ($config['cops_generate_invalid_opds_stream'] == 0 || preg_match("/(MantanoReader)/", $_SERVER['HTTP_USER_AGENT'])) {
// Good and compliant way of handling search
$link = new Link ("feed.php?page=" . self::PAGE_OPENSEARCH, "application/opensearchdescription+xml", "search", "Search here");
}
else
{
// Bad way, will be removed when OPDS client are fixed
$link = new Link ($config['cops_full_url'] . 'feed.php?query={searchTerms}', "application/atom+xml", "search", "Search here");
}
self::renderLink ($link);
}

View file

@ -88,4 +88,14 @@
* 0 : disable
*/
$config['cops_use_url_rewriting'] = "0";
/*
* generate a invalid OPDS stream to allow bad OPDS client to use search
* Example of non compliant OPDS client : FBReader (was working in May 2012), Moon+ Reader
* Example of good OPDS client : Mantano
* 1 : enable support for non compliant OPDS client
* 0 : always generate valid OPDS code
*/
$config['cops_generate_invalid_opds_stream'] = "0";
?>