diff --git a/src/server.cpp b/src/server.cpp index c4cf4a546..b830c7c79 100644 --- a/src/server.cpp +++ b/src/server.cpp @@ -392,7 +392,7 @@ Response InternalServer::build_500(const std::string& msg) { kainjow::mustache::data data; data.set("error", msg); - Response response(m_root, true, false, false, false); + Response response(m_root, true, false, false, m_blockExternalLinks); response.set_template(RESOURCE::templates::_500_html, data); response.set_mimeType("text/html"); response.set_code(MHD_HTTP_INTERNAL_SERVER_ERROR); @@ -732,7 +732,7 @@ Response InternalServer::handle_captured_external(const RequestContext& request) auto data = get_default_data(); data.set("source", source); - Response response = Response(m_root, m_verbose.load(), m_withTaskbar, m_withLibraryButton, false); + auto response = get_default_response(); response.set_template(RESOURCE::templates::captured_external_html, data); response.set_mimeType("text/html; charset=utf-8"); response.set_compress(true); diff --git a/static/skin/block_external.js b/static/skin/block_external.js index 9b70f243c..04430670b 100644 --- a/static/skin/block_external.js +++ b/static/skin/block_external.js @@ -1,10 +1,13 @@ +var block_path = "/catch/external"; // called only on external links -function capture_event(e) { e.target.setAttribute("href", encodeURI("/catch/external?source=" + e.target.href)); } +function capture_event(e) { e.target.setAttribute("href", encodeURI(block_path + "?source=" + e.target.href)); } // called on all link clicks. filters external and call capture_event function on_click_event(e) { if ("target" in e && "href" in e.target) { var href = e.target.href; + if (window.location.pathname.indexOf(block_path) == 0) // already in catch page + return; if (href.indexOf(window.location.origin) == 0) return; if (href.substr(0, 2) == "//") diff --git a/static/templates/captured_external.html b/static/templates/captured_external.html index 016172316..a75bd3fe8 100644 --- a/static/templates/captured_external.html +++ b/static/templates/captured_external.html @@ -13,7 +13,7 @@
This instance of Kiwix protects you from accidentaly going to external (out-of ZIM) links.
-If you intend to go to such locations, please click the link bellow.
+If you intend to go to such locations, please click the link below.