From 603303560aa9f17cef1f531637b5c0dec5ddcd8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Vinot?= Date: Thu, 10 Dec 2020 11:56:44 +0100 Subject: [PATCH] chg: shorten_string can return a div with title --- website/web/templates/index.html | 2 +- website/web/templates/macros.html | 11 ++++++++++- website/web/templates/modules.html | 13 +++++++++++-- 3 files changed, 22 insertions(+), 4 deletions(-) diff --git a/website/web/templates/index.html b/website/web/templates/index.html index 1f355043..a00c7e50 100644 --- a/website/web/templates/index.html +++ b/website/web/templates/index.html @@ -64,7 +64,7 @@ $(document).ready(function () {

{{ page_title }}

-

{{ shorten_string(url, 150) }}

+ {{ shorten_string(url, 50, with_title=True) }} {{ datetime }} diff --git a/website/web/templates/macros.html b/website/web/templates/macros.html index e84d06e8..be2ef023 100644 --- a/website/web/templates/macros.html +++ b/website/web/templates/macros.html @@ -281,10 +281,19 @@ {% endmacro %} -{% macro shorten_string(string, cut_length) %} +{% macro shorten_string(string, cut_length, with_title=False) %} +{% if with_title %} +
+{%endif%} + {% if string|length > cut_length %} {{ string[:cut_length] }} [...] {% else %} {{ string }} {%endif%} + +{% if with_title %} +
+{%endif%} + {% endmacro %} diff --git a/website/web/templates/modules.html b/website/web/templates/modules.html index 19c8f0a5..712c74c8 100644 --- a/website/web/templates/modules.html +++ b/website/web/templates/modules.html @@ -1,9 +1,15 @@ +{% from "macros.html" import shorten_string %} +
{% if vt %}

Virus Total

{% for url, entries in vt.items() %}
-

URL
{{ url }}

+
+

URL + {{ shorten_string(url, 50, with_title=True) }} +

+
{% if entries['malicious'] %}

Detected as malicious by the following vendors

@@ -23,7 +29,10 @@ {% if pi%}

Phishing Initiative

{% for url, tag in pi.items() %} -

URL
{{ url }}

+
+

URL + {{ shorten_string(url, 50, with_title=True) }} +

This URL is tagged as {{ tag }} on Phishing Initiative
{% endfor %}