From 419fe7408b68c5eae2fd1fb77f126c918c25f260 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Vinot?= Date: Wed, 15 Jul 2020 13:51:45 +0200 Subject: [PATCH] chg: Make icon list in popup a macro --- website/web/templates/hostname_popup.html | 32 +++-------------------- website/web/templates/macros.html | 20 ++++++++++++++ 2 files changed, 24 insertions(+), 28 deletions(-) diff --git a/website/web/templates/hostname_popup.html b/website/web/templates/hostname_popup.html index 91d6d939..64000ae8 100644 --- a/website/web/templates/hostname_popup.html +++ b/website/web/templates/hostname_popup.html @@ -2,6 +2,7 @@ {% from "macros.html" import sanejs_details %} {% from "macros.html" import indexed_hash %} {% from "macros.html" import indexed_cookies %} +{% from "macros.html" import popup_icons %} {% block title %}Details for {{ hostname }} {% endblock %} @@ -82,21 +83,7 @@
  • {# Details of the response #}

    Response

    - -
    - {% for key, path in keys_response.items() %} - {% if url['url_object'][key] %} - {% if key == "response_cookie" %} - {# Download cookies #} - - {{ key }} - - {% else %} - {{ key }} - {%endif%} - {%endif%} - {% endfor %} -
    + {{ popup_icons(keys_response, url['url_object'], tree_uuid) }} {# Response content block #}
    @@ -186,19 +173,8 @@
  • Request

    -
    - {% for key, path in keys_request.items() %} - {% if url['url_object'][key] %} - {% if key == "request_cookie" %} - - {{ key }} - - {% else %} - {{ key }} - {%endif%} - {%endif%} - {% endfor %} -
    + {{ popup_icons(keys_request, url['url_object'], tree_uuid) }} + {% if url['url_object'].posted_data %} Download posted data diff --git a/website/web/templates/macros.html b/website/web/templates/macros.html index ae0e266d..9a4b85ab 100644 --- a/website/web/templates/macros.html +++ b/website/web/templates/macros.html @@ -83,3 +83,23 @@ The same file was seen in {{ total_captures }} other captures. {% endif %} {% endmacro %} + +{% macro popup_icons(lookup_dict, urlnode, tree_uuid) %} +
    +{% for key, path in lookup_dict.items() %} + {% if urlnode[key] %} + {% if key == "request_cookie" %} + + {{ key }} + + {% elif key == "response_cookie"%} + + {{ key }} + + {% else %} + {{ key }} + {%endif%} + {%endif%} +{% endfor %} +
    +{% endmacro %}