)
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():
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))
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]