]> git.mxchange.org Git - fba.git/commitdiff
Continued:
authorRoland Häder <roland@mxchange.org>
Tue, 6 Jun 2023 08:43:08 +0000 (10:43 +0200)
committerRoland Häder <roland@mxchange.org>
Tue, 6 Jun 2023 08:43:08 +0000 (10:43 +0200)
- sys.argv[0] is now always ./fba.py, so let's take the function's name
  instead

fba/commands.py
fba/fba.py
templates/scoreboard.html

index 6596045e09fa12e64975da89d73d6a61d1941de8..852b52213d7d783b043ff32091629c415fd6577e 100644 (file)
@@ -40,7 +40,7 @@ def check_instance(args: argparse.Namespace) -> int:
         status = 101
     elif fba.is_instance_registered(args.domain):
         print(f"WARNING: args.domain='{args.domain}' is already registered")
-        staus = 102
+        status = 102
     else:
         print(f"INFO: args.domain='{args.domain}' is not known")
 
@@ -92,7 +92,7 @@ def fetch_bkali(args: argparse.Namespace):
         print(f"INFO: Adding {len(domains)} new instances ...")
         for domain in domains:
             print(f"INFO: Fetching instances from domain='{domain}' ...")
-            fba.fetch_instances(domain, None, None, sys.argv[0])
+            fba.fetch_instances(domain, None, None, __name__)
 
     # DEBUG: print("DEBUG: EXIT!")
 
@@ -212,7 +212,7 @@ def fetch_blocks(args: argparse.Namespace):
                                 continue
                             elif not fba.is_instance_registered(blocked):
                                 # DEBUG: print(f"DEBUG: Domain blocked='{blocked}' wasn't found, adding ..., blocker='{blocker}',origin='{origin}',nodeinfo_url='{nodeinfo_url}'")
-                                fba.add_instance(blocked, blocker, sys.argv[0], nodeinfo_url)
+                                fba.add_instance(blocked, blocker, __name__, nodeinfo_url)
 
                             if not fba.is_instance_blocked(blocker, blocked, block_level):
                                 # DEBUG: print("DEBUG: Blocking:", blocker, blocked, block_level)
@@ -285,7 +285,7 @@ def fetch_blocks(args: argparse.Namespace):
                                 continue
                             elif not fba.is_instance_registered(blocked):
                                 # DEBUG: print(f"DEBUG: Domain blocked='{blocked}' wasn't found, adding ..., blocker='{blocker}',origin='{origin}',nodeinfo_url='{nodeinfo_url}'")
-                                fba.add_instance(blocked, blocker, sys.argv[0], nodeinfo_url)
+                                fba.add_instance(blocked, blocker, __name__, nodeinfo_url)
 
                             # DEBUG: print("DEBUG: Updating block reason:", blocker, blocked, reason["reason"])
                             fba.update_block_reason(reason["reason"], blocker, blocked, block_level)
@@ -398,7 +398,7 @@ def fetch_blocks(args: argparse.Namespace):
                                 continue
                             elif not fba.is_instance_registered(blocked):
                                 # DEBUG: print(f"DEBUG: Domain blocked='{blocked}' wasn't found, adding ..., blocker='{blocker}',origin='{origin}',nodeinfo_url='{nodeinfo_url}'")
-                                fba.add_instance(blocked, blocker, sys.argv[0], nodeinfo_url)
+                                fba.add_instance(blocked, blocker, __name__, nodeinfo_url)
                         elif not validators.domain(blocked):
                             print(f"WARNING: blocked='{blocked}',software='{software}' is not a valid domain name - skipped!")
                             continue
@@ -409,7 +409,7 @@ def fetch_blocks(args: argparse.Namespace):
                             continue
                         elif not fba.is_instance_registered(blocked):
                             # DEBUG: print("DEBUG: Hash wasn't found, adding:", blocked, blocker)
-                            fba.add_instance(blocked, blocker, sys.argv[0], nodeinfo_url)
+                            fba.add_instance(blocked, blocker, __name__, nodeinfo_url)
 
                         blocking = blocked if blocked.count("*") <= 1 else blocked_hash
                         # DEBUG: print(f"DEBUG: blocking='{blocking}',blocked='{blocked}',blocked_hash='{blocked_hash}'")
@@ -510,7 +510,7 @@ def fetch_blocks(args: argparse.Namespace):
                             continue
                         elif not fba.is_instance_registered(blocked):
                             # DEBUG: print("DEBUG: Hash wasn't found, adding:", blocked, blocker)
-                            fba.add_instance(blocked, blocker, sys.argv[0], nodeinfo_url)
+                            fba.add_instance(blocked, blocker, __name__, nodeinfo_url)
 
                         if not fba.is_instance_blocked(blocker, blocked, block_level):
                             fba.block_instance(blocker, blocked, reason, block_level)
@@ -577,7 +577,7 @@ def fetch_blocks(args: argparse.Namespace):
                             continue
                         elif not fba.is_instance_registered(blocked):
                             # DEBUG: print(f"DEBUG: Domain blocked='{blocked}' wasn't found, adding ..., blocker='{blocker}',origin='{origin}',nodeinfo_url='{nodeinfo_url}'")
-                            fba.add_instance(blocked, blocker, sys.argv[0], nodeinfo_url)
+                            fba.add_instance(blocked, blocker, __name__, nodeinfo_url)
 
                         if not fba.is_instance_blocked(blocker, blocked, "reject"):
                             # DEBUG: print(f"DEBUG: blocker='{blocker}' is blocking '{blocked}' for unknown reason at this point")
@@ -652,7 +652,7 @@ def fetch_cs(args: argparse.Namespace):
                 # DEBUG: print(f"DEBUG: row='{row}'")
                 if not fba.is_instance_registered(row["domain"]):
                     print(f"INFO: Fetching instances from domain='{row['domain']}' ...")
-                    fba.fetch_instances(row["domain"], None, None, sys.argv[0])
+                    fba.fetch_instances(row["domain"], None, None, __name__)
 
                 if not fba.is_instance_blocked('chaos.social', row["domain"], block_level):
                     # DEBUG: print(f"DEBUG: domain='{row['domain']}',block_level='{block_level}' blocked by chaos.social, adding ...")
@@ -705,7 +705,7 @@ def fetch_fba_rss(args: argparse.Namespace):
         print(f"INFO: Adding {len(domains)} new instances ...")
         for domain in domains:
             print(f"INFO: Fetching instances from domain='{domain}' ...")
-            fba.fetch_instances(domain, None, None, sys.argv[0])
+            fba.fetch_instances(domain, None, None, __name__)
 
     # DEBUG: print("DEBUG: EXIT!")
 
@@ -758,7 +758,7 @@ def fetch_fbabot_atom(args: argparse.Namespace):
         print(f"INFO: Adding {len(domains)} new instances ...")
         for domain in domains:
             print(f"INFO: Fetching instances from domain='{domain}' ...")
-            fba.fetch_instances(domain, None, None, sys.argv[0])
+            fba.fetch_instances(domain, None, None, __name__)
 
     # DEBUG: print("DEBUG: EXIT!")
 
@@ -767,7 +767,7 @@ def fetch_instances(args: argparse.Namespace):
     boot.acquire_lock()
 
     # Initial fetch
-    fba.fetch_instances(args.domain, None, None, sys.argv[0])
+    fba.fetch_instances(args.domain, None, None, __name__)
 
     if args.single:
         # DEBUG: print(f"DEBUG: Not fetching more instances - EXIT!")
@@ -787,6 +787,6 @@ def fetch_instances(args: argparse.Namespace):
             continue
 
         print(f"INFO: Fetching instances for instance '{row[0]}' ('{row[2]}') of origin='{row[1]}',nodeinfo_url='{row[3]}'")
-        fba.fetch_instances(row[0], row[1], row[2], sys.argv[0], row[3])
+        fba.fetch_instances(row[0], row[1], row[2], __name__, row[3])
 
     # DEBUG: print("DEBUG: EXIT!")
index ba1b52f4f4d2da0c83b73ecced070cdd1ae48044..640f9fd2d75a9253d14b7d5c3e67b23abc722174 100644 (file)
@@ -177,7 +177,7 @@ def fetch_instances(domain: str, origin: str, software: str, script: str, path:
         try:
             if not is_instance_registered(instance):
                 # DEBUG: print("DEBUG: Adding new instance:", instance, domain)
-                add_instance(instance, domain, sys.argv[0])
+                add_instance(instance, domain, script)
         except BaseException as e:
             print(f"ERROR: instance='{instance}',exception[{type(e)}]:'{str(e)}'")
             continue
index 008051802b1661a27263865f61e6bd57c0b524c6..23707ac7f9d7cc08206645c6d35b0ef1d746650c 100644 (file)
@@ -9,9 +9,6 @@
             text-align: center;
             font-family: sans;
         }
-        pre {
-            margin: 0px;
-        }
         .block_level {
             background-color: #1c1c3c;
             width: 80em;
                         {% if software %}
                             {{entry['domain']}}
                         {% elif originator %}
-                            <pre>{{entry['domain']}}</pre>
+                            {{entry['domain']}}
                         {% elif entry['domain'] == None %}
                             -
                         {% else %}