From c557bb271be10d1c865ea80e979109461ec159e4 Mon Sep 17 00:00:00 2001 From: Manan Jethwani Date: Wed, 24 Mar 2021 02:10:16 +0530 Subject: [PATCH] injecting root link directly and renamed head_part to head_taskbar --- src/server/response.cpp | 11 ++++++++++- src/server/response.h | 1 + static/resources_list.txt | 2 +- .../templates/{head_part.html => head_taskbar.html} | 1 - 4 files changed, 12 insertions(+), 3 deletions(-) rename static/templates/{head_part.html => head_taskbar.html} (93%) diff --git a/src/server/response.cpp b/src/server/response.cpp index 2aa4aee95..4f19f0a97 100644 --- a/src/server/response.cpp +++ b/src/server/response.cpp @@ -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, "", @@ -227,6 +227,13 @@ void ContentResponse::inject_externallinks_blocker() script_tag); } +void ContentResponse::inject_root_link(){ + m_content = prependToFirstOccurence( + m_content, + "", + ""); +} + 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(); diff --git a/src/server/response.h b/src/server/response.h index bb1ecb25d..f493bb00d 100644 --- a/src/server/response.h +++ b/src/server/response.h @@ -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; diff --git a/static/resources_list.txt b/static/resources_list.txt index 7579c33f6..d31c323ba 100644 --- a/static/resources_list.txt +++ b/static/resources_list.txt @@ -27,7 +27,7 @@ templates/404.html templates/500.html templates/index.html templates/suggestion.json -templates/head_part.html +templates/head_taskbar.html templates/taskbar_part.html templates/external_blocker_part.html templates/captured_external.html diff --git a/static/templates/head_part.html b/static/templates/head_taskbar.html similarity index 93% rename from static/templates/head_part.html rename to static/templates/head_taskbar.html index 99ba116ee..ac56d4117 100644 --- a/static/templates/head_part.html +++ b/static/templates/head_taskbar.html @@ -1,7 +1,6 @@ -