From: Roland Häder Date: Sat, 24 Jun 2023 10:37:13 +0000 (+0200) Subject: Continued: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=79a3d934f22852b1b385a4d88ffde4cd9eba2608;p=fba.git Continued: - count all found records, output message if requested amount is same - renamed template variable blocks -> blocklist so it is the same as in api.py --- diff --git a/api.py b/api.py index 3e0e825..3710197 100644 --- a/api.py +++ b/api.py @@ -285,18 +285,21 @@ def top(request: Request, mode: str, value: str, amount: int = 500): if response is not None: blocklist = response.json() + found = 0 for block_level in blocklist: for block in blocklist[block_level]: block["first_seen"] = datetime.utcfromtimestamp(block["first_seen"]).strftime(config.get("timestamp_format")) block["last_seen"] = datetime.utcfromtimestamp(block["last_seen"]).strftime(config.get("timestamp_format")) + found = found + 1 return templates.TemplateResponse("views/top.html", { - "request": request, - "mode" : mode if response is not None else None, - "value" : value if response is not None else None, - "amount" : amount if response is not None else None, - "blocks" : blocklist, - "info" : info, + "request" : request, + "mode" : mode if response is not None else None, + "value" : value if response is not None else None, + "amount" : amount if response is not None else None, + "found" : found, + "blocklist": blocklist, + "info" : info, }) @router.get(config.get("base_url") + "/rss") diff --git a/templates/base.html b/templates/base.html index 485eb44..26e3fae 100644 --- a/templates/base.html +++ b/templates/base.html @@ -91,7 +91,7 @@ min-width: 50%; width: 50em; } - .notes { + .notice { margin-left: auto; margin-right: auto; margin-bottom: 20px; @@ -100,11 +100,11 @@ border: 1px solid #eaeaea; border-radius: 5px; } - .notes > div { + .notice > div { margin: 0px; padding: 5px; } - .notes > h2 { + .notice > h2 { margin: 0px; padding: 5px; background-color: #eaeaea; diff --git a/templates/views/scoreboard.html b/templates/views/scoreboard.html index b8449ad..ba54fbd 100644 --- a/templates/views/scoreboard.html +++ b/templates/views/scoreboard.html @@ -64,14 +64,14 @@ {% block footer %} {% if mode == 'error_code' %} -
+

Error codes:

  • Error code 999 is fake and covers a lot of reasons why the domain/instance is not reachable. Mostly that the domain is not resolvable or the server refused connection.
{% elif mode == 'detection_mode' %} -
+

Detection modes:

Detection is done in following order: @@ -85,7 +85,7 @@
{% elif mode == 'obfuscation' %} -
+

Obfuscation status:

  • Only supported networks are counted here.
  • diff --git a/templates/views/top.html b/templates/views/top.html index c18da52..82acd71 100644 --- a/templates/views/top.html +++ b/templates/views/top.html @@ -22,9 +22,19 @@ {% endblock %} {% block content %} - {% for block_level in blocks %} + {% if amount == found %} +
    +

    Maximum amount reached!

    +
    + Please note that the maximum allowed amount is only returned, the blocker/blocked/reason might be more. + Paging support is not finished yet. +
    +
    + {% endif %} + + {% for block_level in blocklist %}
    -

    {{block_level}} ({{blocks[block_level]|length}})

    +

    {{block_level}} ({{blocklist[block_level]|length}})

    @@ -35,7 +45,7 @@ - {% for block in blocks[block_level] %} + {% for block in blocklist[block_level] %}
    Blocker
    {% with domain=block['blocker'] %}