diff --git a/src/server/internalServer.cpp b/src/server/internalServer.cpp index ae77e0871..9520af296 100644 --- a/src/server/internalServer.cpp +++ b/src/server/internalServer.cpp @@ -732,6 +732,13 @@ std::unique_ptr InternalServer::handle_catalog_v2(const RequestContext if (url == "root.xml") { return handle_catalog_v2_root(request); + } else if (url == "searchdescription.xml") { + const std::string endpoint_root = normalizeRootUrl(m_root) + "/catalog/v2"; + return ContentResponse::build(*this, + RESOURCE::catalog_v2_searchdescription_xml, + kainjow::mustache::object({{"endpoint_root", endpoint_root}}), + "application/opensearchdescription+xml" + ); } else if (url == "entries") { return handle_catalog_v2_entries(request); } else if (url == "categories") { diff --git a/static/catalog_v2_root.xml b/static/catalog_v2_root.xml index ee78cdfec..44db61c13 100644 --- a/static/catalog_v2_root.xml +++ b/static/catalog_v2_root.xml @@ -8,6 +8,9 @@ + OPDS Catalog Root {{date}} diff --git a/static/catalog_v2_searchdescription.xml b/static/catalog_v2_searchdescription.xml new file mode 100644 index 000000000..d9c94967a --- /dev/null +++ b/static/catalog_v2_searchdescription.xml @@ -0,0 +1,10 @@ + + + Zim catalog search + Search zim files in the catalog. + + diff --git a/static/resources_list.txt b/static/resources_list.txt index 9b9923bcf..83dea44aa 100644 --- a/static/resources_list.txt +++ b/static/resources_list.txt @@ -40,3 +40,4 @@ opensearchdescription.xml catalog_v2_root.xml catalog_v2_entries.xml catalog_v2_categories.xml +catalog_v2_searchdescription.xml diff --git a/test/server.cpp b/test/server.cpp index 6f1382fef..42401cc74 100644 --- a/test/server.cpp +++ b/test/server.cpp @@ -916,6 +916,9 @@ TEST_F(LibraryServerTest, catalog_v2_root) + OPDS Catalog Root YYYY-MM-DDThh:mm:ssZ @@ -942,6 +945,24 @@ TEST_F(LibraryServerTest, catalog_v2_root) EXPECT_EQ(maskVariableOPDSFeedData(r->body), expected_output); } +TEST_F(LibraryServerTest, catalog_v2_searchdescription_xml) +{ + const auto r = zfs1_->GET("/catalog/v2/searchdescription.xml"); + EXPECT_EQ(r->status, 200); + EXPECT_EQ(r->body, + "\n" + "\n" + " Zim catalog search\n" + " Search zim files in the catalog.\n" + " \n" + "\n" + ); +} + TEST_F(LibraryServerTest, catalog_v2_categories) { const auto r = zfs1_->GET("/catalog/v2/categories");