added instance blacklist

This commit is contained in:
Lynne 2019-01-11 23:08:53 +10:00
parent 4530a9729f
commit 66899c8226
No known key found for this signature in database
GPG Key ID: FB7B970303ACE499
1 changed files with 8 additions and 3 deletions

11
main.py
View File

@ -14,11 +14,16 @@ import functions
scopes = ["read:statuses", "read:accounts", "read:follows", "write:statuses", "read:notifications"] scopes = ["read:statuses", "read:accounts", "read:follows", "write:statuses", "read:notifications"]
cfg = json.load(open('config.json', 'r')) 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: if 'site' not in cfg:
cfg['website'] = "https://botsin.space" cfg['website'] = "https://botsin.space"
if 'cw' not in cfg: if 'cw' not in cfg:
cfg['cw'] = None 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 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"): if os.path.exists("clientcred.secret"):
@ -99,8 +104,8 @@ for f in following:
else: else:
instance = instance.group(1) instance = instance.group(1)
if instance == "bofa.lol": if instance in cfg['instance_blacklist']:
print("rest in piece bofa, skipping") print("skipping blacklisted instance: {}".format(instance))
continue continue
try: try: