]> git.mxchange.org Git - fba.git/blobdiff - api.py
Continued:
[fba.git] / api.py
diff --git a/api.py b/api.py
index 3c03c6f32f686081dd05c64661d5c6fe7e3b46f7..60d0c5774fe3e1361a84662d508e65f6aa20725b 100644 (file)
--- a/api.py
+++ b/api.py
@@ -73,6 +73,8 @@ def api_scoreboard(mode: str, amount: int):
         database.cursor.execute("SELECT software, AVG(total_peers) AS average FROM instances WHERE software IS NOT NULL GROUP BY software HAVING average>0 ORDER BY average DESC LIMIT ?", [amount])
     elif mode == "obsfucator":
         database.cursor.execute("SELECT software, COUNT(domain) AS cnt FROM instances WHERE has_obsfucation = 1 GROUP BY software ORDER BY cnt DESC LIMIT ?", [amount])
+    elif mode == "obsfucation":
+        database.cursor.execute("SELECT has_obsfucation, COUNT(domain) AS cnt FROM instances WHERE software IN ('pleroma', 'mastodon') GROUP BY has_obsfucation ORDER BY cnt DESC LIMIT ?", [amount])
     else:
         raise HTTPException(status_code=400, detail="No filter specified")
 
@@ -181,6 +183,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=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}")
+    elif mode == "obsfucation" and amount > 0:
+        response = requests.get(f"http://{config.get('host')}:{config.get('port')}{config.get('base_url')}/api/scoreboard.json?mode=obsfucation&amount={amount}")
     else:
         raise HTTPException(status_code=400, detail="No filter specified")