From afb556bf64635eec0d536bca12dd7d1e5ced399a Mon Sep 17 00:00:00 2001 From: Veloman Yunkan Date: Sat, 19 Feb 2022 11:34:24 +0400 Subject: [PATCH] Added field to OPDS entries --- src/opds_dumper.cpp | 4 +++- static/templates/catalog_entries.xml | 4 +++- static/templates/catalog_v2_entries.xml | 1 + static/templates/catalog_v2_entry.xml | 1 + test/server.cpp | 9 +++++++-- 5 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/opds_dumper.cpp b/src/opds_dumper.cpp index b42b682f9..361eaa204 100644 --- a/src/opds_dumper.cpp +++ b/src/opds_dumper.cpp @@ -72,6 +72,7 @@ IllustrationInfo getBookIllustrationInfo(const Book& book) kainjow::mustache::object getSingleBookData(const Book& book) { + const auto bookDate = book.getDate() + "T00:00:00Z"; const MustacheData bookUrl = book.getUrl().empty() ? MustacheData(false) : MustacheData(book.getUrl()); @@ -82,7 +83,8 @@ kainjow::mustache::object getSingleBookData(const Book& book) {"description", book.getDescription()}, {"language", book.getLanguage()}, {"content_id", urlEncode(book.getHumanReadableIdFromPath(), true)}, - {"updated", book.getDate() + "T00:00:00Z"}, + {"updated", bookDate}, // XXX: this should be the entry update datetime + {"book_date", bookDate}, {"category", book.getCategory()}, {"flavour", book.getFlavour()}, {"tags", book.getTags()}, diff --git a/static/templates/catalog_entries.xml b/static/templates/catalog_entries.xml index 40cbfccd7..e9691a42e 100644 --- a/static/templates/catalog_entries.xml +++ b/static/templates/catalog_entries.xml @@ -1,4 +1,6 @@ - + {{feed_id}} {{^filter}}All zims{{/filter}}{{#filter}}Filtered zims ({{filter}}){{/filter}} {{date}} diff --git a/static/templates/catalog_v2_entries.xml b/static/templates/catalog_v2_entries.xml index 2df9523d8..223aae9c3 100644 --- a/static/templates/catalog_v2_entries.xml +++ b/static/templates/catalog_v2_entries.xml @@ -1,5 +1,6 @@ {{feed_id}} diff --git a/static/templates/catalog_v2_entry.xml b/static/templates/catalog_v2_entry.xml index 9f7df876a..a2526b29f 100644 --- a/static/templates/catalog_v2_entry.xml +++ b/static/templates/catalog_v2_entry.xml @@ -25,6 +25,7 @@ {{publisher_name}} + {{book_date}} {{#url}} {{/url}} diff --git a/test/server.cpp b/test/server.cpp index d5e05a652..3950f73c7 100644 --- a/test/server.cpp +++ b/test/server.cpp @@ -1081,8 +1081,9 @@ std::string maskVariableOPDSFeedData(std::string s) } #define OPDS_FEED_TAG \ - "\n" + "\n" #define CATALOG_LINK_TAGS \ " \n" \ @@ -1110,6 +1111,7 @@ std::string maskVariableOPDSFeedData(std::string s) " \n" \ " Kiwix\n" \ " \n" \ + " 2020-03-31T00:00:00Z\n" \ " \n" \ " \n" @@ -1136,6 +1138,7 @@ std::string maskVariableOPDSFeedData(std::string s) " \n" \ " Kiwix\n" \ " \n" \ + " 2020-03-31T00:00:00Z\n" \ " \n" \ " \n" @@ -1159,6 +1162,7 @@ std::string maskVariableOPDSFeedData(std::string s) " \n" \ " Kiwix\n" \ " \n" \ + " 2020-03-31T00:00:00Z\n" \ " \n" \ " \n" @@ -1574,6 +1578,7 @@ TEST_F(LibraryServerTest, catalog_v2_languages) #define CATALOG_V2_ENTRIES_PREAMBLE0(x) \ "\n" \ "\n" \ " 12345678-90ab-cdef-1234-567890abcdef\n" \