Reject self-boosts

These are easily abused by spammers
This commit is contained in:
bashrc committed 2021-06-03 09:33:50 +01:00
1 parent 042664e9f8
commit 613e6b8945
2 files changed
+8

No files matched your search

+4
View File
@@ -32,6 +32,8 @@ def outboxAnnounce(recentPostsCache: {},
"""
if not messageJson.get('actor'):
return False
if not isinstance(messageJson['actor'], str):
return False
if not messageJson.get('type'):
return False
if not messageJson.get('object'):
@@ -39,6 +41,8 @@ def outboxAnnounce(recentPostsCache: {},
if messageJson['type'] == 'Announce':
if not isinstance(messageJson['object'], str):
return False
if messageJson['actor'] in messageJson['object']:
return False
nickname = getNicknameFromActor(messageJson['actor'])
if not nickname:
print('WARN: no nickname found in ' + messageJson['actor'])