mirror of https://gitlab.com/bashrc2/epicyon
Tidying
parent
5fdb836cf5
commit
3fc0a69e3f
11
inbox.py
11
inbox.py
|
@ -166,10 +166,9 @@ def inboxMessageHasParams(messageJson: {}) -> bool:
|
||||||
def inboxPermittedMessage(domain: str,messageJson: {},federationList: []) -> bool:
|
def inboxPermittedMessage(domain: str,messageJson: {},federationList: []) -> bool:
|
||||||
""" check that we are receiving from a permitted domain
|
""" check that we are receiving from a permitted domain
|
||||||
"""
|
"""
|
||||||
testParam='actor'
|
if not messageJson.get('actor'):
|
||||||
if not messageJson.get(testParam):
|
|
||||||
return False
|
return False
|
||||||
actor=messageJson[testParam]
|
actor=messageJson['actor']
|
||||||
# always allow the local domain
|
# always allow the local domain
|
||||||
if domain in actor:
|
if domain in actor:
|
||||||
return True
|
return True
|
||||||
|
@ -177,10 +176,8 @@ def inboxPermittedMessage(domain: str,messageJson: {},federationList: []) -> boo
|
||||||
if not urlPermitted(actor,federationList,"inbox:write"):
|
if not urlPermitted(actor,federationList,"inbox:write"):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
if messageJson['type']!='Follow' and \
|
alwaysAllowedTypes=('Follow','Like','Delete','Announce')
|
||||||
messageJson['type']!='Like' and \
|
if messageJson['type'] not in alwaysAllowedTypes:
|
||||||
messageJson['type']!='Delete' and \
|
|
||||||
messageJson['type']!='Announce':
|
|
||||||
if messageJson.get('object'):
|
if messageJson.get('object'):
|
||||||
if not isinstance(messageJson['object'], dict):
|
if not isinstance(messageJson['object'], dict):
|
||||||
return False
|
return False
|
||||||
|
|
Loading…
Reference in New Issue