From: Roland Häder
Date: Thu, 22 Jun 2023 15:36:51 +0000 (+0200)
Subject: Continued:
X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=d6dd552eaa3d835a7f276d58059066e69cb918f5;p=fba.git
Continued:
- also expose this flag in relation to used software (currently only mastodon
and pleroma obsfucate)
---
diff --git a/api.py b/api.py
index 4b4b4da..2d3bbe1 100644
--- a/api.py
+++ b/api.py
@@ -71,6 +71,8 @@ def api_scoreboard(mode: str, amount: int):
database.cursor.execute("SELECT last_status_code, COUNT(domain) AS score FROM instances WHERE last_status_code IS NOT NULL AND last_status_code != '200' GROUP BY last_status_code ORDER BY score DESC LIMIT ?", [amount])
elif mode == "avg_peers":
database.cursor.execute("SELECT software, AVG(total_peers) AS sum FROM instances WHERE software IS NOT NULL GROUP BY software HAVING sum>0 ORDER BY sum DESC LIMIT ?", [amount])
+ elif mode == "obsfucator":
+ database.cursor.execute("SELECT software, COUNT(domain) AS cnt FROM instances WHERE has_obsfucation IS NOT NULL GROUP BY software ORDER BY cnt DESC LIMIT ?", [amount])
else:
raise HTTPException(status_code=400, detail="No filter specified")
@@ -177,6 +179,8 @@ def scoreboard(request: Request, mode: str, amount: int):
response = requests.get(f"http://{config.get('host')}:{config.get('port')}{config.get('base_url')}/api/scoreboard.json?mode=error_code&amount={amount}")
elif mode == "avg_peers" and amount > 0:
response = requests.get(f"http://{config.get('host')}:{config.get('port')}{config.get('base_url')}/api/scoreboard.json?mode=avg_peers&amount={amount}")
+ elif mode == "obsfucator" and amount > 0:
+ response = requests.get(f"http://{config.get('host')}:{config.get('port')}{config.get('base_url')}/api/scoreboard.json?mode=obsfucator&amount={amount}")
else:
raise HTTPException(status_code=400, detail="No filter specified")
diff --git a/templates/views/index.html b/templates/views/index.html
index 2cab610..87b5602 100644
--- a/templates/views/index.html
+++ b/templates/views/index.html
@@ -31,7 +31,8 @@
used software /
commands /
error codes /
- average peers
+ average peers /
+ obsfucating software
{% endblock %}
{% block footer %}
diff --git a/templates/views/scoreboard.html b/templates/views/scoreboard.html
index 12fa8b6..b0612ce 100644
--- a/templates/views/scoreboard.html
+++ b/templates/views/scoreboard.html
@@ -1,6 +1,6 @@
{% extends "base.html" %}
-{% block title %}Scoreboard - {% if mode == 'software' %}TOP {{amount}} used software{% elif mode == 'avg_peers' %}TOP {{amount}} average peer count{% elif mode == 'command' %}TOP {{amount}} commands{% elif mode == 'error_code' %}TOP {{amount}} error codes{% elif mode == 'reference' %}TOP {{amount}} referencing instances{% elif mode == 'blocked' %}TOP {{amount}} deferated instances{% elif mode == 'blocker' %}TOP {{amount}} deferating instances{% endif %}{% endblock %}
+{% block title %}Scoreboard - {% if mode == 'software' %}TOP {{amount}} used software{% elif mode == 'obsfucator' %}TOP {{amount}} obsfucating software{% elif mode == 'avg_peers' %}TOP {{amount}} average peer count{% elif mode == 'command' %}TOP {{amount}} commands{% elif mode == 'error_code' %}TOP {{amount}} error codes{% elif mode == 'reference' %}TOP {{amount}} referencing instances{% elif mode == 'blocked' %}TOP {{amount}} deferated instances{% elif mode == 'blocker' %}TOP {{amount}} deferating instances{% endif %}{% endblock %}
{% block header %}
{% if mode == 'blocker' %}
@@ -15,6 +15,10 @@
TOP {{amount}} commands
{% elif mode == 'error_code' %}
TOP {{amount}} error codes
+ {% elif mode == 'avg_peers' %}
+ TOP {{amount}} average peer count
+ {% elif mode == 'obsfucator' %}
+ TOP {{amount}} obsfucating software
{% endif %}
{% endblock %}
@@ -23,8 +27,8 @@
â |
- {% if mode in ('software', 'avg_peers') %}Software{% elif mode == 'error_code' %}Error code{% else %}Instance{% endif %} |
- {% if mode == 'reference' %}References{% elif mode == 'avg_peers' %}Average{% elif mode in('software', 'error_code') %}Total{% else %}Blocks{% endif %} |
+ {% if mode in ('software', 'avg_peers', 'obsfucator') %}Software{% elif mode == 'error_code' %}Error code{% else %}Instance{% endif %} |
+ {% if mode == 'reference' %}References{% elif mode == 'avg_peers' %}Average{% elif mode in('software', 'error_code', 'obsfucator') %}Total{% else %}Blocks{% endif %} |
@@ -32,7 +36,7 @@
{{loop.index}} |
- {% if mode in ('software', 'command', 'error_code', 'avg_peers') %}
+ {% if mode in ('software', 'command', 'error_code', 'avg_peers', 'obsfucator') %}
{{entry['domain']}}
{% elif entry['domain'] == None %}
-
|