From d79991c40eaaa57810841bcc79c2afa7f815649e Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Wed, 7 Aug 2024 07:13:29 +0200 Subject: [PATCH] Continued: - --force is ambicious as now "other forces" will be added --- fba/boot.py | 16 ++++++++-------- fba/commands.py | 24 ++++++++++++------------ 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/fba/boot.py b/fba/boot.py index c66b2ac..7adf5e3 100644 --- a/fba/boot.py +++ b/fba/boot.py @@ -36,7 +36,7 @@ def init_parser(): logger.debug("Initializing parser ...") _PARSER = argparse.ArgumentParser( description="Fetches block reasons from the fediverse", - epilog="Please note that some commands have optional arguments, you may want to try fba.py --help to find them out. Please DO NOT overdose requests that are not limited by themselves. Typically parameters like --domain, --software and --force are unlimited. \"Unlimited\" here means that there is no \"is recently accessed?\" limitation.", + epilog="Please note that some commands have optional arguments, you may want to try fba.py --help to find them out. Please DO NOT overdose requests that are not limited by themselves. Typically parameters like --domain, --software and --force-all are unlimited. \"Unlimited\" here means that there is no \"is recently accessed?\" limitation.", ) # Generic: @@ -79,7 +79,7 @@ def init_parser(): parser.set_defaults(command=commands.recheck_obfuscation) parser.add_argument("--domain", help="Instance name (aka. domain)") parser.add_argument("--software", help="Name of software, e.g. 'lemmy'") - parser.add_argument("--force", action="store_true", help="Include also already existing instances, otherwise only new are checked") + parser.add_argument("--force-all", action="store_true", help="Include also already existing instances, otherwise only new are checked") parser.add_argument("--delete-unwanted", action="store_true", help="Whether delete or keep (default) unwanted domains") parser.add_argument("--no-obfuscation", action="store_true", help="Check instances with no obfuscation of blocked instances") @@ -92,7 +92,7 @@ def init_parser(): parser.add_argument("--domain", help="Instance name (aka. domain)") parser.add_argument("--software", help="Name of software, e.g. 'lemmy'") parser.add_argument("--only-none", action="store_true", help="Checks only entries which has never been checked.") - parser.add_argument("--force", action="store_true", help="Forces update of data, no matter what.") + parser.add_argument("--force-all", action="store_true", help="Forces update of data, no matter what.") ### Fetch blocks from chaos.social ### parser = subparser_command.add_parser( @@ -147,7 +147,7 @@ def init_parser(): ) parser.set_defaults(command=commands.fetch_instances) parser.add_argument("--domain", help="Instance name (aka. domain) to fetch further instances from. Start with a large instance, e.g. mastodon.social .") - parser.add_argument("--force", action="store_true", help="Include also already existing instances, otherwise only new are checked") + parser.add_argument("--force-all", action="store_true", help="Include also already existing instances, otherwise only new are checked") parser.add_argument("--single", action="store_true", help="Only fetch given instance.") parser.add_argument("--software", help="Name of software, e.g. 'lemmy'") @@ -157,7 +157,7 @@ def init_parser(): help="Fetches text/plain files as simple domain lists", ) parser.set_defaults(command=commands.fetch_txt) - parser.add_argument("--force", action="store_true", help="Forces update of data, no matter what.") + parser.add_argument("--force-all", action="store_true", help="Forces update of data, no matter what.") ### Fetch blocks from joinfediverse.wiki ### #parser = subparser_command.add_parser( @@ -216,7 +216,7 @@ def init_parser(): ) parser.set_defaults(command=commands.fetch_fedilist) parser.add_argument("--software", help="Name of software, e.g. 'lemmy'") - parser.add_argument("--force", action="store_true", help="Include also already existing instances, otherwise only new are checked") + parser.add_argument("--force-all", action="store_true", help="Include also already existing instances, otherwise only new are checked") ### Update nodeinfo ### parser = subparser_command.add_parser( @@ -227,7 +227,7 @@ def init_parser(): parser.add_argument("--domain", help="Instance name (aka. domain)") parser.add_argument("--software", help="Name of software, e.g. 'lemmy'") parser.add_argument("--mode", help="Name of detection mode, e.g. 'auto_discovery'") - parser.add_argument("--force", action="store_true", help="Forces update of data, no matter what.") + parser.add_argument("--force-all", action="store_true", help="Forces update of data, no matter what.") parser.add_argument("--no-software", action="store_true", help="Checks only entries with no software type detected.") parser.add_argument("--no-auto", action="store_true", help="Checks only entries with other than AUTO_DISCOVERY as detection mode.") parser.add_argument("--no-detection", action="store_true", help="Checks only entries with no detection mode set.") @@ -256,7 +256,7 @@ def init_parser(): parser.set_defaults(command=commands.fetch_relays) parser.add_argument("--domain", help="Instance name (aka. 'relay')") parser.add_argument("--software", help="Name of software, e.g. 'lemmy'") - parser.add_argument("--force", action="store_true", help="Forces update of data, no matter what.") + parser.add_argument("--force-all", action="store_true", help="Forces update of data, no matter what.") ### Fetches relay list from relaylist.com parser = subparser_command.add_parser( diff --git a/fba/commands.py b/fba/commands.py index 8715061..b95f044 100644 --- a/fba/commands.py +++ b/fba/commands.py @@ -314,7 +314,7 @@ def fetch_blocks(args: argparse.Namespace) -> int: if not domain_helper.is_wanted(blocker): logger.warning("blocker='%s' is not wanted - SKIPPED!", blocker) continue - elif not args.force and instances.is_recent(blocker, "last_blocked"): + elif not args.force_all and instances.is_recent(blocker, "last_blocked"): logger.debug("blocker='%s' has recently been crawled - SKIPPED!", blocker) continue elif software is None: @@ -1024,12 +1024,12 @@ def fetch_instances(args: argparse.Namespace) -> int: for row in rows: logger.debug("row[domain]='%s',row[origin]='%s',row[software]='%s'", row["domain"], row["origin"], row["software"]) if row["software"] is None and instances.is_registered(row["domain"]) : - logger.warning("row[domain]='%s' has no software detected. You can try to run ./fba.py update_nodeinfo --domain=%s --force to get it updated - SKIPPED!", row["domain"], row["domain"]) + logger.warning("row[domain]='%s' has no software detected. You can try to run ./fba.py update_nodeinfo --domain=%s --force-all to get it updated - SKIPPED!", row["domain"], row["domain"]) continue elif row["software"] is not None and software_helper.is_relay(row["software"]) and instances.is_registered(row["domain"]): logger.warning("row[domain]='%s' is of software type '%s' which is not supported by this command. Please invoke fetch_relays instead - SKIPPED!", row["domain"], row["software"]) continue - elif not args.force and not args.software in [None, ""] and instances.is_recent(row["domain"]): + elif not args.force_all and not args.software in [None, ""] and instances.is_recent(row["domain"]): logger.debug("row[domain]='%s' has recently been crawled - SKIPPED!", row["domain"]) continue @@ -1162,12 +1162,12 @@ def fetch_txt(args: argparse.Namespace) -> int: elif not domain_helper.is_wanted(domain): logger.debug("domain='%s' is not wanted - SKIPPED!", domain) continue - elif not args.force and instances.is_registered(domain): + elif not args.force_all and instances.is_registered(domain): logger.debug("domain='%s' is already registered - SKIPPED!", domain) continue logger.debug("Processing domain='%s',row[blocker]='%s' ...", domain, row["blocker"]) - processed = processing.instance(domain, row["blocker"], inspect.currentframe().f_code.co_name, force=args.force) + processed = processing.instance(domain, row["blocker"], inspect.currentframe().f_code.co_name, force=args.force_all) logger.debug("processed='%s'", processed) logger.debug("Success! - EXIT!") @@ -1367,8 +1367,8 @@ def recheck_obfuscation(args: argparse.Namespace) -> int: elif blacklist.is_blacklisted(row["domain"]): logger.warning("row[domain]='%s' is blacklisted - SKIPPED!", row["domain"]) continue - elif (args.force is None or not args.force) and args.domain is None and args.software is None and instances.is_recent(row["domain"], "last_blocked"): - logger.debug("row[domain]='%s' has recently been checked, args.force[]='%s' - SKIPPED!", row["domain"], type(args.force)) + elif (args.force_all is None or not args.force_all) and args.domain is None and args.software is None and instances.is_recent(row["domain"], "last_blocked"): + logger.debug("row[domain]='%s' has recently been checked, args.force_all[]='%s' - SKIPPED!", row["domain"], type(args.force_all)) continue logger.debug("Invoking federation.fetch_blocks(%s) ...", row["domain"]) @@ -1545,8 +1545,8 @@ def fetch_fedilist(args: argparse.Namespace) -> int: if not domain_helper.is_wanted(domain): logger.debug("domain='%s' is not wanted - SKIPPED!", domain) continue - elif (args.force is None or not args.force) and instances.is_registered(domain): - logger.debug("domain='%s' is already registered, --force not specified: args.force[]='%s'", domain, type(args.force)) + elif (args.force_all is None or not args.force_all) and instances.is_registered(domain): + logger.debug("domain='%s' is already registered, --force-all not specified: args.force_all[]='%s'", domain, type(args.force_all)) continue elif instances.is_recent(domain): logger.debug("domain='%s' has recently been crawled - SKIPPED!", domain) @@ -1613,7 +1613,7 @@ def update_nodeinfo(args: argparse.Namespace) -> int: elif blacklist.is_blacklisted(row["domain"]): logger.debug("row[domain]='%s' is blacklisted - SKIPPED!", row["domain"]) continue - elif not args.force and instances.is_recent(row["domain"], "last_nodeinfo"): + elif not args.force_all and instances.is_recent(row["domain"], "last_nodeinfo"): logger.debug("row[domain]='%s' has recently been checked - SKIPPED!", row["domain"]) continue @@ -1622,7 +1622,7 @@ def update_nodeinfo(args: argparse.Namespace) -> int: software = federation.determine_software(row["domain"]) logger.debug("Determined software='%s'", software) - if (software != row["software"] and software is not None) or args.force is True: + if (software != row["software"] and software is not None) or args.force_all is True: logger.debug("software='%s'", software) if software is None: logger.debug("Setting nodeinfo_url to 'None' for row[domain]='%s' ...", row["domain"]) @@ -1816,7 +1816,7 @@ def fetch_relays(args: argparse.Namespace) -> int: logger.info("Checking %d relays ...", len(rows)) for row in rows: logger.debug("row[domain]='%s',row[software]='%s'", row["domain"], row["software"]) - if not args.force and instances.is_recent(row["domain"]): + if not args.force_all and instances.is_recent(row["domain"]): logger.debug("row[domain]='%s' has recently been fetched - SKIPPED!", row["domain"]) continue elif row["nodeinfo_url"] is None: -- 2.39.5