mirror of https://github.com/kiwix/libkiwix.git
commit
c5051b343e
|
@ -4,6 +4,7 @@ sudo: true
|
||||||
cache: ccache
|
cache: ccache
|
||||||
before_install:
|
before_install:
|
||||||
- PATH=$PATH:$HOME/bin
|
- PATH=$PATH:$HOME/bin
|
||||||
|
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew unlink python@2; brew link --overwrite python@3; fi
|
||||||
install: travis/install_deps.sh
|
install: travis/install_deps.sh
|
||||||
script: travis/compile.sh
|
script: travis/compile.sh
|
||||||
env:
|
env:
|
||||||
|
|
|
@ -1,3 +1,10 @@
|
||||||
|
kiwix-lib 8.2.3
|
||||||
|
===============
|
||||||
|
|
||||||
|
* [OPDS] Correctly set the id of the OPDS stream.
|
||||||
|
* [OPDS] Do not try to filter the catalog if no filter field is given in the
|
||||||
|
request.
|
||||||
|
|
||||||
kiwix-lib 8.2.2
|
kiwix-lib 8.2.2
|
||||||
===============
|
===============
|
||||||
|
|
||||||
|
|
|
@ -742,7 +742,6 @@ Response InternalServer::handle_catalog(const RequestContext& request)
|
||||||
kiwix::OPDSDumper opdsDumper;
|
kiwix::OPDSDumper opdsDumper;
|
||||||
opdsDumper.setRootLocation(m_root);
|
opdsDumper.setRootLocation(m_root);
|
||||||
opdsDumper.setSearchDescriptionUrl("catalog/searchdescription.xml");
|
opdsDumper.setSearchDescriptionUrl("catalog/searchdescription.xml");
|
||||||
opdsDumper.setId(kiwix::to_string(uuid));
|
|
||||||
opdsDumper.setLibrary(mp_library);
|
opdsDumper.setLibrary(mp_library);
|
||||||
response.set_mimeType("application/atom+xml;profile=opds-catalog;kind=acquisition; charset=utf-8");
|
response.set_mimeType("application/atom+xml;profile=opds-catalog;kind=acquisition; charset=utf-8");
|
||||||
std::vector<std::string> bookIdsToDump;
|
std::vector<std::string> bookIdsToDump;
|
||||||
|
@ -751,17 +750,16 @@ Response InternalServer::handle_catalog(const RequestContext& request)
|
||||||
uuid = zim::Uuid::generate(host);
|
uuid = zim::Uuid::generate(host);
|
||||||
bookIdsToDump = mp_library->filter(kiwix::Filter().valid(true).local(true).remote(true));
|
bookIdsToDump = mp_library->filter(kiwix::Filter().valid(true).local(true).remote(true));
|
||||||
} else if (url == "search") {
|
} else if (url == "search") {
|
||||||
std::string query;
|
auto filter = kiwix::Filter().valid(true).local(true).remote(true);
|
||||||
std::string language;
|
string query("<Empty query>");
|
||||||
std::vector<std::string> tags;
|
|
||||||
std::vector<std::string> noTags;
|
|
||||||
size_t count(10);
|
size_t count(10);
|
||||||
size_t startIndex(0);
|
size_t startIndex(0);
|
||||||
try {
|
try {
|
||||||
query = request.get_argument("q");
|
query = request.get_argument("q");
|
||||||
|
filter.query(query);
|
||||||
} catch (const std::out_of_range&) {}
|
} catch (const std::out_of_range&) {}
|
||||||
try {
|
try {
|
||||||
language = request.get_argument("lang");
|
filter.lang(request.get_argument("lang"));
|
||||||
} catch (const std::out_of_range&) {}
|
} catch (const std::out_of_range&) {}
|
||||||
try {
|
try {
|
||||||
count = extractFromString<unsigned long>(request.get_argument("count"));
|
count = extractFromString<unsigned long>(request.get_argument("count"));
|
||||||
|
@ -770,20 +768,14 @@ Response InternalServer::handle_catalog(const RequestContext& request)
|
||||||
startIndex = extractFromString<unsigned long>(request.get_argument("start"));
|
startIndex = extractFromString<unsigned long>(request.get_argument("start"));
|
||||||
} catch (...) {}
|
} catch (...) {}
|
||||||
try {
|
try {
|
||||||
tags = kiwix::split(request.get_argument("notag"), ";");
|
filter.acceptTags(kiwix::split(request.get_argument("notag"), ";"));
|
||||||
} catch (...) {}
|
} catch (...) {}
|
||||||
try {
|
try {
|
||||||
noTags = kiwix::split(request.get_argument("notag"), ";");
|
filter.rejectTags(kiwix::split(request.get_argument("notag"), ";"));
|
||||||
} catch (...) {}
|
} catch (...) {}
|
||||||
opdsDumper.setTitle("Search result for " + query);
|
opdsDumper.setTitle("Search result for " + query);
|
||||||
uuid = zim::Uuid::generate();
|
uuid = zim::Uuid::generate();
|
||||||
bookIdsToDump = mp_library->filter(
|
bookIdsToDump = mp_library->filter(filter);
|
||||||
kiwix::Filter().valid(true).local(true).remote(true)
|
|
||||||
.query(query)
|
|
||||||
.lang(language)
|
|
||||||
.acceptTags(tags)
|
|
||||||
.rejectTags(noTags)
|
|
||||||
);
|
|
||||||
auto totalResults = bookIdsToDump.size();
|
auto totalResults = bookIdsToDump.size();
|
||||||
bookIdsToDump.erase(bookIdsToDump.begin(), bookIdsToDump.begin()+startIndex);
|
bookIdsToDump.erase(bookIdsToDump.begin(), bookIdsToDump.begin()+startIndex);
|
||||||
if (count>0 && bookIdsToDump.size() > count) {
|
if (count>0 && bookIdsToDump.size() > count) {
|
||||||
|
@ -792,6 +784,7 @@ Response InternalServer::handle_catalog(const RequestContext& request)
|
||||||
opdsDumper.setOpenSearchInfo(totalResults, startIndex, bookIdsToDump.size());
|
opdsDumper.setOpenSearchInfo(totalResults, startIndex, bookIdsToDump.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
opdsDumper.setId(kiwix::to_string(uuid));
|
||||||
response.set_content(opdsDumper.dumpOPDSFeed(bookIdsToDump));
|
response.set_content(opdsDumper.dumpOPDSFeed(bookIdsToDump));
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue