From 0ce36e624642a64925f6ca10a2a75f4020ad3893 Mon Sep 17 00:00:00 2001 From: Veloman Yunkan Date: Sun, 26 Jun 2022 14:10:17 +0400 Subject: [PATCH] Got rid of isHomePage in ContentResponse::build() --- src/server/internalServer.cpp | 5 ----- src/server/internalServer.h | 2 +- src/server/internalServer_catalog_v2.cpp | 5 ----- src/server/response.cpp | 5 ++--- src/server/response.h | 1 - 5 files changed, 3 insertions(+), 15 deletions(-) diff --git a/src/server/internalServer.cpp b/src/server/internalServer.cpp index f249acded..d996c9ab0 100644 --- a/src/server/internalServer.cpp +++ b/src/server/internalServer.cpp @@ -728,7 +728,6 @@ std::unique_ptr InternalServer::handle_skin(const RequestContext& requ *this, getResource(resourceName), getMimeTypeForFile(resourceName), - /*isHomePage=*/false, /*raw=*/true); response->set_cacheable(); return std::move(response); @@ -820,11 +819,9 @@ std::unique_ptr InternalServer::handle_search(const RequestContext& re renderer.setPageLength(pageLength); if (request.get_requested_format() == "xml") { return ContentResponse::build(*this, renderer.getXml(), "application/rss+xml; charset=utf-8", - /*isHomePage =*/false, /*raw =*/true); } auto response = ContentResponse::build(*this, renderer.getHtml(), "text/html; charset=utf-8", - /*isHomePage =*/false, /*raw =*/false); // XXX: Now this has to be handled by the iframe-based viewer which // XXX: has to resolve if the book selection resulted in a single book. @@ -956,7 +953,6 @@ std::unique_ptr InternalServer::handle_catalog(const RequestContext& r *this, opdsDumper.dumpOPDSFeed(bookIdsToDump, request.get_query()), "application/atom+xml; profile=opds-catalog; kind=acquisition; charset=utf-8", - /*isHomePage*/ false, /*raw*/ true); return std::move(response); } @@ -1146,7 +1142,6 @@ std::unique_ptr InternalServer::handle_locally_customized_resource(con return ContentResponse::build(*this, resourceData, crd.mimeType, - /*isHomePage=*/false, /*raw=*/true); } diff --git a/src/server/internalServer.h b/src/server/internalServer.h index 82574378c..ee2c20724 100644 --- a/src/server/internalServer.h +++ b/src/server/internalServer.h @@ -183,7 +183,7 @@ class InternalServer { std::unique_ptr m_customizedResources; friend std::unique_ptr Response::build(const InternalServer& server); - friend std::unique_ptr ContentResponse::build(const InternalServer& server, const std::string& content, const std::string& mimetype, bool isHomePage, bool raw); + friend std::unique_ptr ContentResponse::build(const InternalServer& server, const std::string& content, const std::string& mimetype, bool raw); friend std::unique_ptr ItemResponse::build(const InternalServer& server, const RequestContext& request, const zim::Item& item, bool raw); }; diff --git a/src/server/internalServer_catalog_v2.cpp b/src/server/internalServer_catalog_v2.cpp index f6314855f..842c25441 100644 --- a/src/server/internalServer_catalog_v2.cpp +++ b/src/server/internalServer_catalog_v2.cpp @@ -104,7 +104,6 @@ std::unique_ptr InternalServer::handle_catalog_v2_entries(const Reques *this, opdsFeed, "application/atom+xml;profile=opds-catalog;kind=acquisition", - /*isHomePage*/ false, /*raw*/ true ); } @@ -126,7 +125,6 @@ std::unique_ptr InternalServer::handle_catalog_v2_complete_entry(const *this, opdsFeed, "application/atom+xml;type=entry;profile=opds-catalog", - /*isHomePage*/ false, /*raw*/ true ); } @@ -140,7 +138,6 @@ std::unique_ptr InternalServer::handle_catalog_v2_categories(const Req *this, opdsDumper.categoriesOPDSFeed(), "application/atom+xml;profile=opds-catalog;kind=navigation", - /*isHomePage*/ false, /*raw*/ true ); } @@ -154,7 +151,6 @@ std::unique_ptr InternalServer::handle_catalog_v2_languages(const Requ *this, opdsDumper.languagesOPDSFeed(), "application/atom+xml;profile=opds-catalog;kind=navigation", - /*isHomePage*/ false, /*raw*/ true ); } @@ -170,7 +166,6 @@ std::unique_ptr InternalServer::handle_catalog_v2_illustration(const R *this, illustration->getData(), illustration->mimeType, - /*isHomePage*/ false, /*raw*/ true ); } catch(...) { diff --git a/src/server/response.cpp b/src/server/response.cpp index d82e9e7be..df0517e92 100644 --- a/src/server/response.cpp +++ b/src/server/response.cpp @@ -429,7 +429,6 @@ std::unique_ptr ContentResponse::build( const InternalServer& server, const std::string& content, const std::string& mimetype, - bool isHomePage, bool raw) { return std::unique_ptr(new ContentResponse( @@ -448,7 +447,7 @@ std::unique_ptr ContentResponse::build( const std::string& mimetype) { auto content = render_template(template_str, data); - return ContentResponse::build(server, content, mimetype, /*isHomePage*/false, /*raw*/false); + return ContentResponse::build(server, content, mimetype, /*raw*/false); } ItemResponse::ItemResponse(bool verbose, const zim::Item& item, const std::string& mimetype, const ByteRange& byterange) : @@ -468,7 +467,7 @@ std::unique_ptr ItemResponse::build(const InternalServer& server, cons const bool noRange = byteRange.kind() == ByteRange::RESOLVED_FULL_CONTENT; if (noRange && is_compressible_mime_type(mimetype)) { // Return a contentResponse - auto response = ContentResponse::build(server, item.getData(), mimetype, /*isHomePage=*/false, raw); + auto response = ContentResponse::build(server, item.getData(), mimetype, raw); response->set_cacheable(); response->m_byteRange = byteRange; return std::move(response); diff --git a/src/server/response.h b/src/server/response.h index 182210d50..ff78ff0a7 100644 --- a/src/server/response.h +++ b/src/server/response.h @@ -92,7 +92,6 @@ class ContentResponse : public Response { const InternalServer& server, const std::string& content, const std::string& mimetype, - bool isHomePage, bool raw); static std::unique_ptr build(