mirror of https://gitlab.com/bashrc2/epicyon
Include event parameters within tags
parent
94f301e983
commit
272cc92adf
25
daemon.py
25
daemon.py
|
@ -2480,6 +2480,12 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
fields['subject']=None
|
fields['subject']=None
|
||||||
if not fields.get('replyTo'):
|
if not fields.get('replyTo'):
|
||||||
fields['replyTo']=None
|
fields['replyTo']=None
|
||||||
|
if not fields.get('eventDate'):
|
||||||
|
fields['eventDate']=None
|
||||||
|
if not fields.get('eventTime'):
|
||||||
|
fields['eventTime']=None
|
||||||
|
if not fields.get('location'):
|
||||||
|
fields['location']=None
|
||||||
|
|
||||||
if postType=='newpost':
|
if postType=='newpost':
|
||||||
messageJson= \
|
messageJson= \
|
||||||
|
@ -2489,7 +2495,8 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
self.server.httpPrefix, \
|
self.server.httpPrefix, \
|
||||||
fields['message'],False,False,False, \
|
fields['message'],False,False,False, \
|
||||||
filename,attachmentMediaType,fields['imageDescription'],True, \
|
filename,attachmentMediaType,fields['imageDescription'],True, \
|
||||||
fields['replyTo'], fields['replyTo'],fields['subject'])
|
fields['replyTo'],fields['replyTo'],fields['subject'], \
|
||||||
|
fields['eventDate'],fields['eventTime'],fields['location'])
|
||||||
if messageJson:
|
if messageJson:
|
||||||
self.postToNickname=nickname
|
self.postToNickname=nickname
|
||||||
if self._postToOutbox(messageJson,__version__):
|
if self._postToOutbox(messageJson,__version__):
|
||||||
|
@ -2511,7 +2518,8 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
self.server.httpPrefix, \
|
self.server.httpPrefix, \
|
||||||
fields['message'],False,False,False, \
|
fields['message'],False,False,False, \
|
||||||
filename,attachmentMediaType,fields['imageDescription'],True, \
|
filename,attachmentMediaType,fields['imageDescription'],True, \
|
||||||
fields['replyTo'], fields['replyTo'],fields['subject'])
|
fields['replyTo'], fields['replyTo'],fields['subject'], \
|
||||||
|
fields['eventDate'],fields['eventTime'],fields['location'])
|
||||||
if messageJson:
|
if messageJson:
|
||||||
self.postToNickname=nickname
|
self.postToNickname=nickname
|
||||||
if self._postToOutbox(messageJson,__version__):
|
if self._postToOutbox(messageJson,__version__):
|
||||||
|
@ -2533,7 +2541,8 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
self.server.httpPrefix, \
|
self.server.httpPrefix, \
|
||||||
fields['message'],True,False,False, \
|
fields['message'],True,False,False, \
|
||||||
filename,attachmentMediaType,fields['imageDescription'],True, \
|
filename,attachmentMediaType,fields['imageDescription'],True, \
|
||||||
fields['replyTo'], fields['replyTo'],fields['subject'])
|
fields['replyTo'], fields['replyTo'],fields['subject'],
|
||||||
|
fields['eventDate'],fields['eventTime'],fields['location'])
|
||||||
if messageJson:
|
if messageJson:
|
||||||
self.postToNickname=nickname
|
self.postToNickname=nickname
|
||||||
if self._postToOutbox(messageJson,__version__):
|
if self._postToOutbox(messageJson,__version__):
|
||||||
|
@ -2550,6 +2559,10 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
if postType=='newdm':
|
if postType=='newdm':
|
||||||
messageJson=None
|
messageJson=None
|
||||||
if '@' in fields['message']:
|
if '@' in fields['message']:
|
||||||
|
if self.server.debug:
|
||||||
|
print('DEBUG: Event Date - '+str(fields['eventDate']))
|
||||||
|
print('DEBUG: Event Time - '+str(fields['eventTime']))
|
||||||
|
print('DEBUG: Event Location - '+str(fields['location']))
|
||||||
messageJson= \
|
messageJson= \
|
||||||
createDirectMessagePost(self.server.baseDir, \
|
createDirectMessagePost(self.server.baseDir, \
|
||||||
nickname, \
|
nickname, \
|
||||||
|
@ -2560,7 +2573,8 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
fields['imageDescription'],True, \
|
fields['imageDescription'],True, \
|
||||||
fields['replyTo'],fields['replyTo'], \
|
fields['replyTo'],fields['replyTo'], \
|
||||||
fields['subject'], \
|
fields['subject'], \
|
||||||
self.server.debug)
|
self.server.debug, \
|
||||||
|
fields['eventDate'],fields['eventTime'],fields['location'])
|
||||||
if messageJson:
|
if messageJson:
|
||||||
self.postToNickname=nickname
|
self.postToNickname=nickname
|
||||||
if self.server.debug:
|
if self.server.debug:
|
||||||
|
@ -3199,7 +3213,8 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
self.server.httpPrefix, \
|
self.server.httpPrefix, \
|
||||||
answer,False,False,False, \
|
answer,False,False,False, \
|
||||||
filename,attachmentMediaType,None,True, \
|
filename,attachmentMediaType,None,True, \
|
||||||
messageId,messageId,None)
|
messageId,messageId,None, \
|
||||||
|
None,None,None)
|
||||||
if messageJson:
|
if messageJson:
|
||||||
self.postToNickname=nickname
|
self.postToNickname=nickname
|
||||||
if self._postToOutbox(messageJson,__version__):
|
if self._postToOutbox(messageJson,__version__):
|
||||||
|
|
79
posts.py
79
posts.py
|
@ -444,7 +444,8 @@ def createPostBase(baseDir: str,nickname: str, domain: str, port: int, \
|
||||||
followersOnly: bool, saveToFile: bool, clientToServer: bool, \
|
followersOnly: bool, saveToFile: bool, clientToServer: bool, \
|
||||||
attachImageFilename: str,mediaType: str,imageDescription: str, \
|
attachImageFilename: str,mediaType: str,imageDescription: str, \
|
||||||
useBlurhash: bool,isModerationReport: bool,inReplyTo=None, \
|
useBlurhash: bool,isModerationReport: bool,inReplyTo=None, \
|
||||||
inReplyToAtomUri=None, subject=None) -> {}:
|
inReplyToAtomUri=None, subject=None, \
|
||||||
|
eventDate: str,eventTime: str,location: str) -> {}:
|
||||||
"""Creates a message
|
"""Creates a message
|
||||||
"""
|
"""
|
||||||
mentionedRecipients= \
|
mentionedRecipients= \
|
||||||
|
@ -528,6 +529,29 @@ def createPostBase(baseDir: str,nickname: str, domain: str, port: int, \
|
||||||
if replyToJson['object'].get('summary'):
|
if replyToJson['object'].get('summary'):
|
||||||
summary=replyToJson['object']['summary']
|
summary=replyToJson['object']['summary']
|
||||||
|
|
||||||
|
if eventDate:
|
||||||
|
eventName=summary
|
||||||
|
if not eventName:
|
||||||
|
eventName=content
|
||||||
|
eventDateStr=eventDate
|
||||||
|
if eventTime:
|
||||||
|
eventDateStr=eventDate+'T'+eventTime
|
||||||
|
else:
|
||||||
|
eventDateStr=eventDate+'T00:00:00Z'
|
||||||
|
tags.append({
|
||||||
|
"@context": "https://www.w3.org/ns/activitystreams",
|
||||||
|
"type": "Event",
|
||||||
|
"name": eventName,
|
||||||
|
"startTime": eventDateStr,
|
||||||
|
"endTime": eventDateStr
|
||||||
|
})
|
||||||
|
if location:
|
||||||
|
tags.append({
|
||||||
|
"@context": "https://www.w3.org/ns/activitystreams",
|
||||||
|
"type": "Place",
|
||||||
|
"name": location
|
||||||
|
})
|
||||||
|
|
||||||
if not clientToServer:
|
if not clientToServer:
|
||||||
actorUrl=httpPrefix+'://'+domain+'/users/'+nickname
|
actorUrl=httpPrefix+'://'+domain+'/users/'+nickname
|
||||||
|
|
||||||
|
@ -749,12 +773,13 @@ def postIsAddressedToPublic(baseDir: str,postJsonObject: {}) -> bool:
|
||||||
return addressedToPublic
|
return addressedToPublic
|
||||||
|
|
||||||
def createPublicPost(baseDir: str,
|
def createPublicPost(baseDir: str,
|
||||||
nickname: str, domain: str, port: int,httpPrefix: str, \
|
nickname: str,domain: str,port: int,httpPrefix: str, \
|
||||||
content: str, followersOnly: bool, saveToFile: bool,
|
content: str,followersOnly: bool,saveToFile: bool,
|
||||||
clientToServer: bool,\
|
clientToServer: bool,\
|
||||||
attachImageFilename: str,mediaType: str, \
|
attachImageFilename: str,mediaType: str, \
|
||||||
imageDescription: str,useBlurhash: bool, \
|
imageDescription: str,useBlurhash: bool, \
|
||||||
inReplyTo=None, inReplyToAtomUri=None, subject=None) -> {}:
|
inReplyTo=None,inReplyToAtomUri=None,subject=None, \
|
||||||
|
eventDate=None,eventTime=None,location=None) -> {}:
|
||||||
"""Public post
|
"""Public post
|
||||||
"""
|
"""
|
||||||
domainFull=domain
|
domainFull=domain
|
||||||
|
@ -762,22 +787,24 @@ def createPublicPost(baseDir: str,
|
||||||
if port!=80 and port!=443:
|
if port!=80 and port!=443:
|
||||||
if ':' not in domain:
|
if ':' not in domain:
|
||||||
domainFull=domain+':'+str(port)
|
domainFull=domain+':'+str(port)
|
||||||
return createPostBase(baseDir,nickname, domain, port, \
|
return createPostBase(baseDir,nickname,domain,port, \
|
||||||
'https://www.w3.org/ns/activitystreams#Public', \
|
'https://www.w3.org/ns/activitystreams#Public', \
|
||||||
httpPrefix+'://'+domainFull+'/users/'+nickname+'/followers', \
|
httpPrefix+'://'+domainFull+'/users/'+nickname+'/followers', \
|
||||||
httpPrefix, content, followersOnly, saveToFile, \
|
httpPrefix,content,followersOnly,saveToFile, \
|
||||||
clientToServer, \
|
clientToServer, \
|
||||||
attachImageFilename,mediaType, \
|
attachImageFilename,mediaType, \
|
||||||
imageDescription,useBlurhash, \
|
imageDescription,useBlurhash, \
|
||||||
False,inReplyTo,inReplyToAtomUri,subject)
|
False,inReplyTo,inReplyToAtomUri,subject, \
|
||||||
|
eventDate,eventTime,location)
|
||||||
|
|
||||||
def createUnlistedPost(baseDir: str,
|
def createUnlistedPost(baseDir: str,
|
||||||
nickname: str, domain: str, port: int,httpPrefix: str, \
|
nickname: str,domain: str,port: int,httpPrefix: str, \
|
||||||
content: str, followersOnly: bool, saveToFile: bool,
|
content: str,followersOnly: bool,saveToFile: bool,
|
||||||
clientToServer: bool,\
|
clientToServer: bool,\
|
||||||
attachImageFilename: str,mediaType: str, \
|
attachImageFilename: str,mediaType: str, \
|
||||||
imageDescription: str,useBlurhash: bool, \
|
imageDescription: str,useBlurhash: bool, \
|
||||||
inReplyTo=None, inReplyToAtomUri=None, subject=None) -> {}:
|
inReplyTo=None,inReplyToAtomUri=None,subject=None, \
|
||||||
|
eventDate=None,eventTime=None,location=None) -> {}:
|
||||||
"""Unlisted post. This has the #Public and followers links inverted.
|
"""Unlisted post. This has the #Public and followers links inverted.
|
||||||
"""
|
"""
|
||||||
domainFull=domain
|
domainFull=domain
|
||||||
|
@ -792,15 +819,17 @@ def createUnlistedPost(baseDir: str,
|
||||||
clientToServer, \
|
clientToServer, \
|
||||||
attachImageFilename,mediaType, \
|
attachImageFilename,mediaType, \
|
||||||
imageDescription,useBlurhash, \
|
imageDescription,useBlurhash, \
|
||||||
False,inReplyTo, inReplyToAtomUri, subject)
|
False,inReplyTo, inReplyToAtomUri, subject, \
|
||||||
|
eventDate,eventTime,location)
|
||||||
|
|
||||||
def createFollowersOnlyPost(baseDir: str,
|
def createFollowersOnlyPost(baseDir: str,
|
||||||
nickname: str, domain: str, port: int,httpPrefix: str, \
|
nickname: str,domain: str,port: int,httpPrefix: str, \
|
||||||
content: str, followersOnly: bool, saveToFile: bool,
|
content: str,followersOnly: bool,saveToFile: bool,
|
||||||
clientToServer: bool,\
|
clientToServer: bool,\
|
||||||
attachImageFilename: str,mediaType: str, \
|
attachImageFilename: str,mediaType: str, \
|
||||||
imageDescription: str,useBlurhash: bool, \
|
imageDescription: str,useBlurhash: bool, \
|
||||||
inReplyTo=None, inReplyToAtomUri=None, subject=None) -> {}:
|
inReplyTo=None,inReplyToAtomUri=None,subject=None, \
|
||||||
|
eventDate=None,eventTime=None,location=None) -> {}:
|
||||||
"""Followers only post
|
"""Followers only post
|
||||||
"""
|
"""
|
||||||
domainFull=domain
|
domainFull=domain
|
||||||
|
@ -815,7 +844,8 @@ def createFollowersOnlyPost(baseDir: str,
|
||||||
clientToServer, \
|
clientToServer, \
|
||||||
attachImageFilename,mediaType, \
|
attachImageFilename,mediaType, \
|
||||||
imageDescription,useBlurhash, \
|
imageDescription,useBlurhash, \
|
||||||
False,inReplyTo, inReplyToAtomUri, subject)
|
False,inReplyTo, inReplyToAtomUri, subject, \
|
||||||
|
eventDate,eventTime,location)
|
||||||
|
|
||||||
def getMentionedPeople(baseDir: str,httpPrefix: str, \
|
def getMentionedPeople(baseDir: str,httpPrefix: str, \
|
||||||
content: str,domain: str,debug: bool) -> []:
|
content: str,domain: str,debug: bool) -> []:
|
||||||
|
@ -849,12 +879,13 @@ def getMentionedPeople(baseDir: str,httpPrefix: str, \
|
||||||
return mentions
|
return mentions
|
||||||
|
|
||||||
def createDirectMessagePost(baseDir: str,
|
def createDirectMessagePost(baseDir: str,
|
||||||
nickname: str, domain: str, port: int,httpPrefix: str, \
|
nickname: str,domain: str,port: int,httpPrefix: str, \
|
||||||
content: str, followersOnly: bool, saveToFile: bool,
|
content: str,followersOnly: bool,saveToFile: bool,
|
||||||
clientToServer: bool,\
|
clientToServer: bool,\
|
||||||
attachImageFilename: str,mediaType: str, \
|
attachImageFilename: str,mediaType: str, \
|
||||||
imageDescription: str,useBlurhash: bool, \
|
imageDescription: str,useBlurhash: bool, \
|
||||||
inReplyTo=None, inReplyToAtomUri=None, subject=None,debug=False) -> {}:
|
inReplyTo=None,inReplyToAtomUri=None,subject=None,debug=False, \
|
||||||
|
eventDate=None,eventTime=None,location=None) -> {}:
|
||||||
"""Direct Message post
|
"""Direct Message post
|
||||||
"""
|
"""
|
||||||
mentionedPeople=getMentionedPeople(baseDir,httpPrefix,content,domain,debug)
|
mentionedPeople=getMentionedPeople(baseDir,httpPrefix,content,domain,debug)
|
||||||
|
@ -870,7 +901,8 @@ def createDirectMessagePost(baseDir: str,
|
||||||
clientToServer, \
|
clientToServer, \
|
||||||
attachImageFilename,mediaType, \
|
attachImageFilename,mediaType, \
|
||||||
imageDescription,useBlurhash, \
|
imageDescription,useBlurhash, \
|
||||||
False,inReplyTo, inReplyToAtomUri, subject)
|
False,inReplyTo, inReplyToAtomUri, subject, \
|
||||||
|
eventDate,eventTime,location)
|
||||||
|
|
||||||
def createReportPost(baseDir: str,
|
def createReportPost(baseDir: str,
|
||||||
nickname: str, domain: str, port: int,httpPrefix: str, \
|
nickname: str, domain: str, port: int,httpPrefix: str, \
|
||||||
|
@ -944,7 +976,8 @@ def createReportPost(baseDir: str,
|
||||||
clientToServer, \
|
clientToServer, \
|
||||||
attachImageFilename,mediaType, \
|
attachImageFilename,mediaType, \
|
||||||
imageDescription,useBlurhash, \
|
imageDescription,useBlurhash, \
|
||||||
True,None, None, subject)
|
True,None, None, subject, \
|
||||||
|
None,None,None)
|
||||||
return postJsonObject
|
return postJsonObject
|
||||||
|
|
||||||
def threadSendPost(session,postJsonStr: str,federationList: [],\
|
def threadSendPost(session,postJsonStr: str,federationList: [],\
|
||||||
|
@ -1049,7 +1082,8 @@ def sendPost(projectVersion: str, \
|
||||||
followersOnly,saveToFile,clientToServer, \
|
followersOnly,saveToFile,clientToServer, \
|
||||||
attachImageFilename,mediaType, \
|
attachImageFilename,mediaType, \
|
||||||
imageDescription,useBlurhash, \
|
imageDescription,useBlurhash, \
|
||||||
False,inReplyTo,inReplyToAtomUri,subject)
|
False,inReplyTo,inReplyToAtomUri,subject, \
|
||||||
|
None,None,None)
|
||||||
|
|
||||||
# get the senders private key
|
# get the senders private key
|
||||||
privateKeyPem=getPersonKey(nickname,domain,baseDir,'private')
|
privateKeyPem=getPersonKey(nickname,domain,baseDir,'private')
|
||||||
|
@ -1162,7 +1196,8 @@ def sendPostViaServer(projectVersion: str, \
|
||||||
followersOnly,saveToFile,clientToServer, \
|
followersOnly,saveToFile,clientToServer, \
|
||||||
attachImageFilename,mediaType, \
|
attachImageFilename,mediaType, \
|
||||||
imageDescription,useBlurhash, \
|
imageDescription,useBlurhash, \
|
||||||
False,inReplyTo,inReplyToAtomUri,subject)
|
False,inReplyTo,inReplyToAtomUri,subject, \
|
||||||
|
None,None,None)
|
||||||
|
|
||||||
authHeader=createBasicAuthHeader(fromNickname,password)
|
authHeader=createBasicAuthHeader(fromNickname,password)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue