From 26b9971de5f877c3070983725ec37c7fa65c357c Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Mon, 22 May 2023 01:57:02 +0200 Subject: [PATCH] Continued: - nicer look - tidy up software, too --- fba.py | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/fba.py b/fba.py index 6c86916..5c13864 100644 --- 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"] } -- 2.39.5