mirror of https://gitlab.com/bashrc2/epicyon
Less indentation
parent
f4da4d7512
commit
4a477bca88
37
inbox.py
37
inbox.py
|
|
@ -367,24 +367,27 @@ def inbox_permitted_message(domain: str, message_json: {},
|
|||
'Follow', 'Join', 'Like', 'EmojiReact', 'Delete', 'Announce', 'Move',
|
||||
'QuoteRequest', 'sm:ActorStatus', 'ActorStatus'
|
||||
)
|
||||
if message_json['type'] not in always_allowed_types:
|
||||
if not has_object_dict(message_json):
|
||||
return True
|
||||
# reject messages generated by LLM
|
||||
# See fep-c81b
|
||||
if 'agentAttribution' in message_json['object']:
|
||||
if message_json['object'].get('id'):
|
||||
print("REJECT: inbox post attributed to AI agent " +
|
||||
str(message_json['object']['id']))
|
||||
if message_json['type'] in always_allowed_types:
|
||||
return True
|
||||
|
||||
if not has_object_dict(message_json):
|
||||
return True
|
||||
|
||||
# reject messages generated by LLM
|
||||
# See fep-c81b
|
||||
if 'agentAttribution' in message_json['object']:
|
||||
if message_json['object'].get('id'):
|
||||
print("REJECT: inbox post attributed to AI agent " +
|
||||
str(message_json['object']['id']))
|
||||
return False
|
||||
# if this is a reply check that replyTo is permitted
|
||||
reply_id = get_reply_to(message_json['object'])
|
||||
if reply_id:
|
||||
in_reply_to = reply_id
|
||||
if not isinstance(in_reply_to, str):
|
||||
return False
|
||||
if not url_permitted(in_reply_to, federation_list):
|
||||
return False
|
||||
# if this is a reply check that replyTo is permitted
|
||||
reply_id = get_reply_to(message_json['object'])
|
||||
if reply_id:
|
||||
in_reply_to = reply_id
|
||||
if not isinstance(in_reply_to, str):
|
||||
return False
|
||||
if not url_permitted(in_reply_to, federation_list):
|
||||
return False
|
||||
|
||||
return True
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue