This commit is contained in:
Nils Büchner 2024-09-15 00:11:33 +02:00
parent b7174bd16c
commit a28942aadd

View file

@ -183,25 +183,27 @@ class InviteChecker:
logger.debug(f"Blocklist: {blocklist}, Allowlist: {allowlist}, Blocklist Room IDs: {blocklist_room_ids}") logger.debug(f"Blocklist: {blocklist}, Allowlist: {allowlist}, Blocklist Room IDs: {blocklist_room_ids}")
if self.use_allowlist:
logger.info(f"Allowlist enabled. Checking domain: {inviter_domain}")
if inviter_domain in allowlist:
logger.info(f"Invite allowed: {inviter_domain} is on the allowlist")
returnValue("NOT_SPAM")
if room_id in blocklist_room_ids: if room_id in blocklist_room_ids:
logger.info(f"Invite blocked: room {room_id} is blocklisted") logger.info(f"Invite blocked: room {room_id} is blocklisted")
returnValue(errors.Codes.FORBIDDEN) returnValue(errors.Codes.FORBIDDEN)
if self.use_allowlist:
logger.info(f"Allowlist enabled. Checking domain: {inviter_domain}")
if inviter_domain in allowlist:
logger.info(f"Invite allowed: {inviter_domain} is in the allowlist")
returnValue("NOT_SPAM")
if self.use_blocklist: if self.use_blocklist:
logger.info(f"Blocklist enabled. Checking domain: {inviter_domain}") logger.info(f"Blocklist enabled. Checking {inviter}")
if inviter_domain in blocklist: if inviter_domain in blocklist:
logger.info(f"Invite blocked: {inviter_domain} is in the blocklist") logger.info(f"Invite blocked: {inviter_domain} is on the blocklist")
returnValue(errors.Codes.FORBIDDEN) returnValue(errors.Codes.FORBIDDEN)
if inviter in blocklist:
if self.use_allowlist and inviter_domain not in allowlist: logger.info(f"Invite blocked: {inviter} is on the blocklist")
logger.info(f"Invite blocked: {inviter_domain} is not in the allowlist") returnValue(errors.Codes.FORBIDDEN)
elif self.use_allowlist and inviter_domain not in allowlist:
logger.info(f"Invite blocked: {inviter_domain} is not on the allowlist")
returnValue(errors.Codes.FORBIDDEN) returnValue(errors.Codes.FORBIDDEN)
logger.info(f"Invite allowed by default: {inviter}")
logger.info(f"Invite allowed by default: {inviter_domain}")
returnValue("NOT_SPAM") returnValue("NOT_SPAM")