]> git.mxchange.org Git - fba.git/commitdiff
Continued:
authorRoland Häder <roland@mxchange.org>
Sun, 21 May 2023 23:57:02 +0000 (01:57 +0200)
committerRoland Häder <roland@mxchange.org>
Sun, 21 May 2023 23:59:15 +0000 (01:59 +0200)
- nicer look
- tidy up software, too

fba.py

diff --git a/fba.py b/fba.py
index 6c86916a6ee92ad1e3e6ffcf8af26be8ebb0a925..5c13864fb18bef5d90002718f5ca8f0ae40ca32b 100644 (file)
--- a/fba.py
+++ b/fba.py
@@ -179,8 +179,10 @@ def determine_software(domain: str) -> str:
             software = "misskey"
         else:
             # NOISY-DEBUG: print("DEBUG: Using name:", domain, json["software"]["name"])
-            software = json["software"]["name"].lower()
+            software = tidyup(json["software"]["name"].lower())
 
+            if software == "":
+                software = None
     except:
         print("WARNING: Could not determine software type:", domain)
 
@@ -412,19 +414,19 @@ def get_misskey_blocks(domain: str) -> dict:
                 if counter == 0:
                     # NOISY-DEBUG: print("DEBUG: Sending JSON API request to domain,step,counter:", domain, step, counter)
                     doc = post_json_api(domain, "/api/federation/instances/", json.dumps({
-                        "sort": "+caughtAt",
-                        "host": None,
+                        "sort"     : "+caughtAt",
+                        "host"     : None,
                         "suspended": True,
-                        "limit": step
+                        "limit"    : step
                     }))
                 else:
                     # NOISY-DEBUG: print("DEBUG: Sending JSON API request to domain,step,counter:", domain, step, counter)
                     doc = post_json_api(domain, "/api/federation/instances/", json.dumps({
-                        "sort": "+caughtAt",
-                        "host": None,
+                        "sort"     : "+caughtAt",
+                        "host"     : None,
                         "suspended": True,
-                        "limit": step,
-                        "offset": counter-1
+                        "limit"    : step,
+                        "offset"   : counter-1
                     }))
 
                 # NOISY-DEBUG: print("DEBUG: doc():", len(doc))
@@ -461,19 +463,19 @@ def get_misskey_blocks(domain: str) -> dict:
                 if counter == 0:
                     # NOISY-DEBUG: print("DEBUG: Sending JSON API request to domain,step,counter:", domain, step, counter)
                     doc = post_json_api(domain,"/api/federation/instances", json.dumps({
-                        "sort": "+caughtAt",
-                        "host": None,
+                        "sort"   : "+caughtAt",
+                        "host"   : None,
                         "blocked": True,
-                        "limit": step
+                        "limit"  : step
                     }))
                 else:
                     # NOISY-DEBUG: print("DEBUG: Sending JSON API request to domain,step,counter:", domain, step, counter)
                     doc = post_json_api(domain,"/api/federation/instances", json.dumps({
-                        "sort": "+caughtAt",
-                        "host": None,
+                        "sort"   : "+caughtAt",
+                        "host"   : None,
                         "blocked": True,
-                        "limit": step,
-                        "offset": counter-1
+                        "limit"  : step,
+                        "offset" : counter-1
                     }))
 
                 # NOISY-DEBUG: print("DEBUG: doc():", len(doc))
@@ -501,7 +503,7 @@ def get_misskey_blocks(domain: str) -> dict:
 
         # NOISY-DEBUG: print("DEBUG: Returning for domain,blocked(),suspended():", domain, len(blocks["blocked"]), len(blocks["suspended"]))
         return {
-            "reject": blocks["blocked"],
+            "reject"        : blocks["blocked"],
             "followers_only": blocks["suspended"]
         }