mirror of https://gitlab.com/bashrc2/epicyon
Extra event attributes
parent
43d8fc1863
commit
25e1724691
20
daemon.py
20
daemon.py
|
@ -316,12 +316,14 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
|
|
||||||
print('Voting on message ' + messageId)
|
print('Voting on message ' + messageId)
|
||||||
print('Vote for: ' + answer)
|
print('Vote for: ' + answer)
|
||||||
|
commentsEnabled = True
|
||||||
messageJson = \
|
messageJson = \
|
||||||
createPublicPost(self.server.baseDir,
|
createPublicPost(self.server.baseDir,
|
||||||
nickname,
|
nickname,
|
||||||
self.server.domain, self.server.port,
|
self.server.domain, self.server.port,
|
||||||
self.server.httpPrefix,
|
self.server.httpPrefix,
|
||||||
answer, False, False, False,
|
answer, False, False, False,
|
||||||
|
commentsEnabled,
|
||||||
None, None, None, True,
|
None, None, None, True,
|
||||||
messageId, messageId, None,
|
messageId, messageId, None,
|
||||||
False, None, None, None)
|
False, None, None, None)
|
||||||
|
@ -5517,6 +5519,9 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
mentionsStr = ''
|
mentionsStr = ''
|
||||||
if fields.get('mentions'):
|
if fields.get('mentions'):
|
||||||
mentionsStr = fields['mentions'].strip() + ' '
|
mentionsStr = fields['mentions'].strip() + ' '
|
||||||
|
commentsEnabled = True
|
||||||
|
if fields.get('commentsEnabled'):
|
||||||
|
commentsEnabled = fields['commentsEnabled']
|
||||||
if postType == 'newpost':
|
if postType == 'newpost':
|
||||||
messageJson = \
|
messageJson = \
|
||||||
createPublicPost(self.server.baseDir,
|
createPublicPost(self.server.baseDir,
|
||||||
|
@ -5525,7 +5530,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
self.server.port,
|
self.server.port,
|
||||||
self.server.httpPrefix,
|
self.server.httpPrefix,
|
||||||
mentionsStr + fields['message'],
|
mentionsStr + fields['message'],
|
||||||
False, False, False,
|
False, False, False, commentsEnabled,
|
||||||
filename, attachmentMediaType,
|
filename, attachmentMediaType,
|
||||||
fields['imageDescription'],
|
fields['imageDescription'],
|
||||||
self.server.useBlurHash,
|
self.server.useBlurHash,
|
||||||
|
@ -5552,7 +5557,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
self.server.domain, self.server.port,
|
self.server.domain, self.server.port,
|
||||||
self.server.httpPrefix,
|
self.server.httpPrefix,
|
||||||
fields['message'],
|
fields['message'],
|
||||||
False, False, False,
|
False, False, False, commentsEnabled,
|
||||||
filename, attachmentMediaType,
|
filename, attachmentMediaType,
|
||||||
fields['imageDescription'],
|
fields['imageDescription'],
|
||||||
self.server.useBlurHash,
|
self.server.useBlurHash,
|
||||||
|
@ -5655,7 +5660,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
self.server.domain, self.server.port,
|
self.server.domain, self.server.port,
|
||||||
self.server.httpPrefix,
|
self.server.httpPrefix,
|
||||||
mentionsStr + fields['message'],
|
mentionsStr + fields['message'],
|
||||||
False, False, False,
|
False, False, False, commentsEnabled,
|
||||||
filename, attachmentMediaType,
|
filename, attachmentMediaType,
|
||||||
fields['imageDescription'],
|
fields['imageDescription'],
|
||||||
self.server.useBlurHash,
|
self.server.useBlurHash,
|
||||||
|
@ -5688,6 +5693,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
self.server.httpPrefix,
|
self.server.httpPrefix,
|
||||||
mentionsStr + fields['message'],
|
mentionsStr + fields['message'],
|
||||||
True, False, False,
|
True, False, False,
|
||||||
|
commentsEnabled,
|
||||||
filename, attachmentMediaType,
|
filename, attachmentMediaType,
|
||||||
fields['imageDescription'],
|
fields['imageDescription'],
|
||||||
self.server.useBlurHash,
|
self.server.useBlurHash,
|
||||||
|
@ -5731,7 +5737,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
self.server.httpPrefix,
|
self.server.httpPrefix,
|
||||||
mentionsStr + fields['message'],
|
mentionsStr + fields['message'],
|
||||||
fields['followersOnlyEvent'],
|
fields['followersOnlyEvent'],
|
||||||
False, False,
|
False, False, commentsEnabled,
|
||||||
filename, attachmentMediaType,
|
filename, attachmentMediaType,
|
||||||
fields['imageDescription'],
|
fields['imageDescription'],
|
||||||
self.server.useBlurHash,
|
self.server.useBlurHash,
|
||||||
|
@ -5760,6 +5766,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
mentionsStr +
|
mentionsStr +
|
||||||
fields['message'],
|
fields['message'],
|
||||||
True, False, False,
|
True, False, False,
|
||||||
|
commentsEnabled,
|
||||||
filename, attachmentMediaType,
|
filename, attachmentMediaType,
|
||||||
fields['imageDescription'],
|
fields['imageDescription'],
|
||||||
self.server.useBlurHash,
|
self.server.useBlurHash,
|
||||||
|
@ -5799,7 +5806,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
self.server.port,
|
self.server.port,
|
||||||
self.server.httpPrefix,
|
self.server.httpPrefix,
|
||||||
mentionsStr + fields['message'],
|
mentionsStr + fields['message'],
|
||||||
True, False, False,
|
True, False, False, False,
|
||||||
filename, attachmentMediaType,
|
filename, attachmentMediaType,
|
||||||
fields['imageDescription'],
|
fields['imageDescription'],
|
||||||
self.server.useBlurHash,
|
self.server.useBlurHash,
|
||||||
|
@ -5832,7 +5839,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
self.server.domain, self.server.port,
|
self.server.domain, self.server.port,
|
||||||
self.server.httpPrefix,
|
self.server.httpPrefix,
|
||||||
mentionsStr + fields['message'],
|
mentionsStr + fields['message'],
|
||||||
True, False, False,
|
True, False, False, True,
|
||||||
filename, attachmentMediaType,
|
filename, attachmentMediaType,
|
||||||
fields['imageDescription'],
|
fields['imageDescription'],
|
||||||
self.server.useBlurHash,
|
self.server.useBlurHash,
|
||||||
|
@ -5863,6 +5870,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
self.server.httpPrefix,
|
self.server.httpPrefix,
|
||||||
fields['message'], qOptions,
|
fields['message'], qOptions,
|
||||||
False, False, False,
|
False, False, False,
|
||||||
|
commentsEnabled,
|
||||||
filename, attachmentMediaType,
|
filename, attachmentMediaType,
|
||||||
fields['imageDescription'],
|
fields['imageDescription'],
|
||||||
self.server.useBlurHash,
|
self.server.useBlurHash,
|
||||||
|
|
173
posts.py
173
posts.py
|
@ -610,13 +610,20 @@ def addSchedulePost(baseDir: str, nickname: str, domain: str,
|
||||||
def createPostBase(baseDir: str, nickname: str, domain: str, port: int,
|
def createPostBase(baseDir: str, nickname: str, domain: str, port: int,
|
||||||
toUrl: str, ccUrl: str, httpPrefix: str, content: str,
|
toUrl: str, ccUrl: str, httpPrefix: str, content: str,
|
||||||
followersOnly: bool, saveToFile: bool, clientToServer: bool,
|
followersOnly: bool, saveToFile: bool, clientToServer: bool,
|
||||||
|
commentsEnabled: bool,
|
||||||
attachImageFilename: str,
|
attachImageFilename: str,
|
||||||
mediaType: str, imageDescription: str,
|
mediaType: str, imageDescription: str,
|
||||||
useBlurhash: bool, isModerationReport: bool,
|
useBlurhash: bool, isModerationReport: bool,
|
||||||
isArticle: bool, inReplyTo=None,
|
isArticle: bool,
|
||||||
|
inReplyTo=None,
|
||||||
inReplyToAtomUri=None, subject=None, schedulePost=False,
|
inReplyToAtomUri=None, subject=None, schedulePost=False,
|
||||||
eventDate=None, eventTime=None, location=None,
|
eventDate=None, eventTime=None, location=None,
|
||||||
eventUUID=None) -> {}:
|
eventUUID=None, category=None, joinMode=None,
|
||||||
|
endDate=None, endTime=None,
|
||||||
|
maximumAttendeeCapacity=None,
|
||||||
|
repliesModerationOption=None,
|
||||||
|
anonymousParticipationEnabled=None,
|
||||||
|
eventStatus=None) -> {}:
|
||||||
"""Creates a message
|
"""Creates a message
|
||||||
"""
|
"""
|
||||||
mentionedRecipients = \
|
mentionedRecipients = \
|
||||||
|
@ -705,6 +712,24 @@ def createPostBase(baseDir: str, nickname: str, domain: str, port: int,
|
||||||
sensitive = True
|
sensitive = True
|
||||||
if replyToJson['object'].get('summary'):
|
if replyToJson['object'].get('summary'):
|
||||||
summary = replyToJson['object']['summary']
|
summary = replyToJson['object']['summary']
|
||||||
|
|
||||||
|
# get the ending date and time
|
||||||
|
endDateStr = None
|
||||||
|
if endDate:
|
||||||
|
eventName = summary
|
||||||
|
if not eventName:
|
||||||
|
eventName = content
|
||||||
|
endDateStr = endDate
|
||||||
|
if endTime:
|
||||||
|
if endTime.endswith('Z'):
|
||||||
|
endDateStr = endDate + 'T' + endTime
|
||||||
|
else:
|
||||||
|
endDateStr = endDate + 'T' + endTime + \
|
||||||
|
':00' + strftime("%z", gmtime())
|
||||||
|
else:
|
||||||
|
endDateStr = endDate + 'T12:00:00Z'
|
||||||
|
|
||||||
|
# get the starting date and time
|
||||||
eventDateStr = None
|
eventDateStr = None
|
||||||
if eventDate:
|
if eventDate:
|
||||||
eventName = summary
|
eventName = summary
|
||||||
|
@ -719,15 +744,17 @@ def createPostBase(baseDir: str, nickname: str, domain: str, port: int,
|
||||||
':00' + strftime("%z", gmtime())
|
':00' + strftime("%z", gmtime())
|
||||||
else:
|
else:
|
||||||
eventDateStr = eventDate + 'T12:00:00Z'
|
eventDateStr = eventDate + 'T12:00:00Z'
|
||||||
if not schedulePost:
|
if not endDateStr:
|
||||||
|
endDateStr = eventDateStr
|
||||||
|
if not schedulePost and not eventUUID:
|
||||||
tags.append({
|
tags.append({
|
||||||
"@context": "https://www.w3.org/ns/activitystreams",
|
"@context": "https://www.w3.org/ns/activitystreams",
|
||||||
"type": "Event",
|
"type": "Event",
|
||||||
"name": eventName,
|
"name": eventName,
|
||||||
"startTime": eventDateStr,
|
"startTime": eventDateStr,
|
||||||
"endTime": eventDateStr
|
"endTime": endDateStr
|
||||||
})
|
})
|
||||||
if location:
|
if location and not eventUUID:
|
||||||
tags.append({
|
tags.append({
|
||||||
"@context": "https://www.w3.org/ns/activitystreams",
|
"@context": "https://www.w3.org/ns/activitystreams",
|
||||||
"type": "Place",
|
"type": "Place",
|
||||||
|
@ -801,6 +828,7 @@ def createPostBase(baseDir: str, nickname: str, domain: str, port: int,
|
||||||
'sensitive': sensitive,
|
'sensitive': sensitive,
|
||||||
'atomUri': newPostId,
|
'atomUri': newPostId,
|
||||||
'inReplyToAtomUri': inReplyToAtomUri,
|
'inReplyToAtomUri': inReplyToAtomUri,
|
||||||
|
'commentsEnabled': commentsEnabled,
|
||||||
'mediaType': 'text/html',
|
'mediaType': 'text/html',
|
||||||
'content': content,
|
'content': content,
|
||||||
'contentMap': {
|
'contentMap': {
|
||||||
|
@ -824,6 +852,27 @@ def createPostBase(baseDir: str, nickname: str, domain: str, port: int,
|
||||||
attachMedia(baseDir, httpPrefix, domain, port,
|
attachMedia(baseDir, httpPrefix, domain, port,
|
||||||
newPost['object'], attachImageFilename,
|
newPost['object'], attachImageFilename,
|
||||||
mediaType, imageDescription, useBlurhash)
|
mediaType, imageDescription, useBlurhash)
|
||||||
|
if eventUUID:
|
||||||
|
# add attributes for Mobilizon-type events
|
||||||
|
if eventStatus:
|
||||||
|
newPost['object']['ical:status'] = eventStatus
|
||||||
|
if anonymousParticipationEnabled:
|
||||||
|
newPost['object']['anonymousParticipationEnabled'] = \
|
||||||
|
anonymousParticipationEnabled
|
||||||
|
if repliesModerationOption:
|
||||||
|
newPost['object']['repliesModerationOption'] = \
|
||||||
|
repliesModerationOption
|
||||||
|
if category:
|
||||||
|
newPost['object']['category'] = category
|
||||||
|
if joinMode:
|
||||||
|
newPost['object']['joinMode'] = joinMode
|
||||||
|
newPost['object']['startTime'] = eventDateStr
|
||||||
|
newPost['object']['endTime'] = endDateStr
|
||||||
|
if location:
|
||||||
|
newPost['object']['location'] = location
|
||||||
|
if maximumAttendeeCapacity:
|
||||||
|
newPost['object']['maximumAttendeeCapacity'] = \
|
||||||
|
maximumAttendeeCapacity
|
||||||
else:
|
else:
|
||||||
idStr = \
|
idStr = \
|
||||||
httpPrefix + '://' + domain + '/users/' + nickname + \
|
httpPrefix + '://' + domain + '/users/' + nickname + \
|
||||||
|
@ -842,6 +891,7 @@ def createPostBase(baseDir: str, nickname: str, domain: str, port: int,
|
||||||
'sensitive': sensitive,
|
'sensitive': sensitive,
|
||||||
'atomUri': newPostId,
|
'atomUri': newPostId,
|
||||||
'inReplyToAtomUri': inReplyToAtomUri,
|
'inReplyToAtomUri': inReplyToAtomUri,
|
||||||
|
'commentsEnabled': commentsEnabled,
|
||||||
'mediaType': 'text/html',
|
'mediaType': 'text/html',
|
||||||
'content': content,
|
'content': content,
|
||||||
'contentMap': {
|
'contentMap': {
|
||||||
|
@ -864,6 +914,27 @@ def createPostBase(baseDir: str, nickname: str, domain: str, port: int,
|
||||||
attachMedia(baseDir, httpPrefix, domain, port,
|
attachMedia(baseDir, httpPrefix, domain, port,
|
||||||
newPost, attachImageFilename,
|
newPost, attachImageFilename,
|
||||||
mediaType, imageDescription, useBlurhash)
|
mediaType, imageDescription, useBlurhash)
|
||||||
|
if eventUUID:
|
||||||
|
# add attributes for Mobilizon-type events
|
||||||
|
if eventStatus:
|
||||||
|
newPost['ical:status'] = eventStatus
|
||||||
|
if anonymousParticipationEnabled:
|
||||||
|
newPost['anonymousParticipationEnabled'] = \
|
||||||
|
anonymousParticipationEnabled
|
||||||
|
if repliesModerationOption:
|
||||||
|
newPost['repliesModerationOption'] = \
|
||||||
|
repliesModerationOption
|
||||||
|
if category:
|
||||||
|
newPost['category'] = category
|
||||||
|
if joinMode:
|
||||||
|
newPost['joinMode'] = joinMode
|
||||||
|
newPost['startTime'] = eventDateStr
|
||||||
|
newPost['endTime'] = endDateStr
|
||||||
|
if location:
|
||||||
|
newPost['location'] = location
|
||||||
|
if maximumAttendeeCapacity:
|
||||||
|
newPost['maximumAttendeeCapacity'] = \
|
||||||
|
maximumAttendeeCapacity
|
||||||
if ccUrl:
|
if ccUrl:
|
||||||
if len(ccUrl) > 0:
|
if len(ccUrl) > 0:
|
||||||
newPost['cc'] = [ccUrl]
|
newPost['cc'] = [ccUrl]
|
||||||
|
@ -1013,7 +1084,7 @@ def postIsAddressedToPublic(baseDir: str, postJsonObject: {}) -> bool:
|
||||||
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, commentsEnabled: 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,
|
||||||
|
@ -1031,11 +1102,13 @@ def createPublicPost(baseDir: str,
|
||||||
httpPrefix + '://' + domainFull + '/users/' +
|
httpPrefix + '://' + domainFull + '/users/' +
|
||||||
nickname + '/followers',
|
nickname + '/followers',
|
||||||
httpPrefix, content, followersOnly, saveToFile,
|
httpPrefix, content, followersOnly, saveToFile,
|
||||||
clientToServer,
|
clientToServer, commentsEnabled,
|
||||||
attachImageFilename, mediaType,
|
attachImageFilename, mediaType,
|
||||||
imageDescription, useBlurhash,
|
imageDescription, useBlurhash,
|
||||||
False, False, inReplyTo, inReplyToAtomUri, subject,
|
False, False, inReplyTo, inReplyToAtomUri, subject,
|
||||||
schedulePost, eventDate, eventTime, location, None)
|
schedulePost, eventDate, eventTime, location,
|
||||||
|
None, None, None, None, None,
|
||||||
|
None, None, None, None)
|
||||||
|
|
||||||
|
|
||||||
def createBlogPost(baseDir: str,
|
def createBlogPost(baseDir: str,
|
||||||
|
@ -1065,7 +1138,7 @@ def createQuestionPost(baseDir: str,
|
||||||
nickname: str, domain: str, port: int, httpPrefix: str,
|
nickname: str, domain: str, port: int, httpPrefix: str,
|
||||||
content: str, qOptions: [],
|
content: str, qOptions: [],
|
||||||
followersOnly: bool, saveToFile: bool,
|
followersOnly: bool, saveToFile: bool,
|
||||||
clientToServer: bool,
|
clientToServer: bool, commentsEnabled: bool,
|
||||||
attachImageFilename: str, mediaType: str,
|
attachImageFilename: str, mediaType: str,
|
||||||
imageDescription: str, useBlurhash: bool,
|
imageDescription: str, useBlurhash: bool,
|
||||||
subject: str, durationDays: int) -> {}:
|
subject: str, durationDays: int) -> {}:
|
||||||
|
@ -1082,11 +1155,13 @@ def createQuestionPost(baseDir: str,
|
||||||
httpPrefix + '://' + domainFull + '/users/' +
|
httpPrefix + '://' + domainFull + '/users/' +
|
||||||
nickname + '/followers',
|
nickname + '/followers',
|
||||||
httpPrefix, content, followersOnly, saveToFile,
|
httpPrefix, content, followersOnly, saveToFile,
|
||||||
clientToServer,
|
clientToServer, commentsEnabled,
|
||||||
attachImageFilename, mediaType,
|
attachImageFilename, mediaType,
|
||||||
imageDescription, useBlurhash,
|
imageDescription, useBlurhash,
|
||||||
False, False, None, None, subject,
|
False, False, None, None, subject,
|
||||||
False, None, None, None, None)
|
False, None, None, None, None, None,
|
||||||
|
None, None, None,
|
||||||
|
None, 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
|
||||||
|
@ -1111,7 +1186,7 @@ def createQuestionPost(baseDir: str,
|
||||||
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, commentsEnabled: 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,
|
||||||
|
@ -1129,11 +1204,13 @@ def createUnlistedPost(baseDir: str,
|
||||||
nickname + '/followers',
|
nickname + '/followers',
|
||||||
'https://www.w3.org/ns/activitystreams#Public',
|
'https://www.w3.org/ns/activitystreams#Public',
|
||||||
httpPrefix, content, followersOnly, saveToFile,
|
httpPrefix, content, followersOnly, saveToFile,
|
||||||
clientToServer,
|
clientToServer, commentsEnabled,
|
||||||
attachImageFilename, mediaType,
|
attachImageFilename, mediaType,
|
||||||
imageDescription, useBlurhash,
|
imageDescription, useBlurhash,
|
||||||
False, False, inReplyTo, inReplyToAtomUri, subject,
|
False, False, inReplyTo, inReplyToAtomUri, subject,
|
||||||
schedulePost, eventDate, eventTime, location, None)
|
schedulePost, eventDate, eventTime, location,
|
||||||
|
None, None, None, None, None,
|
||||||
|
None, None, None, None)
|
||||||
|
|
||||||
|
|
||||||
def createFollowersOnlyPost(baseDir: str,
|
def createFollowersOnlyPost(baseDir: str,
|
||||||
|
@ -1141,7 +1218,7 @@ def createFollowersOnlyPost(baseDir: str,
|
||||||
httpPrefix: str,
|
httpPrefix: str,
|
||||||
content: str, followersOnly: bool,
|
content: str, followersOnly: bool,
|
||||||
saveToFile: bool,
|
saveToFile: bool,
|
||||||
clientToServer: bool,
|
clientToServer: bool, commentsEnabled: bool,
|
||||||
attachImageFilename: str, mediaType: str,
|
attachImageFilename: str, mediaType: str,
|
||||||
imageDescription: str, useBlurhash: bool,
|
imageDescription: str, useBlurhash: bool,
|
||||||
inReplyTo=None, inReplyToAtomUri=None,
|
inReplyTo=None, inReplyToAtomUri=None,
|
||||||
|
@ -1160,11 +1237,13 @@ def createFollowersOnlyPost(baseDir: str,
|
||||||
nickname + '/followers',
|
nickname + '/followers',
|
||||||
None,
|
None,
|
||||||
httpPrefix, content, followersOnly, saveToFile,
|
httpPrefix, content, followersOnly, saveToFile,
|
||||||
clientToServer,
|
clientToServer, commentsEnabled,
|
||||||
attachImageFilename, mediaType,
|
attachImageFilename, mediaType,
|
||||||
imageDescription, useBlurhash,
|
imageDescription, useBlurhash,
|
||||||
False, False, inReplyTo, inReplyToAtomUri, subject,
|
False, False, inReplyTo, inReplyToAtomUri, subject,
|
||||||
schedulePost, eventDate, eventTime, location, None)
|
schedulePost, eventDate, eventTime, location,
|
||||||
|
None, None, None, None, None,
|
||||||
|
None, None, None, None)
|
||||||
|
|
||||||
|
|
||||||
def createEventPost(baseDir: str,
|
def createEventPost(baseDir: str,
|
||||||
|
@ -1172,16 +1251,23 @@ def createEventPost(baseDir: str,
|
||||||
httpPrefix: str,
|
httpPrefix: str,
|
||||||
content: str, followersOnly: bool,
|
content: str, followersOnly: bool,
|
||||||
saveToFile: bool,
|
saveToFile: bool,
|
||||||
clientToServer: bool,
|
clientToServer: bool, commentsEnabled: bool,
|
||||||
attachImageFilename: str, mediaType: str,
|
attachImageFilename: str, mediaType: str,
|
||||||
imageDescription: str, useBlurhash: bool,
|
imageDescription: str, useBlurhash: bool,
|
||||||
subject=None, schedulePost=False,
|
subject=None, schedulePost=False,
|
||||||
eventDate=None, eventTime=None,
|
eventDate=None, eventTime=None,
|
||||||
location=None) -> {}:
|
location=None, category=None, joinMode=None,
|
||||||
|
endDate=None, endTime=None,
|
||||||
|
maximumAttendeeCapacity=None,
|
||||||
|
repliesModerationOption=None,
|
||||||
|
anonymousParticipationEnabled=None,
|
||||||
|
eventStatus=None) -> {}:
|
||||||
"""Mobilizon-type Event post
|
"""Mobilizon-type Event post
|
||||||
"""
|
"""
|
||||||
if not attachImageFilename:
|
if not attachImageFilename:
|
||||||
return None
|
return None
|
||||||
|
if not category:
|
||||||
|
return None
|
||||||
domainFull = domain
|
domainFull = domain
|
||||||
if port:
|
if port:
|
||||||
if port != 80 and port != 443:
|
if port != 80 and port != 443:
|
||||||
|
@ -1197,15 +1283,19 @@ def createEventPost(baseDir: str,
|
||||||
if followersOnly:
|
if followersOnly:
|
||||||
toStr1 = toStr2
|
toStr1 = toStr2
|
||||||
toStr2 = None
|
toStr2 = None
|
||||||
return createPostBase(baseDir, nickname, domain, port,
|
createPostBase(baseDir, nickname, domain, port,
|
||||||
toStr1, toStr2,
|
toStr1, toStr2,
|
||||||
httpPrefix, content, followersOnly, saveToFile,
|
httpPrefix, content, followersOnly, saveToFile,
|
||||||
clientToServer,
|
clientToServer, commentsEnabled,
|
||||||
attachImageFilename, mediaType,
|
attachImageFilename, mediaType,
|
||||||
imageDescription, useBlurhash,
|
imageDescription, useBlurhash,
|
||||||
False, False, None, None, subject,
|
False, False, None, None, subject,
|
||||||
schedulePost, eventDate, eventTime, location,
|
schedulePost, eventDate, eventTime, location,
|
||||||
eventUUID)
|
eventUUID, category, joinMode,
|
||||||
|
endDate, endTime, maximumAttendeeCapacity,
|
||||||
|
repliesModerationOption,
|
||||||
|
anonymousParticipationEnabled,
|
||||||
|
eventStatus)
|
||||||
|
|
||||||
|
|
||||||
def getMentionedPeople(baseDir: str, httpPrefix: str,
|
def getMentionedPeople(baseDir: str, httpPrefix: str,
|
||||||
|
@ -1248,6 +1338,7 @@ def createDirectMessagePost(baseDir: str,
|
||||||
httpPrefix: str,
|
httpPrefix: str,
|
||||||
content: str, followersOnly: bool,
|
content: str, followersOnly: bool,
|
||||||
saveToFile: bool, clientToServer: bool,
|
saveToFile: bool, clientToServer: bool,
|
||||||
|
commentsEnabled: bool,
|
||||||
attachImageFilename: str, mediaType: str,
|
attachImageFilename: str, mediaType: str,
|
||||||
imageDescription: str, useBlurhash: bool,
|
imageDescription: str, useBlurhash: bool,
|
||||||
inReplyTo=None, inReplyToAtomUri=None,
|
inReplyTo=None, inReplyToAtomUri=None,
|
||||||
|
@ -1270,11 +1361,13 @@ def createDirectMessagePost(baseDir: str,
|
||||||
createPostBase(baseDir, nickname, domain, port,
|
createPostBase(baseDir, nickname, domain, port,
|
||||||
postTo, postCc,
|
postTo, postCc,
|
||||||
httpPrefix, content, followersOnly, saveToFile,
|
httpPrefix, content, followersOnly, saveToFile,
|
||||||
clientToServer,
|
clientToServer, commentsEnabled,
|
||||||
attachImageFilename, mediaType,
|
attachImageFilename, mediaType,
|
||||||
imageDescription, useBlurhash,
|
imageDescription, useBlurhash,
|
||||||
False, False, inReplyTo, inReplyToAtomUri, subject,
|
False, False, inReplyTo, inReplyToAtomUri, subject,
|
||||||
schedulePost, eventDate, eventTime, location, None)
|
schedulePost, eventDate, eventTime, location,
|
||||||
|
None, None, None, None, None,
|
||||||
|
None, None, None, None)
|
||||||
# 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']
|
||||||
|
@ -1289,7 +1382,7 @@ def createDirectMessagePost(baseDir: str,
|
||||||
def createReportPost(baseDir: str,
|
def createReportPost(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, commentsEnabled: bool,
|
||||||
attachImageFilename: str, mediaType: str,
|
attachImageFilename: str, mediaType: str,
|
||||||
imageDescription: str, useBlurhash: bool,
|
imageDescription: str, useBlurhash: bool,
|
||||||
debug: bool, subject=None) -> {}:
|
debug: bool, subject=None) -> {}:
|
||||||
|
@ -1362,11 +1455,13 @@ def createReportPost(baseDir: str,
|
||||||
createPostBase(baseDir, nickname, domain, port,
|
createPostBase(baseDir, nickname, domain, port,
|
||||||
toUrl, postCc,
|
toUrl, postCc,
|
||||||
httpPrefix, content, followersOnly, saveToFile,
|
httpPrefix, content, followersOnly, saveToFile,
|
||||||
clientToServer,
|
clientToServer, commentsEnabled,
|
||||||
attachImageFilename, mediaType,
|
attachImageFilename, mediaType,
|
||||||
imageDescription, useBlurhash,
|
imageDescription, useBlurhash,
|
||||||
True, False, None, None, subject,
|
True, False, None, None, subject,
|
||||||
False, None, None, None, None)
|
False, None, None, None, None, None,
|
||||||
|
None, None, None,
|
||||||
|
None, None, None, None)
|
||||||
if not postJsonObject:
|
if not postJsonObject:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
@ -1450,6 +1545,7 @@ def sendPost(projectVersion: str,
|
||||||
toNickname: str, toDomain: str, toPort: int, cc: str,
|
toNickname: str, toDomain: str, toPort: int, cc: str,
|
||||||
httpPrefix: str, content: str, followersOnly: bool,
|
httpPrefix: str, content: str, followersOnly: bool,
|
||||||
saveToFile: bool, clientToServer: bool,
|
saveToFile: bool, clientToServer: bool,
|
||||||
|
commentsEnabled: bool,
|
||||||
attachImageFilename: str, mediaType: str,
|
attachImageFilename: str, mediaType: str,
|
||||||
imageDescription: str, useBlurhash: bool,
|
imageDescription: str, useBlurhash: bool,
|
||||||
federationList: [], sendThreads: [], postLog: [],
|
federationList: [], sendThreads: [], postLog: [],
|
||||||
|
@ -1518,11 +1614,14 @@ def sendPost(projectVersion: str,
|
||||||
createPostBase(baseDir, nickname, domain, port,
|
createPostBase(baseDir, nickname, domain, port,
|
||||||
toPersonId, cc, httpPrefix, content,
|
toPersonId, cc, httpPrefix, content,
|
||||||
followersOnly, saveToFile, clientToServer,
|
followersOnly, saveToFile, clientToServer,
|
||||||
|
commentsEnabled,
|
||||||
attachImageFilename, mediaType,
|
attachImageFilename, mediaType,
|
||||||
imageDescription, useBlurhash,
|
imageDescription, useBlurhash,
|
||||||
False, isArticle, inReplyTo,
|
False, isArticle, inReplyTo,
|
||||||
inReplyToAtomUri, subject,
|
inReplyToAtomUri, subject,
|
||||||
False, None, None, None, None)
|
False, None, None, None, None, None,
|
||||||
|
None, None, None,
|
||||||
|
None, 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')
|
||||||
|
@ -1576,6 +1675,7 @@ def sendPostViaServer(projectVersion: str,
|
||||||
fromDomain: str, fromPort: int,
|
fromDomain: str, fromPort: int,
|
||||||
toNickname: str, toDomain: str, toPort: int, cc: str,
|
toNickname: str, toDomain: str, toPort: int, cc: str,
|
||||||
httpPrefix: str, content: str, followersOnly: bool,
|
httpPrefix: str, content: str, followersOnly: bool,
|
||||||
|
commentsEnabled: bool,
|
||||||
attachImageFilename: str, mediaType: str,
|
attachImageFilename: str, mediaType: str,
|
||||||
imageDescription: str, useBlurhash: bool,
|
imageDescription: str, useBlurhash: bool,
|
||||||
cachedWebfingers: {}, personCache: {},
|
cachedWebfingers: {}, personCache: {},
|
||||||
|
@ -1662,11 +1762,14 @@ def sendPostViaServer(projectVersion: str,
|
||||||
fromNickname, fromDomain, fromPort,
|
fromNickname, fromDomain, fromPort,
|
||||||
toPersonId, cc, httpPrefix, content,
|
toPersonId, cc, httpPrefix, content,
|
||||||
followersOnly, saveToFile, clientToServer,
|
followersOnly, saveToFile, clientToServer,
|
||||||
|
commentsEnabled,
|
||||||
attachImageFilename, mediaType,
|
attachImageFilename, mediaType,
|
||||||
imageDescription, useBlurhash,
|
imageDescription, useBlurhash,
|
||||||
False, isArticle, inReplyTo,
|
False, isArticle, inReplyTo,
|
||||||
inReplyToAtomUri, subject,
|
inReplyToAtomUri, subject,
|
||||||
False, None, None, None, None)
|
False, None, None, None, None, None,
|
||||||
|
None, None, None,
|
||||||
|
None, None, None, None)
|
||||||
|
|
||||||
authHeader = createBasicAuthHeader(fromNickname, password)
|
authHeader = createBasicAuthHeader(fromNickname, password)
|
||||||
|
|
||||||
|
|
2
utils.py
2
utils.py
|
@ -402,7 +402,7 @@ def locatePost(baseDir: str, nickname: str, domain: str,
|
||||||
if os.path.isfile(postFilename):
|
if os.path.isfile(postFilename):
|
||||||
return postFilename
|
return postFilename
|
||||||
|
|
||||||
print('WARN: unable to locate ' + nickname + ' ' + postUrl)
|
# print('WARN: unable to locate ' + nickname + ' ' + postUrl)
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue