From 6f0e55d60339c1ae5b62cc2bac24d91d25960780 Mon Sep 17 00:00:00 2001 From: Veloman Yunkan Date: Tue, 18 Apr 2023 14:45:07 +0400 Subject: [PATCH] A slight simplification of the mustache template Got rid of the partial vs full entries logic in the mustache template - now it is entirely contained in `OPDSDumper::dumpOPDSFeedV2()`. --- src/opds_dumper.cpp | 6 +++--- static/templates/catalog_v2_entries.xml | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/opds_dumper.cpp b/src/opds_dumper.cpp index a8b1be9ed..bdb21be7c 100644 --- a/src/opds_dumper.cpp +++ b/src/opds_dumper.cpp @@ -150,17 +150,17 @@ string OPDSDumper::dumpOPDSFeedV2(const std::vector& bookIds, const const auto booksData = getBooksData(library, nameMapper, bookIds, rootLocation, partial); const char* const endpoint = partial ? "/partial_entries" : "/entries"; + const std::string url = endpoint + (query.empty() ? "" : "?" + query); const kainjow::mustache::object template_data{ {"date", gen_date_str()}, {"endpoint_root", endpointRoot}, {"feed_id", gen_uuid(libraryId + endpoint + "?" + query)}, {"filter", onlyAsNonEmptyMustacheValue(query)}, - {"query", query.empty() ? "" : "?" + query}, + {"self_url", url}, {"totalResults", to_string(m_totalResults)}, {"startIndex", to_string(m_startIndex)}, {"itemsPerPage", to_string(m_count)}, - {"books", booksData }, - {"dump_partial_entries", MustacheData(partial)} + {"books", booksData } }; return render_template(RESOURCE::templates::catalog_v2_entries_xml, template_data); diff --git a/static/templates/catalog_v2_entries.xml b/static/templates/catalog_v2_entries.xml index c0eb9dcc9..264c728d9 100644 --- a/static/templates/catalog_v2_entries.xml +++ b/static/templates/catalog_v2_entries.xml @@ -6,7 +6,7 @@ {{feed_id}}