mirror of https://github.com/kiwix/libkiwix.git
Got rid of isHomePage in ContentResponse::build()
This commit is contained in:
parent
eb0a45b13e
commit
0ce36e6246
|
@ -728,7 +728,6 @@ std::unique_ptr<Response> InternalServer::handle_skin(const RequestContext& requ
|
||||||
*this,
|
*this,
|
||||||
getResource(resourceName),
|
getResource(resourceName),
|
||||||
getMimeTypeForFile(resourceName),
|
getMimeTypeForFile(resourceName),
|
||||||
/*isHomePage=*/false,
|
|
||||||
/*raw=*/true);
|
/*raw=*/true);
|
||||||
response->set_cacheable();
|
response->set_cacheable();
|
||||||
return std::move(response);
|
return std::move(response);
|
||||||
|
@ -820,11 +819,9 @@ std::unique_ptr<Response> InternalServer::handle_search(const RequestContext& re
|
||||||
renderer.setPageLength(pageLength);
|
renderer.setPageLength(pageLength);
|
||||||
if (request.get_requested_format() == "xml") {
|
if (request.get_requested_format() == "xml") {
|
||||||
return ContentResponse::build(*this, renderer.getXml(), "application/rss+xml; charset=utf-8",
|
return ContentResponse::build(*this, renderer.getXml(), "application/rss+xml; charset=utf-8",
|
||||||
/*isHomePage =*/false,
|
|
||||||
/*raw =*/true);
|
/*raw =*/true);
|
||||||
}
|
}
|
||||||
auto response = ContentResponse::build(*this, renderer.getHtml(), "text/html; charset=utf-8",
|
auto response = ContentResponse::build(*this, renderer.getHtml(), "text/html; charset=utf-8",
|
||||||
/*isHomePage =*/false,
|
|
||||||
/*raw =*/false);
|
/*raw =*/false);
|
||||||
// XXX: Now this has to be handled by the iframe-based viewer which
|
// 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.
|
// XXX: has to resolve if the book selection resulted in a single book.
|
||||||
|
@ -956,7 +953,6 @@ std::unique_ptr<Response> InternalServer::handle_catalog(const RequestContext& r
|
||||||
*this,
|
*this,
|
||||||
opdsDumper.dumpOPDSFeed(bookIdsToDump, request.get_query()),
|
opdsDumper.dumpOPDSFeed(bookIdsToDump, request.get_query()),
|
||||||
"application/atom+xml; profile=opds-catalog; kind=acquisition; charset=utf-8",
|
"application/atom+xml; profile=opds-catalog; kind=acquisition; charset=utf-8",
|
||||||
/*isHomePage*/ false,
|
|
||||||
/*raw*/ true);
|
/*raw*/ true);
|
||||||
return std::move(response);
|
return std::move(response);
|
||||||
}
|
}
|
||||||
|
@ -1146,7 +1142,6 @@ std::unique_ptr<Response> InternalServer::handle_locally_customized_resource(con
|
||||||
return ContentResponse::build(*this,
|
return ContentResponse::build(*this,
|
||||||
resourceData,
|
resourceData,
|
||||||
crd.mimeType,
|
crd.mimeType,
|
||||||
/*isHomePage=*/false,
|
|
||||||
/*raw=*/true);
|
/*raw=*/true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -183,7 +183,7 @@ class InternalServer {
|
||||||
std::unique_ptr<CustomizedResources> m_customizedResources;
|
std::unique_ptr<CustomizedResources> m_customizedResources;
|
||||||
|
|
||||||
friend std::unique_ptr<Response> Response::build(const InternalServer& server);
|
friend std::unique_ptr<Response> Response::build(const InternalServer& server);
|
||||||
friend std::unique_ptr<ContentResponse> ContentResponse::build(const InternalServer& server, const std::string& content, const std::string& mimetype, bool isHomePage, bool raw);
|
friend std::unique_ptr<ContentResponse> ContentResponse::build(const InternalServer& server, const std::string& content, const std::string& mimetype, bool raw);
|
||||||
friend std::unique_ptr<Response> ItemResponse::build(const InternalServer& server, const RequestContext& request, const zim::Item& item, bool raw);
|
friend std::unique_ptr<Response> ItemResponse::build(const InternalServer& server, const RequestContext& request, const zim::Item& item, bool raw);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -104,7 +104,6 @@ std::unique_ptr<Response> InternalServer::handle_catalog_v2_entries(const Reques
|
||||||
*this,
|
*this,
|
||||||
opdsFeed,
|
opdsFeed,
|
||||||
"application/atom+xml;profile=opds-catalog;kind=acquisition",
|
"application/atom+xml;profile=opds-catalog;kind=acquisition",
|
||||||
/*isHomePage*/ false,
|
|
||||||
/*raw*/ true
|
/*raw*/ true
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -126,7 +125,6 @@ std::unique_ptr<Response> InternalServer::handle_catalog_v2_complete_entry(const
|
||||||
*this,
|
*this,
|
||||||
opdsFeed,
|
opdsFeed,
|
||||||
"application/atom+xml;type=entry;profile=opds-catalog",
|
"application/atom+xml;type=entry;profile=opds-catalog",
|
||||||
/*isHomePage*/ false,
|
|
||||||
/*raw*/ true
|
/*raw*/ true
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -140,7 +138,6 @@ std::unique_ptr<Response> InternalServer::handle_catalog_v2_categories(const Req
|
||||||
*this,
|
*this,
|
||||||
opdsDumper.categoriesOPDSFeed(),
|
opdsDumper.categoriesOPDSFeed(),
|
||||||
"application/atom+xml;profile=opds-catalog;kind=navigation",
|
"application/atom+xml;profile=opds-catalog;kind=navigation",
|
||||||
/*isHomePage*/ false,
|
|
||||||
/*raw*/ true
|
/*raw*/ true
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -154,7 +151,6 @@ std::unique_ptr<Response> InternalServer::handle_catalog_v2_languages(const Requ
|
||||||
*this,
|
*this,
|
||||||
opdsDumper.languagesOPDSFeed(),
|
opdsDumper.languagesOPDSFeed(),
|
||||||
"application/atom+xml;profile=opds-catalog;kind=navigation",
|
"application/atom+xml;profile=opds-catalog;kind=navigation",
|
||||||
/*isHomePage*/ false,
|
|
||||||
/*raw*/ true
|
/*raw*/ true
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -170,7 +166,6 @@ std::unique_ptr<Response> InternalServer::handle_catalog_v2_illustration(const R
|
||||||
*this,
|
*this,
|
||||||
illustration->getData(),
|
illustration->getData(),
|
||||||
illustration->mimeType,
|
illustration->mimeType,
|
||||||
/*isHomePage*/ false,
|
|
||||||
/*raw*/ true
|
/*raw*/ true
|
||||||
);
|
);
|
||||||
} catch(...) {
|
} catch(...) {
|
||||||
|
|
|
@ -429,7 +429,6 @@ std::unique_ptr<ContentResponse> ContentResponse::build(
|
||||||
const InternalServer& server,
|
const InternalServer& server,
|
||||||
const std::string& content,
|
const std::string& content,
|
||||||
const std::string& mimetype,
|
const std::string& mimetype,
|
||||||
bool isHomePage,
|
|
||||||
bool raw)
|
bool raw)
|
||||||
{
|
{
|
||||||
return std::unique_ptr<ContentResponse>(new ContentResponse(
|
return std::unique_ptr<ContentResponse>(new ContentResponse(
|
||||||
|
@ -448,7 +447,7 @@ std::unique_ptr<ContentResponse> ContentResponse::build(
|
||||||
const std::string& mimetype)
|
const std::string& mimetype)
|
||||||
{
|
{
|
||||||
auto content = render_template(template_str, data);
|
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) :
|
ItemResponse::ItemResponse(bool verbose, const zim::Item& item, const std::string& mimetype, const ByteRange& byterange) :
|
||||||
|
@ -468,7 +467,7 @@ std::unique_ptr<Response> ItemResponse::build(const InternalServer& server, cons
|
||||||
const bool noRange = byteRange.kind() == ByteRange::RESOLVED_FULL_CONTENT;
|
const bool noRange = byteRange.kind() == ByteRange::RESOLVED_FULL_CONTENT;
|
||||||
if (noRange && is_compressible_mime_type(mimetype)) {
|
if (noRange && is_compressible_mime_type(mimetype)) {
|
||||||
// Return a contentResponse
|
// 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->set_cacheable();
|
||||||
response->m_byteRange = byteRange;
|
response->m_byteRange = byteRange;
|
||||||
return std::move(response);
|
return std::move(response);
|
||||||
|
|
|
@ -92,7 +92,6 @@ class ContentResponse : public Response {
|
||||||
const InternalServer& server,
|
const InternalServer& server,
|
||||||
const std::string& content,
|
const std::string& content,
|
||||||
const std::string& mimetype,
|
const std::string& mimetype,
|
||||||
bool isHomePage,
|
|
||||||
bool raw);
|
bool raw);
|
||||||
|
|
||||||
static std::unique_ptr<ContentResponse> build(
|
static std::unique_ptr<ContentResponse> build(
|
||||||
|
|
Loading…
Reference in New Issue