fix: python getting confused by dicts and sets

pull/23/head
db0 2023-09-14 16:49:08 +02:00
parent 6c311ed94d
commit 626cbd8295
2 changed files with 7 additions and 6 deletions

View File

@ -16,13 +16,14 @@ ACTIVITY_SUSPICION = 20
# If there's this many registered users per active monthly user, this site will be considered suspicious # If there's this many registered users per active monthly user, this site will be considered suspicious
MONTHLY_ACTIVITY_SUSPICION = 500 MONTHLY_ACTIVITY_SUSPICION = 500
# Extra domains you can block. You can just delete the contents if you want to only block suspicious domains # Extra domains you can block. You can just delete the contents if you want to only block suspicious domains
blacklist = { blacklist = [
"truthsocial.com", "truthsocial.com",
"threads.net", "threads.net",
} ]
# Add instances in here which want to ensure are not added in your blocklist # Add instances in here which want to ensure are not added in your blocklist
whitelist = { #
} whitelist = [
]
# If you (don't) want to combine your own censures, with the ones from other trusted instances, adjust the list below. # If you (don't) want to combine your own censures, with the ones from other trusted instances, adjust the list below.
# The censures will be the combined list from your own domain and any domains specified below. # The censures will be the combined list from your own domain and any domains specified below.
trusted_instances = [ trusted_instances = [
@ -58,7 +59,7 @@ censures = fediseer.censure.get_given(
min_censures = min_censures, min_censures = min_censures,
format = FormatType.LIST, format = FormatType.LIST,
) )
defed = (blacklist | set(censures["domains"]) | set(sus["domains"])) - whitelist defed = (set(blacklist) | set(censures["domains"]) | set(sus["domains"])) - set(whitelist)
# I need to retrieve the site info because it seems if "RequireApplication" is set # I need to retrieve the site info because it seems if "RequireApplication" is set
# We need to always re-set the application_question. # We need to always re-set the application_question.
# So we retrieve it from the existing site, to set the same value # So we retrieve it from the existing site, to set the same value

View File

@ -72,7 +72,7 @@ class WhitelistDomain(Resource):
raise e.BadRequest(f"Requested guarantor domain {self.args.guarantor} is not registered with the Fediseer yet!") raise e.BadRequest(f"Requested guarantor domain {self.args.guarantor} is not registered with the Fediseer yet!")
if self.args.admin not in admin_usernames: if self.args.admin not in admin_usernames:
if len(admin_usernames) == 0: if len(admin_usernames) == 0:
raise e.Unauthorized(f"We have not implemented admin lookup and messaging for this fediverse software at this point, so this instance cannot be claimed. Please consider sending a PR to add this functionality.") raise e.Unauthorized(f"We could not discover any admins for this instance software. Please Ensure your software exposes this info. If it's exposed in a novel manner, consider sending us a PR to be able to retrieve this infomation.")
else: else:
raise e.Forbidden(f"Only admins of that {instance.software} are allowed to claim it.") raise e.Forbidden(f"Only admins of that {instance.software} are allowed to claim it.")
existing_claim = database.find_claim(f"@{self.args.admin}@{domain}") existing_claim = database.find_claim(f"@{self.args.admin}@{domain}")