]> git.mxchange.org Git - fba.git/commitdiff
Continued:
authorRoland Häder <roland@mxchange.org>
Thu, 18 May 2023 02:24:10 +0000 (04:24 +0200)
committerRoland Häder <roland@mxchange.org>
Thu, 18 May 2023 02:24:41 +0000 (04:24 +0200)
- INFO level is okay here
- in the end, variable 'reason' wasn't defined

fetch_blocks.py

index 9ce27152832bd3e535714a8a8972b2092e63432d..c11710e4f1ac759ae1581cab26fb315cd4b48e6c 100644 (file)
@@ -14,7 +14,7 @@ for blocker, software in fba.c.fetchall():
     blockdict = []
     blocker = fba.tidyup(blocker)
     if software == "pleroma":
-        print("DEBUG: blocker:", blocker)
+        print("INFO: blocker:", blocker)
         try:
             # Blocks
             federation = reqto.get(
@@ -26,7 +26,9 @@ for blocker, software in fba.c.fetchall():
                     **{"quarantined_instances": federation["quarantined_instances"]}}
                 ).items():
                     for blocked in blocks:
+                        print("DEBUG: BEFORE blocked:", blocked)
                         blocked = fba.tidyup(blocked)
+                        print("DEBUG: AFTER blocked:", blocked)
 
                         if blocked == "":
                             print("WARNING: blocked is empty after fba.tidyup():", blocker, block_level)
@@ -38,15 +40,17 @@ for blocker, software in fba.c.fetchall():
                                 "SELECT domain FROM instances WHERE domain LIKE ? ORDER BY rowid LIMIT 1", (blocked.replace("*", "_"),)
                             )
                             searchres = fba.c.fetchone()
+                            print("DEBUG: searchres[]:", type(searchres))
                             if searchres != None:
                                 blocked = searchres[0]
 
+                        print("DEBUG: Looking up instance by domain:", blocked)
                         fba.c.execute(
                             "SELECT domain FROM instances WHERE domain = ?", (blocked,)
                         )
 
                         if fba.c.fetchone() == None:
-                            print("DEBUG: Hash wasn't found, adding:", blocked)
+                            print("DEBUG: Domain wasn't found, adding:", blocked)
                             fba.add_instance(blocked)
 
                         timestamp = int(time.time())
@@ -58,8 +62,9 @@ for blocker, software in fba.c.fetchall():
                                block_level
                            ),
                         )
+
                         if fba.c.fetchone() == None:
-                            fba.block_instance(blocker, blocked, reason, block_level, timestamp, timestamp)
+                            fba.block_instance(blocker, blocked, "unknown", block_level, timestamp, timestamp)
 
                             if block_level == "reject":
                                 blockdict.append(
@@ -106,7 +111,7 @@ for blocker, software in fba.c.fetchall():
         except Exception as e:
             print("error:", e, blocker, software)
     elif software == "mastodon":
-        print("DEBUG: blocker:", blocker)
+        print("INFO: blocker:", blocker)
         try:
             # json endpoint for newer mastodongs
             try:
@@ -214,7 +219,7 @@ for blocker, software in fba.c.fetchall():
         except Exception as e:
             print("error:", e, blocker, software)
     elif software == "friendica" or software == "misskey":
-        print("DEBUG: blocker:", blocker)
+        print("INFO: blocker:", blocker)
         try:
             if software == "friendica":
                 json = fba.get_friendica_blocks(blocker)
@@ -277,7 +282,7 @@ for blocker, software in fba.c.fetchall():
         except Exception as e:
             print("error:", e, blocker, software)
     elif software == "gotosocial":
-        print("DEBUG: blocker:", blocker)
+        print("INFO: blocker:", blocker)
         try:
             # Blocks
             federation = reqto.get(