]> git.mxchange.org Git - fba.git/commitdiff
Continued:
authorRoland Häder <roland@mxchange.org>
Mon, 24 Jul 2023 12:53:53 +0000 (14:53 +0200)
committerRoland Häder <roland@mxchange.org>
Mon, 24 Jul 2023 12:53:53 +0000 (14:53 +0200)
- custom aoderelay name aliased

fba/boot.py
fba/commands.py
fba/helpers/software.py

index 6d0182ab323d29c0b544d3befc81ac245466e3ee..7bd816aab3d8399723007ef4f6aee704c3e5fb7a 100644 (file)
@@ -213,6 +213,13 @@ def init_parser():
     )
     parser.set_defaults(command=commands.convert_idna)
 
+    ### Fetch instances from ActivityPub relays ###
+    parser = subparser_command.add_parser(
+        "fetch_relays",
+        help="Fetches instances from ActivityPub relays",
+    )
+    parser.set_defaults(command=commands.fetch_relays)
+
     logger.debug("EXIT!")
 
 def run_command():
index 359d9c2b82553b8847f9e58dd64dc5dfae2eff4b..d94966f7f00d60f41571ae31f75e6065af56f155 100644 (file)
@@ -1784,6 +1784,21 @@ def fetch_instances_social(args: argparse.Namespace) -> int:
     logger.debug("Success! - EXIT!")
     return 0
 
+def fetch_relays(args: argparse.Namespace) -> int:
+    logger.debug("args[]='%s' - CALLED!", type(args))
+
+    database.cursor.execute("SELECT domain, software FROM instances WHERE software IN ('activityrelay', 'aoderelay', 'selective-relay')")
+
+    domains = list()
+
+    rows = database.cursor.fetchall()
+    logger.info("Checking %d relays ...", len(rows))
+    for row in rows:
+        logger.debug("Fetching peers from row[domain]='%s',row[software]='%s' ...", row["domain"], row["software"])
+
+    logger.debug("Success! - EXIT!")
+    return 0
+
 def convert_idna(args: argparse.Namespace) -> int:
     logger.debug("args[]='%s' - CALLED!", type(args))
 
index 68826081611e04fc26a6f2e44bd2ee45277aaa4c..cf9366b6b5de4d58247dce9730aac5f00d176747 100644 (file)
@@ -67,6 +67,9 @@ def alias(software: str) -> str:
     elif software == "diaspora* social network":
         logger.debug("Setting diaspora: software='%s'", software)
         software = "diaspora"
+    elif software == "tkz relay":
+        logger.debug("Setting aoderelay: software='%s'", software)
+        software = "aoderelay"
     elif software.find("/") > 0:
         logger.warning("Spliting of slash: software='%s'", software)
         software = software.split("/")[-1]