mirror of https://gitlab.com/bashrc2/epicyon
Scheduled posts go to their own directory
parent
af832ba57e
commit
7d6b74e961
12
daemon.py
12
daemon.py
|
@ -222,7 +222,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
answer,False,False,False, \
|
answer,False,False,False, \
|
||||||
None,None,None,True, \
|
None,None,None,True, \
|
||||||
messageId,messageId,None, \
|
messageId,messageId,None, \
|
||||||
None,None,None)
|
False,None,None,None)
|
||||||
if messageJson:
|
if messageJson:
|
||||||
self.postToNickname=nickname
|
self.postToNickname=nickname
|
||||||
if self._postToOutbox(messageJson,__version__):
|
if self._postToOutbox(messageJson,__version__):
|
||||||
|
@ -3706,6 +3706,8 @@ 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('schedulePost'):
|
||||||
|
fields['schedulePost']=False
|
||||||
if not fields.get('eventDate'):
|
if not fields.get('eventDate'):
|
||||||
fields['eventDate']=None
|
fields['eventDate']=None
|
||||||
if not fields.get('eventTime'):
|
if not fields.get('eventTime'):
|
||||||
|
@ -3738,7 +3740,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
fields['imageDescription'], \
|
fields['imageDescription'], \
|
||||||
self.server.useBlurHash, \
|
self.server.useBlurHash, \
|
||||||
fields['replyTo'],fields['replyTo'], \
|
fields['replyTo'],fields['replyTo'], \
|
||||||
fields['subject'], \
|
fields['subject'],fields['schedulePost'], \
|
||||||
fields['eventDate'],fields['eventTime'], \
|
fields['eventDate'],fields['eventTime'], \
|
||||||
fields['location'])
|
fields['location'])
|
||||||
if messageJson:
|
if messageJson:
|
||||||
|
@ -3764,7 +3766,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
fields['imageDescription'], \
|
fields['imageDescription'], \
|
||||||
self.server.useBlurHash, \
|
self.server.useBlurHash, \
|
||||||
fields['replyTo'],fields['replyTo'], \
|
fields['replyTo'],fields['replyTo'], \
|
||||||
fields['subject'], \
|
fields['subject'],fields['schedulePost'], \
|
||||||
fields['eventDate'],fields['eventTime'], \
|
fields['eventDate'],fields['eventTime'], \
|
||||||
fields['location'])
|
fields['location'])
|
||||||
if messageJson:
|
if messageJson:
|
||||||
|
@ -3790,7 +3792,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
fields['imageDescription'], \
|
fields['imageDescription'], \
|
||||||
self.server.useBlurHash, \
|
self.server.useBlurHash, \
|
||||||
fields['replyTo'],fields['replyTo'], \
|
fields['replyTo'],fields['replyTo'], \
|
||||||
fields['subject'], \
|
fields['subject'],fields['schedulePost'], \
|
||||||
fields['eventDate'],fields['eventTime'], \
|
fields['eventDate'],fields['eventTime'], \
|
||||||
fields['location'])
|
fields['location'])
|
||||||
if messageJson:
|
if messageJson:
|
||||||
|
@ -3819,7 +3821,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
self.server.useBlurHash, \
|
self.server.useBlurHash, \
|
||||||
fields['replyTo'],fields['replyTo'], \
|
fields['replyTo'],fields['replyTo'], \
|
||||||
fields['subject'], \
|
fields['subject'], \
|
||||||
self.server.debug, \
|
self.server.debug,fields['schedulePost'], \
|
||||||
fields['eventDate'], \
|
fields['eventDate'], \
|
||||||
fields['eventTime'], \
|
fields['eventTime'], \
|
||||||
fields['location'])
|
fields['location'])
|
||||||
|
|
28
posts.py
28
posts.py
|
@ -420,7 +420,7 @@ def savePostToBox(baseDir: str,httpPrefix: str,postId: str, \
|
||||||
"""Saves the give json to the give box
|
"""Saves the give json to the give box
|
||||||
Returns the filename
|
Returns the filename
|
||||||
"""
|
"""
|
||||||
if boxname!='inbox' and boxname!='outbox':
|
if boxname!='inbox' and boxname!='outbox' and boxname!='scheduled':
|
||||||
return None
|
return None
|
||||||
originalDomain=domain
|
originalDomain=domain
|
||||||
if ':' in domain:
|
if ':' in domain:
|
||||||
|
@ -480,6 +480,7 @@ def createPostBase(baseDir: str,nickname: str,domain: str,port: int, \
|
||||||
mediaType: str,imageDescription: 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, \
|
||||||
|
schedulePost=False, \
|
||||||
eventDate=None,eventTime=None,location=None) -> {}:
|
eventDate=None,eventTime=None,location=None) -> {}:
|
||||||
"""Creates a message
|
"""Creates a message
|
||||||
"""
|
"""
|
||||||
|
@ -715,8 +716,11 @@ def createPostBase(baseDir: str,nickname: str,domain: str,port: int, \
|
||||||
modFile.close()
|
modFile.close()
|
||||||
|
|
||||||
if saveToFile:
|
if saveToFile:
|
||||||
|
outboxName='outbox'
|
||||||
|
if schedulePost:
|
||||||
|
outboxName='scheduled'
|
||||||
savePostToBox(baseDir,httpPrefix,newPostId, \
|
savePostToBox(baseDir,httpPrefix,newPostId, \
|
||||||
nickname,domain,newPost,'outbox')
|
nickname,domain,newPost,outboxName)
|
||||||
return newPost
|
return newPost
|
||||||
|
|
||||||
def outboxMessageCreateWrap(httpPrefix: str, \
|
def outboxMessageCreateWrap(httpPrefix: str, \
|
||||||
|
@ -822,6 +826,7 @@ def createPublicPost(baseDir: str, \
|
||||||
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, \
|
||||||
|
schedulePost=False, \
|
||||||
eventDate=None,eventTime=None,location=None) -> {}:
|
eventDate=None,eventTime=None,location=None) -> {}:
|
||||||
"""Public post
|
"""Public post
|
||||||
"""
|
"""
|
||||||
|
@ -838,7 +843,7 @@ def createPublicPost(baseDir: str, \
|
||||||
attachImageFilename,mediaType, \
|
attachImageFilename,mediaType, \
|
||||||
imageDescription,useBlurhash, \
|
imageDescription,useBlurhash, \
|
||||||
False,inReplyTo,inReplyToAtomUri,subject, \
|
False,inReplyTo,inReplyToAtomUri,subject, \
|
||||||
eventDate,eventTime,location)
|
schedulePost,eventDate,eventTime,location)
|
||||||
|
|
||||||
def createQuestionPost(baseDir: str,
|
def createQuestionPost(baseDir: str,
|
||||||
nickname: str,domain: str,port: int,httpPrefix: str, \
|
nickname: str,domain: str,port: int,httpPrefix: str, \
|
||||||
|
@ -864,7 +869,7 @@ def createQuestionPost(baseDir: str,
|
||||||
attachImageFilename,mediaType, \
|
attachImageFilename,mediaType, \
|
||||||
imageDescription,useBlurhash, \
|
imageDescription,useBlurhash, \
|
||||||
False,None,None,subject, \
|
False,None,None,subject, \
|
||||||
None,None,None)
|
False,None,None,None)
|
||||||
messageJson['object']['type']='Question'
|
messageJson['object']['type']='Question'
|
||||||
messageJson['object']['oneOf']=[]
|
messageJson['object']['oneOf']=[]
|
||||||
messageJson['object']['votersCount']=0
|
messageJson['object']['votersCount']=0
|
||||||
|
@ -890,6 +895,7 @@ def createUnlistedPost(baseDir: str,
|
||||||
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, \
|
||||||
|
schedulePost=False, \
|
||||||
eventDate=None,eventTime=None,location=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.
|
||||||
"""
|
"""
|
||||||
|
@ -906,7 +912,7 @@ def createUnlistedPost(baseDir: str,
|
||||||
attachImageFilename,mediaType, \
|
attachImageFilename,mediaType, \
|
||||||
imageDescription,useBlurhash, \
|
imageDescription,useBlurhash, \
|
||||||
False,inReplyTo, inReplyToAtomUri, subject, \
|
False,inReplyTo, inReplyToAtomUri, subject, \
|
||||||
eventDate,eventTime,location)
|
schedulePost,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, \
|
||||||
|
@ -915,6 +921,7 @@ def createFollowersOnlyPost(baseDir: str,
|
||||||
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, \
|
||||||
|
schedulePost=False, \
|
||||||
eventDate=None,eventTime=None,location=None) -> {}:
|
eventDate=None,eventTime=None,location=None) -> {}:
|
||||||
"""Followers only post
|
"""Followers only post
|
||||||
"""
|
"""
|
||||||
|
@ -931,7 +938,7 @@ def createFollowersOnlyPost(baseDir: str,
|
||||||
attachImageFilename,mediaType, \
|
attachImageFilename,mediaType, \
|
||||||
imageDescription,useBlurhash, \
|
imageDescription,useBlurhash, \
|
||||||
False,inReplyTo, inReplyToAtomUri, subject, \
|
False,inReplyTo, inReplyToAtomUri, subject, \
|
||||||
eventDate,eventTime,location)
|
schedulePost,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) -> []:
|
||||||
|
@ -974,6 +981,7 @@ def createDirectMessagePost(baseDir: str,
|
||||||
imageDescription: str,useBlurhash: bool, \
|
imageDescription: str,useBlurhash: bool, \
|
||||||
inReplyTo=None,inReplyToAtomUri=None, \
|
inReplyTo=None,inReplyToAtomUri=None, \
|
||||||
subject=None,debug=False, \
|
subject=None,debug=False, \
|
||||||
|
schedulePost=False, \
|
||||||
eventDate=None,eventTime=None,location=None) -> {}:
|
eventDate=None,eventTime=None,location=None) -> {}:
|
||||||
"""Direct Message post
|
"""Direct Message post
|
||||||
"""
|
"""
|
||||||
|
@ -992,7 +1000,7 @@ def createDirectMessagePost(baseDir: str,
|
||||||
attachImageFilename,mediaType, \
|
attachImageFilename,mediaType, \
|
||||||
imageDescription,useBlurhash, \
|
imageDescription,useBlurhash, \
|
||||||
False,inReplyTo,inReplyToAtomUri,subject, \
|
False,inReplyTo,inReplyToAtomUri,subject, \
|
||||||
eventDate,eventTime,location)
|
schedulePost,eventDate,eventTime,location)
|
||||||
# mentioned recipients go into To rather than Cc
|
# mentioned recipients go into To rather than Cc
|
||||||
messageJson['to']=messageJson['object']['cc']
|
messageJson['to']=messageJson['object']['cc']
|
||||||
messageJson['object']['to']=messageJson['to']
|
messageJson['object']['to']=messageJson['to']
|
||||||
|
@ -1078,7 +1086,7 @@ def createReportPost(baseDir: str,
|
||||||
attachImageFilename,mediaType, \
|
attachImageFilename,mediaType, \
|
||||||
imageDescription,useBlurhash, \
|
imageDescription,useBlurhash, \
|
||||||
True,None,None,subject, \
|
True,None,None,subject, \
|
||||||
None,None,None)
|
False,None,None,None)
|
||||||
if not postJsonObject:
|
if not postJsonObject:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
@ -1219,7 +1227,7 @@ def sendPost(projectVersion: str, \
|
||||||
attachImageFilename,mediaType, \
|
attachImageFilename,mediaType, \
|
||||||
imageDescription,useBlurhash, \
|
imageDescription,useBlurhash, \
|
||||||
False,inReplyTo,inReplyToAtomUri,subject, \
|
False,inReplyTo,inReplyToAtomUri,subject, \
|
||||||
None,None,None)
|
False,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')
|
||||||
|
@ -1342,7 +1350,7 @@ def sendPostViaServer(projectVersion: str, \
|
||||||
attachImageFilename,mediaType, \
|
attachImageFilename,mediaType, \
|
||||||
imageDescription,useBlurhash, \
|
imageDescription,useBlurhash, \
|
||||||
False,inReplyTo,inReplyToAtomUri,subject, \
|
False,inReplyTo,inReplyToAtomUri,subject, \
|
||||||
None,None,None)
|
False,None,None,None)
|
||||||
|
|
||||||
authHeader=createBasicAuthHeader(fromNickname,password)
|
authHeader=createBasicAuthHeader(fromNickname,password)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue