]> git.mxchange.org Git - fba.git/blobdiff - fba/federation.py
Continued:
[fba.git] / fba / federation.py
index e583949410a5742463c635924d52f7de2ba768bd..ec716172a13e67b5e8e2dab37eaae1d868794664 100644 (file)
@@ -77,9 +77,6 @@ def fetch_instances(domain: str, origin: str, software: str, command: str, path:
         raise ValueError(f"Parameter command[]='{type(command)}' is not 'str'")
     elif command == "":
         raise ValueError("Parameter 'command' is empty")
-    elif domain.endswith(".arpa"):
-        print(f"WARNING: domain='{domain}' is a reversed .arpa domain and should not be used generally.")
-        return
     elif not validators.domain(domain.split("/")[0]):
         raise ValueError(f"domain='{domain}' is not a valid domain")
     elif domain.endswith(".arpa"):
@@ -127,11 +124,6 @@ def fetch_instances(domain: str, origin: str, software: str, command: str, path:
         elif blacklist.is_blacklisted(instance):
             # DEBUG: print("DEBUG: instance is blacklisted:", instance)
             continue
-
-        # DEBUG: print("DEBUG: Handling instance:", instance)
-        if instance.endswith(".arpa"):
-            print(f"WARNING: instance='{instance}' is a reversed .arpa domain and should not be used generally.")
-            continue
         elif instance.find("/profile/") > 0 or instance.find("/users/") > 0:
             # DEBUG: print(f"DEBUG: instance='{instance}' is a link to a single user profile - SKIPPED!")
             continue
@@ -354,6 +346,14 @@ def fetch_wellknown_nodeinfo(domain: str) -> dict:
                     if components.scheme == "" and components.netloc == "":
                         # DEBUG: print(f"DEBUG: link[href]='{link['href']}' has no scheme and host name in it, prepending from domain='{domain}'")
                         url = f"https://{domain}{url}"
+                        components = urlparse(url)
+
+                    if blacklist.is_blacklisted(components.netloc):
+                        print(f"WARNING: components.netloc='{components.netloc}' is blacklisted - SKIPPED!")
+                        continue
+                    elif not validators.domain(components.netloc):
+                        print(f"WARNING: components.netloc='{components.netloc}' is not a valid domain - SKIPPED!")
+                        continue
 
                     # DEBUG: print("DEBUG: Fetching nodeinfo from:", url)
                     data = network.fetch_api_url(
@@ -495,13 +495,13 @@ def determine_software(domain: str, path: str = None) -> str:
     sofware = tidyup.domain(software)
     # DEBUG: print("DEBUG: sofware after tidyup.domain():", software)
 
-    if software in ["akkoma", "rebased"]:
+    if software in ["akkoma", "rebased", "akkounfucked", "ched"]:
         # DEBUG: print("DEBUG: Setting pleroma:", domain, software)
         software = "pleroma"
     elif software in ["hometown", "ecko"]:
         # DEBUG: print("DEBUG: Setting mastodon:", domain, software)
         software = "mastodon"
-    elif software in ["slipfox calckey", "calckey", "groundpolis", "foundkey", "cherrypick", "meisskey"]:
+    elif software in ["slipfox calckey", "calckey", "groundpolis", "foundkey", "cherrypick", "meisskey", "magnetar", "keybump"]:
         # DEBUG: print("DEBUG: Setting misskey:", domain, software)
         software = "misskey"
     elif software == "runtube.re":