forked from indymedia/epicyon
Allow for other outbox post types
parent
d3128fe91d
commit
4ef93d01c5
30
daemon.py
30
daemon.py
|
@ -108,24 +108,32 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
https://www.w3.org/TR/activitypub/#client-to-server-outbox-delivery
|
https://www.w3.org/TR/activitypub/#client-to-server-outbox-delivery
|
||||||
"""
|
"""
|
||||||
if not messageJson.get('object'):
|
if not messageJson.get('object'):
|
||||||
if messageJson.get('type'):
|
if messageJson.get('type') and messageJson.get('content'):
|
||||||
if messageJson['type']!='Create':
|
if messageJson['type']!='Create':
|
||||||
# https://www.w3.org/TR/activitypub/#object-without-create
|
# https://www.w3.org/TR/activitypub/#object-without-create
|
||||||
|
if self.server.debug:
|
||||||
|
print('DEBUG POST to outbox: Adding Create wrapper')
|
||||||
messageJson= \
|
messageJson= \
|
||||||
outboxMessageCreateWrap(self.server.httpPrefix, \
|
outboxMessageCreateWrap(self.server.httpPrefix, \
|
||||||
self.postToNickname, \
|
self.postToNickname, \
|
||||||
self.server.domain,messageJson)
|
self.server.domain,messageJson)
|
||||||
if not (messageJson.get('id') and \
|
if messageJson['type']=='Create':
|
||||||
messageJson.get('type') and \
|
if not (messageJson.get('id') and \
|
||||||
messageJson.get('actor') and \
|
messageJson.get('type') and \
|
||||||
messageJson.get('object') and \
|
messageJson.get('actor') and \
|
||||||
messageJson.get('atomUri') and \
|
messageJson.get('object') and \
|
||||||
messageJson.get('to')):
|
messageJson.get('atomUri') and \
|
||||||
|
messageJson.get('to')):
|
||||||
|
if self.server.debug:
|
||||||
|
print('DEBUG POST to outbox: Create does not have the required parameters')
|
||||||
|
return False
|
||||||
|
# https://www.w3.org/TR/activitypub/#create-activity-outbox
|
||||||
|
messageJson['object']['attributedTo']=messageJson['actor']
|
||||||
|
permittedOutboxTypes=['Create','Announce','Like','Follow','Undo','Update','Add','Remove','Block','Delete']
|
||||||
|
if messageJson['type'] not in permittedOutboxTypes:
|
||||||
|
if self.server.debug:
|
||||||
|
print('DEBUG POST to outbox: '+messageJson['type']+' is not a permitted activity type')
|
||||||
return False
|
return False
|
||||||
if messageJson['type']!='Create':
|
|
||||||
return False
|
|
||||||
# https://www.w3.org/TR/activitypub/#create-activity-outbox
|
|
||||||
messageJson['object']['attributedTo']=messageJson['actor']
|
|
||||||
savePostToOutbox(self.server.baseDir,messageJson['id'],self.postToNickname,self.server.domain,messageJson)
|
savePostToOutbox(self.server.baseDir,messageJson['id'],self.postToNickname,self.server.domain,messageJson)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue