try:
json = fetch_nodeinfo(domain)
+
# NOISY-DEBUG: print("DEBUG: json():", len(json))
+ software = tidyup(json["software"]["name"])
- if json["software"]["name"] in ["akkoma", "rebased"]:
- # NOISY-DEBUG: print("DEBUG: Setting pleroma:", domain, json["software"]["name"])
+ # NOISY-DEBUG: print("DEBUG: BEFORE software:", software)
+ if software in ["akkoma", "rebased"]:
+ # NOISY-DEBUG: print("DEBUG: Setting pleroma:", domain, software)
software = "pleroma"
- elif json["software"]["name"] in ["hometown", "ecko"]:
- # NOISY-DEBUG: print("DEBUG: Setting mastodon:", domain, json["software"]["name"])
+ elif software in ["hometown", "ecko"]:
+ # NOISY-DEBUG: print("DEBUG: Setting mastodon:", domain, software)
software = "mastodon"
- elif json["software"]["name"] in ["calckey", "groundpolis", "foundkey", "cherrypick"]:
- # NOISY-DEBUG: print("DEBUG: Setting misskey:", domain, json["software"]["name"])
+ elif software in ["calckey", "groundpolis", "foundkey", "cherrypick"]:
+ # NOISY-DEBUG: print("DEBUG: Setting misskey:", domain, software)
software = "misskey"
- else:
- # NOISY-DEBUG: print("DEBUG: Using name:", domain, json["software"]["name"])
- software = tidyup(json["software"]["name"].lower())
-
- if software == "":
- software = None
+ elif software.find("/") > 0:
+ print("WARNING: Spliting of path:", software)
+ software = software.split("/")[-1];
+
+ if software == "":
+ print("WARNING: tidyup() left no software name behind:", domain)
+ software = None
+ # NOISY-DEBUG: print("DEBUG: AFTER software:", software)
except:
print("WARNING: Could not determine software type:", domain)
)
for blocker, software in fba.cursor.fetchall():
- # NOISY-DEBUG: print("DEBUG: BEFORE-blocker,software:", blocker, software)
+ # NOISY-DEBUG: print("DEBUG: BEFORE blocker,software:", blocker, software)
blockdict = []
blocker = fba.tidyup(blocker)
- # NOISY-DEBUG: print("DEBUG: AFTER-blocker,software:", blocker, software)
+ # NOISY-DEBUG: print("DEBUG: AFTER blocker,software:", blocker, software)
if blocker == "":
print("WARNING: blocker is now empty!")
# handling CSRF, I've saw at least one server requiring it to access the endpoint
# NOISY-DEBUG: print("DEBUG: Fetching meta:", blocker)
meta = bs4.BeautifulSoup(
- reqto.get(f"https://{blocker}/about", headers=fba.headers, timeout=fba.(config["connection_timeout"], config["read_timeout"])).text,
+ reqto.get(f"https://{blocker}/about", headers=fba.headers, timeout=(fba.config["connection_timeout"], config["read_timeout"])).text,
"html.parser",
)
try:
reqheaders = fba.headers
# NOISY-DEBUG: print("DEBUG: Quering API domain_blocks:", blocker)
- blocks = reqto.get(f"https://{blocker}/api/v1/instance/domain_blocks", headers=reqheaders, timeout=fba.(config["connection_timeout"], config["read_timeout"])).json()
+ blocks = reqto.get(f"https://{blocker}/api/v1/instance/domain_blocks", headers=reqheaders, timeout=(fba.config["connection_timeout"], config["read_timeout"])).json()
# NOISY-DEBUG: print("DEBUG: blocks():", len(blocks))
for block in blocks:
for instance in blocks:
blocked, reason = instance.values()
- # NOISY-DEBUG: print("DEBUG: BEFORE-blocked:", blocked)
+ # NOISY-DEBUG: print("DEBUG: BEFORE blocked:", blocked)
blocked = fba.tidyup(blocked)
- # NOISY-DEBUG: print("DEBUG: AFTER-blocked:", blocked)
+ # NOISY-DEBUG: print("DEBUG: AFTER blocked:", blocked)
if blocked == "":
print("WARNING: blocked is empty:", blocker)
print("INFO: blocker:", blocker)
try:
# Blocks
- federation = reqto.get(f"https://{blocker}/api/v1/instance/peers?filter=suspended", headers=fba.headers, timeout=fba.(config["connection_timeout"], config["read_timeout"])).json()
+ federation = reqto.get(f"https://{blocker}/api/v1/instance/peers?filter=suspended", headers=fba.headers, timeout=(fba.config["connection_timeout"], config["read_timeout"])).json()
if (federation == None):
print("WARNING: No valid response:", blocker);
# NOISY-DEBUG: print("DEBUG: Checking fenderation():", len(federation))
for peer in federation:
blocked = peer["domain"].lower()
- # NOISY-DEBUG: print("DEBUG: BEFORE-blocked:", blocked)
+ # NOISY-DEBUG: print("DEBUG: BEFORE blocked:", blocked)
blocked = fba.tidyup(blocked)
- # NOISY-DEBUG: print("DEBUG: AFTER-blocked:", blocked)
+ # NOISY-DEBUG: print("DEBUG: AFTER blocked:", blocked)
if blocked == "":
print("WARNING: blocked is empty:", blocker)