]> git.mxchange.org Git - fba.git/blobdiff - daemon.py
Continued:
[fba.git] / daemon.py
index eb36051cf3c5fb9ad43ace00e7f00991e5c7697f..472b0bed1d842a0174bb23ab013db4734f6ba267 100755 (executable)
--- a/daemon.py
+++ b/daemon.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python3
+#!venv/bin/python3
 # -*- coding: utf-8 -*-
 
 # Fedi API Block - An aggregator for fetching blocking data from fediverse nodes
@@ -56,16 +56,18 @@ templates = Jinja2Templates(directory="templates")
 
 @router.get(config.get("base_url") + "/api/info.json", response_class=JSONResponse)
 def api_info():
-    database.cursor.execute("SELECT (SELECT COUNT(domain) FROM instances), (SELECT COUNT(domain) FROM instances WHERE software IN ('pleroma', 'mastodon', 'lemmy', 'friendica', 'misskey', 'peertube', 'takahe', 'gotosocial', 'brighteon', 'wildebeest', 'bookwyrm', 'mitra', 'areionskey', 'mammuthus', 'neodb', 'smithereen', 'vebinet')), (SELECT COUNT(blocker) FROM blocks), (SELECT COUNT(domain) FROM instances WHERE last_error_details IS NOT NULL)")
+    database.cursor.execute("SELECT (SELECT COUNT(domain) FROM instances) AS total_websites, (SELECT COUNT(domain) FROM instances WHERE software IN ('pleroma', 'mastodon', 'lemmy', 'friendica', 'misskey', 'peertube', 'takahe', 'gotosocial', 'brighteon', 'wildebeest', 'bookwyrm', 'mitra', 'areionskey', 'mammuthus', 'neodb', 'smithereen', 'vebinet', 'hugo', 'toki', 'snac')) AS supported_instances, (SELECT COUNT(blocker) FROM blocks) AS total_blocks, (SELECT COUNT(domain) FROM instances WHERE last_error_details IS NOT NULL) AS erroneous_instances")
+
     row = database.cursor.fetchone()
 
     return JSONResponse(status_code=200, content={
-        "known_instances"    : row[0],
-        "supported_instances": row[1],
-        "blocks_recorded"    : row[2],
-        "erroneous_instances": row[3],
+        "total_websites"     : row["total_websites"],
+        "supported_instances": row["supported_instances"],
+        "total_blocks"       : row["total_blocks"],
+        "erroneous_instances": row["erroneous_instances"],
     })
 
+
 @router.get(config.get("base_url") + "/api/scoreboard.json", response_class=JSONResponse)
 def api_scoreboard(mode: str, amount: int):
     if amount > config.get("api_limit"):