language/category filtering in /nojs endpoint

Adds language and category filter in /nojs.
Unlike the main page, the filtering is only done after user submits the form.
This commit is contained in:
Nikhil Tanwar
2023-02-18 17:55:45 +05:30
parent f843ea48f0
commit 37aadb86fb
6 changed files with 70 additions and 3 deletions

View File

@ -783,7 +783,17 @@ std::unique_ptr<Response> InternalServer::handle_no_js(const RequestContext& req
std::string content;
if (urlParts.size() == 1) {
const auto filter = get_search_filter(request);
auto filter = get_search_filter(request);
try {
if (request.get_argument("category") == "") {
filter.clearCategory();
}
} catch (...) {}
try {
if (request.get_argument("lang") == "") {
filter.clearLang();
}
} catch (...) {}
content = htmlDumper.dumpPlainHTML(filter);
} else if ((urlParts.size() == 3) && (urlParts[1] == "download")) {
try {