)
parser.add_argument("--domain", help="Instance name (aka. domain)")
parser.add_argument("--software", help="Name of software, e.g. 'lemmy'")
+ parser.add_argument("--all", action="store_true", help="Include also already existing instances, otherwise only new are checked")
parser.set_defaults(command=commands.recheck_obfuscation)
### Fetch blocks from registered instances or given ###
else:
logger.warning("Unknown software: blocker='%s',software='%s'", blocker, software)
+ logger.debug("Invoking instances.set_total_blocks(%s, %d) ...", blocker, len(blocking))
+ instances.set_total_blocks(blocker, blocking)
+
logger.info("Checking %d entries from blocker='%s',software='%s' ...", len(blocking), blocker, software)
blockdict = list()
for block in blocking:
logger.info("Checking %d domains ...", len(rows))
for row in rows:
logger.debug("Fetching peers from domain='%s',software='%s',nodeinfo_url='%s' ...", row["domain"], row["software"], row["nodeinfo_url"])
+ if (args.all is None or not args.all) and instances.is_recent(row["domain"]) and args.domain is None and args.software is None:
+ logger.debug("row[domain]='%s' has been recently checked, args.all[]='%s' - SKIPPED!", row["domain"], type(args.all))
+ continue
blocking = list()
if row["software"] == "pleroma":
else:
logger.warning("Unknown sofware: domain='%s',software='%s'", row["domain"], row["software"])
+ logger.debug("Invoking instances.set_total_blocks(%s, %d) ...", row["domain"], len(blocking))
+ instances.set_total_blocks(row["domain"], blocking)
+
logger.info("Checking %d block(s) from domain='%s' ...", len(blocking), row["domain"])
obfuscated = 0
blockdict = list()
elif not utils.is_domain_wanted(domain):
logger.warning("domain='%s' is not wanted - SKIPPED!", domain)
continue
- elif args.all is None or not args.all and instances.is_registered(domain):
+ elif (args.all is None or not args.all) and instances.is_registered(domain):
logger.debug("domain='%s' is already registered, --all not specified: args.all[]='%s'", type(args.all))
continue
elif instances.is_recent(domain):
"nodeinfo_url" : {},
# Found total peers
"total_peers" : {},
+ # Found total blocks
+ "total_blocks" : {},
# Last fetched instances
"last_instance_fetch": {},
# Last updated
_set_data("total_peers", domain, len(peers))
logger.debug("EXIT!")
+def set_total_blocks(domain: str, blocks: list):
+ logger.debug("domain='%s',blocks()=%d - CALLED!", domain, len(blocks))
+ domain_helper.raise_on(domain)
+
+ if not isinstance(blocks, list):
+ raise ValueError(f"Parameter blocks[]='{type(blocks)}' is not 'list'")
+
+ # Set timestamp
+ _set_data("total_blocks", domain, len(blocks))
+ logger.debug("EXIT!")
+
def set_nodeinfo_url(domain: str, url: str):
logger.debug("domain='%s',url='%s' - CALLED!", domain, url)
domain_helper.raise_on(domain)