From 626516e98c8c1d0d45fc2c60ce3603c9b99ecf23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julian-Samuel=20Geb=C3=BChr?= Date: Thu, 13 Jul 2023 11:35:32 +0200 Subject: [PATCH] Don't fetch remote blocklist when merging files --- mastodon_blocklist_deploy/cli.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/mastodon_blocklist_deploy/cli.py b/mastodon_blocklist_deploy/cli.py index 07ad346..c75d598 100644 --- a/mastodon_blocklist_deploy/cli.py +++ b/mastodon_blocklist_deploy/cli.py @@ -120,12 +120,14 @@ def cli(): else: token = os.getenv('MBD_TOKEN') - """if there is a remote blocklist provided load this instead of fetching it from a server (for debugging reasons)""" - if args.remote_blocklist: - with open(args.remote_blocklist) as f: - remote_blocklist = blocklist_json_to_instances(json.load(f)) - else: - remote_blocklist = load_blocklist_from_instance(server=args.server, token=token) + """Get a remote blocklist only when necessary""" + if args.action in ["diff", "deploy"]: + """if there is a remote blocklist provided load this instead of fetching it from a server (for debugging reasons)""" + if args.remote_blocklist: + with open(args.remote_blocklist) as f: + remote_blocklist = blocklist_json_to_instances(json.load(f)) + else: + remote_blocklist = load_blocklist_from_instance(server=args.server, token=token) """Load local blocklist only when needed""" if args.action in ["diff", "deploy", "merge"]: