]> git.mxchange.org Git - fba.git/commitdiff
Continued:
authorRoland Häder <roland@mxchange.org>
Mon, 12 Jun 2023 10:38:53 +0000 (12:38 +0200)
committerRoland Häder <roland@mxchange.org>
Mon, 12 Jun 2023 10:38:53 +0000 (12:38 +0200)
- tpzo fixed in function name
- also re-check with domain if hash wasn't found
- 'runtube.re' aliased to 'peertube'

fba/commands.py
fba/federation.py
fba/instances.py
fba/networks/mastodon.py
fba/networks/pleroma.py

index 96018e9d9803b86550f6736e86ebbc659b999d56..07db1af6898b3a0283112514d2e6065f478ecb9a 100644 (file)
@@ -210,7 +210,7 @@ def fetch_blocks(args: argparse.Namespace):
                         continue
                     elif blocked.count("*") > 0:
                         # Some friendica servers also obscure domains without hash
-                        row = instances.deobsure("*", blocked)
+                        row = instances.deobscure("*", blocked)
 
                         # DEBUG: print(f"DEBUG: row[]='{type(row)}'")
                         if row is None:
@@ -222,7 +222,7 @@ def fetch_blocks(args: argparse.Namespace):
                         nodeinfo_url = row[2]
                     elif blocked.count("?") > 0:
                         # Some obscure them with question marks, not sure if that's dependent on version or not
-                        row = instances.deobsure("?", blocked)
+                        row = instances.deobscure("?", blocked)
 
                         # DEBUG: print(f"DEBUG: row[]='{type(row)}'")
                         if row is None:
@@ -553,8 +553,8 @@ def fetch_oliphant(args: argparse.Namespace):
                     continue
 
                 if domain.find("*") > 0:
-                   # Try to de-obsure it
-                   row = instances.deobsure("*", domain)
+                   # Try to de-obscure it
+                   row = instances.deobscure("*", domain)
 
                    # DEBUG: print(f"DEBUG: row[{type(row)}]='{row}'")
                    if row is None:
index 80d7a71e7a4aa424d942e384490778b4cbdb8a05..549f8a2ecb1c4a9664b2df9e7d7ecbb7ba35a97e 100644 (file)
@@ -426,6 +426,9 @@ def determine_software(domain: str, path: str = None) -> str:
     elif software in ["calckey", "groundpolis", "foundkey", "cherrypick", "meisskey"]:
         # DEBUG: print("DEBUG: Setting misskey:", domain, software)
         software = "misskey"
+    elif software == "runtube.re":
+        # DEBUG: print("DEBUG: Setting peertube:", domain, software)
+        software = "peertube"
     elif software.find("/") > 0:
         print("WARNING: Spliting of slash:", software)
         software = tidyup.domain(software.split("/")[-1])
index 4cccb3770c307d059649369dda3b2f28afca4ff1..aa912e0d865635f38e84e83e306097c89fd57628 100644 (file)
@@ -337,7 +337,7 @@ def is_recent(domain: str) -> bool:
     # DEBUG: print(f"DEBUG: recently='{recently}' - EXIT!")
     return recently
 
-def deobsure(char: str, domain: str, blocked_hash: str = None) -> tuple:
+def deobscure(char: str, domain: str, blocked_hash: str = None) -> tuple:
     #print(f"DEBUG: char='{char}',domain='{domain}',blocked_hash='{blocked_hash}' - CALLED!")
     if not isinstance(char, str):
         raise ValueError(f"Parameter char[]='{type(char)}' is not 'str'")
@@ -354,6 +354,10 @@ def deobsure(char: str, domain: str, blocked_hash: str = None) -> tuple:
         fba.cursor.execute(
             "SELECT domain, origin, nodeinfo_url FROM instances WHERE hash = ? LIMIT 1", [blocked_hash]
         )
+
+        if fba.cursor.fetchone() is None:
+            #print(f"DEBUG: blocked_hash='{blocked_hash}' not found, trying domain='{domain}' ...")
+            return deobscure(char, domain)
     else:
         fba.cursor.execute(
             "SELECT domain, origin, nodeinfo_url FROM instances WHERE domain LIKE ? ORDER BY rowid LIMIT 1", [domain.replace(char, "_")]
index ae5ea0ce26e45e3f6ca8d81457e8ea040a9ed8bc..ef580fb484f9b94b9e5af058bc93d03158ca65ad 100644 (file)
@@ -242,7 +242,7 @@ def fetch_blocks(domain: str, origin: str, nodeinfo_url: str):
                     continue
                 elif blocked.count("*") > 0:
                     # Doing the hash search for instance names as well to tidy up DB
-                    row = instances.deobsure("*", blocked, blocked_hash)
+                    row = instances.deobscure("*", blocked, blocked_hash)
 
                     # DEBUG: print(f"DEBUG: row[]='{type(row)}'")
                     if row is None:
index f9701473c27530f0ae47d25412bb69aaa7709af7..be7a84089571146f60c7d89032cd7dc3b6e38b18 100644 (file)
@@ -96,8 +96,8 @@ def fetch_blocks(domain: str, origin: str, nodeinfo_url: str):
                         # DEBUG: print(f"DEBUG: blocked='{blocked}' is blacklisted - skipping!")
                         continue
                     elif blocked.count("*") > 0:
-                        # Obsured domain name with no hash
-                        row = instances.deobsure("*", blocked)
+                        # Obscured domain name with no hash
+                        row = instances.deobscure("*", blocked)
 
                         # DEBUG: print(f"DEBUG: row[]='{type(row)}'")
                         if row is None:
@@ -180,8 +180,8 @@ def fetch_blocks(domain: str, origin: str, nodeinfo_url: str):
                     # DEBUG: print(f"DEBUG: blocked='{blocked}' is blacklisted - skipping!")
                     continue
                 elif blocked.count("*") > 0:
-                    # Obsured domain name with no hash
-                    row = instances.deobsure("*", blocked)
+                    # Obscured domain name with no hash
+                    row = instances.deobscure("*", blocked)
 
                     # DEBUG: print(f"DEBUG: row[]='{type(row)}'")
                     if row is None: