From 5d6d108dd523beecd76b52ec7d00fc3769320a35 Mon Sep 17 00:00:00 2001 From: Aevann Date: Fri, 23 Dec 2022 00:25:31 +0200 Subject: [PATCH] remove redundant domain bans --- files/helpers/sanitize.py | 2 +- files/routes/chat.py | 3 --- files/routes/users.py | 8 -------- 3 files changed, 1 insertion(+), 12 deletions(-) diff --git a/files/helpers/sanitize.py b/files/helpers/sanitize.py index 6b8a0a2a6..53720cc78 100644 --- a/files/helpers/sanitize.py +++ b/files/helpers/sanitize.py @@ -400,7 +400,7 @@ def sanitize(sanitized, golden=True, limit_pings=0, showmore=True, count_marseys for x in banned_domains: for y in domain_list: if y.startswith(x.domain): - abort(403, description=f'Remove the banned link "{x.domain}" and try again!\nReason for link ban: "{x.reason}"') + abort(403, f'Remove the banned link "{x.domain}" and try again!\nReason for link ban: "{x.reason}"') if '
' not in sanitized and not sidebar:
 		sanitized = sanitized.replace('\n','')
diff --git a/files/routes/chat.py b/files/routes/chat.py
index 678e4e8a7..fed870cd4 100644
--- a/files/routes/chat.py
+++ b/files/routes/chat.py
@@ -85,9 +85,6 @@ def speak(data, v):
 	
 	if v.shadowbanned or not execute_blackjack(v, None, text, "chat"):
 		emit('speak', data)
-	elif ('discord.gg' in text or 'discord.com' in text or 'discordapp.com' in text):
-		# Follows same logic as in users.py:message2/messagereply; TODO: unify?
-		emit('speak', data)
 	elif recipient:
 		if user_ids_to_socket_ids.get(recipient):
 			recipient_sid = user_ids_to_socket_ids[recipient]
diff --git a/files/routes/users.py b/files/routes/users.py
index 9e5c4853e..be8fb72dc 100644
--- a/files/routes/users.py
+++ b/files/routes/users.py
@@ -453,9 +453,6 @@ def message2(v:User, username:str):
 
 	message = sanitize_raw_body(request.values.get("message"), False)
 	if not message: abort(400, "Message is empty!")
-	if 'linkedin.com' in message: abort(403, "This domain 'linkedin.com' is banned.")
-	if v.id != AEVANN_ID and ('discord.gg' in message or 'discord.com/invite/' in message or 'discordapp.com/invite/' in message):
-		abort(403, "Stop grooming!")
 
 	body_html = sanitize(message)
 
@@ -507,11 +504,6 @@ def messagereply(v:User):
 	body = sanitize_raw_body(request.values.get("body"), False)
 	if not body and not request.files.get("file"): abort(400, "Message is empty!")
 
-	if 'linkedin.com' in body: abort(403, "This domain 'linkedin.com' is banned")
-
-	if v.id != AEVANN_ID and ('discord.gg' in body or 'discord.com/invite/' in body or 'discordapp.com/invite/' in body):
-		abort(403, "Stop grooming!")
-
 	id = request.values.get("parent_id")
 	parent = get_comment(id, v=v)
 	user_id = parent.author.id