mirror of
https://github.com/kiwix/libkiwix.git
synced 2025-06-27 21:39:37 +00:00
injecting root link directly and renamed head_part to head_taskbar
This commit is contained in:
@ -202,7 +202,7 @@ void ContentResponse::introduce_taskbar()
|
||||
data.set("hascontent", !m_bookName.empty());
|
||||
data.set("title", m_bookTitle);
|
||||
data.set("withlibrarybutton", m_withLibraryButton);
|
||||
auto head_content = render_template(RESOURCE::templates::head_part_html, data);
|
||||
auto head_content = render_template(RESOURCE::templates::head_taskbar_html, data);
|
||||
m_content = prependToFirstOccurence(
|
||||
m_content,
|
||||
"</head[ \\t]*>",
|
||||
@ -227,6 +227,13 @@ void ContentResponse::inject_externallinks_blocker()
|
||||
script_tag);
|
||||
}
|
||||
|
||||
void ContentResponse::inject_root_link(){
|
||||
m_content = prependToFirstOccurence(
|
||||
m_content,
|
||||
"<head[ \\t]*>",
|
||||
"<link type=\"root\" href=\"" + m_root + "\">");
|
||||
}
|
||||
|
||||
bool
|
||||
ContentResponse::can_compress(const RequestContext& request) const
|
||||
{
|
||||
@ -252,6 +259,8 @@ Response::create_mhd_response(const RequestContext& request)
|
||||
MHD_Response*
|
||||
ContentResponse::create_mhd_response(const RequestContext& request)
|
||||
{
|
||||
inject_root_link();
|
||||
|
||||
if (contentDecorationAllowed()) {
|
||||
if (m_withTaskbar) {
|
||||
introduce_taskbar();
|
||||
|
@ -89,6 +89,7 @@ class ContentResponse : public Response {
|
||||
|
||||
void introduce_taskbar();
|
||||
void inject_externallinks_blocker();
|
||||
void inject_root_link();
|
||||
bool can_compress(const RequestContext& request) const;
|
||||
bool contentDecorationAllowed() const;
|
||||
|
||||
|
Reference in New Issue
Block a user