From 66899c8226a3d51eca753ea87ebace0f74d7b857 Mon Sep 17 00:00:00 2001 From: Lynne Date: Fri, 11 Jan 2019 23:08:53 +1000 Subject: [PATCH] added instance blacklist --- main.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/main.py b/main.py index 3a82ece..6d3e921 100755 --- a/main.py +++ b/main.py @@ -14,11 +14,16 @@ import functions scopes = ["read:statuses", "read:accounts", "read:follows", "write:statuses", "read:notifications"] cfg = json.load(open('config.json', 'r')) -#config.json *MUST* contain the instance URL, and the CW text. if they're not provided, we'll fall back to defaults. +#config.json *MUST* contain the instance URL, the instance blacklist (for dead/broken instances), and the CW text. if they're not provided, we'll fall back to defaults. if 'site' not in cfg: cfg['website'] = "https://botsin.space" if 'cw' not in cfg: cfg['cw'] = None +if 'instance_blacklist' not in cfg: + cfg["instance_blacklist"] = [ + "bofa.lol", + "witches.town" + ] #if the user is using a (very!) old version that still uses the .secret files, migrate to the new method if os.path.exists("clientcred.secret"): @@ -99,8 +104,8 @@ for f in following: else: instance = instance.group(1) - if instance == "bofa.lol": - print("rest in piece bofa, skipping") + if instance in cfg['instance_blacklist']: + print("skipping blacklisted instance: {}".format(instance)) continue try: