mirror of https://gitlab.com/bashrc2/epicyon
Reintroduce conversation field
parent
05e7c73b5c
commit
361c8fb6bd
66
daemon.py
66
daemon.py
|
@ -421,6 +421,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
eventDate = None
|
eventDate = None
|
||||||
eventTime = None
|
eventTime = None
|
||||||
location = None
|
location = None
|
||||||
|
conversationId = None
|
||||||
city = getSpoofedCity(self.server.city,
|
city = getSpoofedCity(self.server.city,
|
||||||
self.server.baseDir,
|
self.server.baseDir,
|
||||||
nickname, self.server.domain)
|
nickname, self.server.domain)
|
||||||
|
@ -441,7 +442,8 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
eventDate,
|
eventDate,
|
||||||
eventTime,
|
eventTime,
|
||||||
location, False,
|
location, False,
|
||||||
self.server.systemLanguage)
|
self.server.systemLanguage,
|
||||||
|
conversationId)
|
||||||
if messageJson:
|
if messageJson:
|
||||||
# name field contains the answer
|
# name field contains the answer
|
||||||
messageJson['object']['name'] = answer
|
messageJson['object']['name'] = answer
|
||||||
|
@ -2363,7 +2365,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
accessKeys = self.server.keyShortcuts[nickname]
|
accessKeys = self.server.keyShortcuts[nickname]
|
||||||
|
|
||||||
customSubmitText = getConfigParam(baseDir, 'customSubmitText')
|
customSubmitText = getConfigParam(baseDir, 'customSubmitText')
|
||||||
|
conversationId = None
|
||||||
msg = htmlNewPost(self.server.cssCache,
|
msg = htmlNewPost(self.server.cssCache,
|
||||||
False, self.server.translate,
|
False, self.server.translate,
|
||||||
baseDir,
|
baseDir,
|
||||||
|
@ -2378,7 +2380,8 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
self.server.newswire,
|
self.server.newswire,
|
||||||
self.server.themeName,
|
self.server.themeName,
|
||||||
True, accessKeys,
|
True, accessKeys,
|
||||||
customSubmitText).encode('utf-8')
|
customSubmitText,
|
||||||
|
conversationId).encode('utf-8')
|
||||||
msglen = len(msg)
|
msglen = len(msg)
|
||||||
self._set_headers('text/html', msglen,
|
self._set_headers('text/html', msglen,
|
||||||
cookie, callingDomain)
|
cookie, callingDomain)
|
||||||
|
@ -2476,7 +2479,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
accessKeys = self.server.keyShortcuts[nickname]
|
accessKeys = self.server.keyShortcuts[nickname]
|
||||||
|
|
||||||
customSubmitText = getConfigParam(baseDir, 'customSubmitText')
|
customSubmitText = getConfigParam(baseDir, 'customSubmitText')
|
||||||
|
conversationId = None
|
||||||
msg = htmlNewPost(self.server.cssCache,
|
msg = htmlNewPost(self.server.cssCache,
|
||||||
False, self.server.translate,
|
False, self.server.translate,
|
||||||
baseDir,
|
baseDir,
|
||||||
|
@ -2490,7 +2493,8 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
self.server.newswire,
|
self.server.newswire,
|
||||||
self.server.themeName,
|
self.server.themeName,
|
||||||
True, accessKeys,
|
True, accessKeys,
|
||||||
customSubmitText).encode('utf-8')
|
customSubmitText,
|
||||||
|
conversationId).encode('utf-8')
|
||||||
msglen = len(msg)
|
msglen = len(msg)
|
||||||
self._set_headers('text/html', msglen,
|
self._set_headers('text/html', msglen,
|
||||||
cookie, callingDomain)
|
cookie, callingDomain)
|
||||||
|
@ -10433,7 +10437,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
shareDescription: str, replyPageNumber: int,
|
shareDescription: str, replyPageNumber: int,
|
||||||
domain: str, domainFull: str,
|
domain: str, domainFull: str,
|
||||||
GETstartTime, GETtimings: {}, cookie,
|
GETstartTime, GETtimings: {}, cookie,
|
||||||
noDropDown: bool) -> bool:
|
noDropDown: bool, conversationId: str) -> bool:
|
||||||
"""Shows the new post screen
|
"""Shows the new post screen
|
||||||
"""
|
"""
|
||||||
isNewPostEndpoint = False
|
isNewPostEndpoint = False
|
||||||
|
@ -10471,7 +10475,8 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
self.server.newswire,
|
self.server.newswire,
|
||||||
self.server.themeName,
|
self.server.themeName,
|
||||||
noDropDown, accessKeys,
|
noDropDown, accessKeys,
|
||||||
customSubmitText).encode('utf-8')
|
customSubmitText,
|
||||||
|
conversationId).encode('utf-8')
|
||||||
if not msg:
|
if not msg:
|
||||||
print('Error replying to ' + inReplyToUrl)
|
print('Error replying to ' + inReplyToUrl)
|
||||||
self._404()
|
self._404()
|
||||||
|
@ -12526,8 +12531,13 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
replyToList = []
|
replyToList = []
|
||||||
replyPageNumber = 1
|
replyPageNumber = 1
|
||||||
shareDescription = None
|
shareDescription = None
|
||||||
|
conversationId = None
|
||||||
# replytoActor = None
|
# replytoActor = None
|
||||||
if htmlGET:
|
if htmlGET:
|
||||||
|
if '?conversationId=' in self.path:
|
||||||
|
conversationId = self.path.split('?conversationId=')[1]
|
||||||
|
if '?' in conversationId:
|
||||||
|
conversationId = conversationId.split('?')[0]
|
||||||
# public reply
|
# public reply
|
||||||
if '?replyto=' in self.path:
|
if '?replyto=' in self.path:
|
||||||
inReplyToUrl = self.path.split('?replyto=')[1]
|
inReplyToUrl = self.path.split('?replyto=')[1]
|
||||||
|
@ -12699,7 +12709,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
self.server.domain,
|
self.server.domain,
|
||||||
self.server.domainFull,
|
self.server.domainFull,
|
||||||
GETstartTime, GETtimings,
|
GETstartTime, GETtimings,
|
||||||
cookie, noDropDown):
|
cookie, noDropDown, conversationId):
|
||||||
return
|
return
|
||||||
|
|
||||||
self._benchmarkGETtimings(GETstartTime, GETtimings,
|
self._benchmarkGETtimings(GETstartTime, GETtimings,
|
||||||
|
@ -13478,6 +13488,9 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
city = getSpoofedCity(self.server.city,
|
city = getSpoofedCity(self.server.city,
|
||||||
self.server.baseDir,
|
self.server.baseDir,
|
||||||
nickname, self.server.domain)
|
nickname, self.server.domain)
|
||||||
|
conversationId = None
|
||||||
|
if fields['conversationId']:
|
||||||
|
conversationId = fields['conversationId']
|
||||||
messageJson = \
|
messageJson = \
|
||||||
createPublicPost(self.server.baseDir,
|
createPublicPost(self.server.baseDir,
|
||||||
nickname,
|
nickname,
|
||||||
|
@ -13493,7 +13506,8 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
fields['subject'], fields['schedulePost'],
|
fields['subject'], fields['schedulePost'],
|
||||||
fields['eventDate'], fields['eventTime'],
|
fields['eventDate'], fields['eventTime'],
|
||||||
fields['location'], False,
|
fields['location'], False,
|
||||||
self.server.systemLanguage)
|
self.server.systemLanguage,
|
||||||
|
conversationId)
|
||||||
if messageJson:
|
if messageJson:
|
||||||
if fields['schedulePost']:
|
if fields['schedulePost']:
|
||||||
return 1
|
return 1
|
||||||
|
@ -13552,6 +13566,9 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
saveToFile = False
|
saveToFile = False
|
||||||
clientToServer = False
|
clientToServer = False
|
||||||
city = None
|
city = None
|
||||||
|
conversationId = None
|
||||||
|
if fields['conversationId']:
|
||||||
|
conversationId = fields['conversationId']
|
||||||
messageJson = \
|
messageJson = \
|
||||||
createBlogPost(self.server.baseDir, nickname,
|
createBlogPost(self.server.baseDir, nickname,
|
||||||
self.server.domain, self.server.port,
|
self.server.domain, self.server.port,
|
||||||
|
@ -13568,7 +13585,8 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
fields['eventDate'],
|
fields['eventDate'],
|
||||||
fields['eventTime'],
|
fields['eventTime'],
|
||||||
fields['location'],
|
fields['location'],
|
||||||
self.server.systemLanguage)
|
self.server.systemLanguage,
|
||||||
|
conversationId)
|
||||||
if messageJson:
|
if messageJson:
|
||||||
if fields['schedulePost']:
|
if fields['schedulePost']:
|
||||||
return 1
|
return 1
|
||||||
|
@ -13682,6 +13700,11 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
followersOnly = False
|
followersOnly = False
|
||||||
saveToFile = False
|
saveToFile = False
|
||||||
clientToServer = False
|
clientToServer = False
|
||||||
|
|
||||||
|
conversationId = None
|
||||||
|
if fields['conversationId']:
|
||||||
|
conversationId = fields['conversationId']
|
||||||
|
|
||||||
messageJson = \
|
messageJson = \
|
||||||
createUnlistedPost(self.server.baseDir,
|
createUnlistedPost(self.server.baseDir,
|
||||||
nickname,
|
nickname,
|
||||||
|
@ -13700,7 +13723,8 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
fields['eventDate'],
|
fields['eventDate'],
|
||||||
fields['eventTime'],
|
fields['eventTime'],
|
||||||
fields['location'],
|
fields['location'],
|
||||||
self.server.systemLanguage)
|
self.server.systemLanguage,
|
||||||
|
conversationId)
|
||||||
if messageJson:
|
if messageJson:
|
||||||
if fields['schedulePost']:
|
if fields['schedulePost']:
|
||||||
return 1
|
return 1
|
||||||
|
@ -13722,6 +13746,11 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
followersOnly = True
|
followersOnly = True
|
||||||
saveToFile = False
|
saveToFile = False
|
||||||
clientToServer = False
|
clientToServer = False
|
||||||
|
|
||||||
|
conversationId = None
|
||||||
|
if fields['conversationId']:
|
||||||
|
conversationId = fields['conversationId']
|
||||||
|
|
||||||
messageJson = \
|
messageJson = \
|
||||||
createFollowersOnlyPost(self.server.baseDir,
|
createFollowersOnlyPost(self.server.baseDir,
|
||||||
nickname,
|
nickname,
|
||||||
|
@ -13742,7 +13771,8 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
fields['eventDate'],
|
fields['eventDate'],
|
||||||
fields['eventTime'],
|
fields['eventTime'],
|
||||||
fields['location'],
|
fields['location'],
|
||||||
self.server.systemLanguage)
|
self.server.systemLanguage,
|
||||||
|
conversationId)
|
||||||
if messageJson:
|
if messageJson:
|
||||||
if fields['schedulePost']:
|
if fields['schedulePost']:
|
||||||
return 1
|
return 1
|
||||||
|
@ -13767,6 +13797,11 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
followersOnly = True
|
followersOnly = True
|
||||||
saveToFile = False
|
saveToFile = False
|
||||||
clientToServer = False
|
clientToServer = False
|
||||||
|
|
||||||
|
conversationId = None
|
||||||
|
if fields['conversationId']:
|
||||||
|
conversationId = fields['conversationId']
|
||||||
|
|
||||||
messageJson = \
|
messageJson = \
|
||||||
createDirectMessagePost(self.server.baseDir,
|
createDirectMessagePost(self.server.baseDir,
|
||||||
nickname,
|
nickname,
|
||||||
|
@ -13788,7 +13823,8 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
fields['eventDate'],
|
fields['eventDate'],
|
||||||
fields['eventTime'],
|
fields['eventTime'],
|
||||||
fields['location'],
|
fields['location'],
|
||||||
self.server.systemLanguage)
|
self.server.systemLanguage,
|
||||||
|
conversationId)
|
||||||
if messageJson:
|
if messageJson:
|
||||||
if fields['schedulePost']:
|
if fields['schedulePost']:
|
||||||
return 1
|
return 1
|
||||||
|
@ -13818,6 +13854,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
saveToFile = False
|
saveToFile = False
|
||||||
clientToServer = False
|
clientToServer = False
|
||||||
commentsEnabled = False
|
commentsEnabled = False
|
||||||
|
conversationId = None
|
||||||
messageJson = \
|
messageJson = \
|
||||||
createDirectMessagePost(self.server.baseDir,
|
createDirectMessagePost(self.server.baseDir,
|
||||||
nickname,
|
nickname,
|
||||||
|
@ -13836,7 +13873,8 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
fields['eventDate'],
|
fields['eventDate'],
|
||||||
fields['eventTime'],
|
fields['eventTime'],
|
||||||
fields['location'],
|
fields['location'],
|
||||||
self.server.systemLanguage)
|
self.server.systemLanguage,
|
||||||
|
conversationId)
|
||||||
if messageJson:
|
if messageJson:
|
||||||
if fields['schedulePost']:
|
if fields['schedulePost']:
|
||||||
return 1
|
return 1
|
||||||
|
|
|
@ -416,7 +416,7 @@ def _desktopReplyToPost(session, postId: str,
|
||||||
cachedWebfingers: {}, personCache: {},
|
cachedWebfingers: {}, personCache: {},
|
||||||
debug: bool, subject: str,
|
debug: bool, subject: str,
|
||||||
screenreader: str, systemLanguage: str,
|
screenreader: str, systemLanguage: str,
|
||||||
espeak) -> None:
|
espeak, conversationId: str) -> None:
|
||||||
"""Use the desktop client to send a reply to the most recent post
|
"""Use the desktop client to send a reply to the most recent post
|
||||||
"""
|
"""
|
||||||
if '://' not in postId:
|
if '://' not in postId:
|
||||||
|
@ -470,7 +470,7 @@ def _desktopReplyToPost(session, postId: str,
|
||||||
attachedImageDescription, city,
|
attachedImageDescription, city,
|
||||||
cachedWebfingers, personCache, isArticle,
|
cachedWebfingers, personCache, isArticle,
|
||||||
systemLanguage, debug, postId, postId,
|
systemLanguage, debug, postId, postId,
|
||||||
subject) == 0:
|
conversationId, subject) == 0:
|
||||||
sayStr = 'Reply sent'
|
sayStr = 'Reply sent'
|
||||||
else:
|
else:
|
||||||
sayStr = 'Reply failed'
|
sayStr = 'Reply failed'
|
||||||
|
@ -486,6 +486,7 @@ def _desktopNewPost(session,
|
||||||
espeak) -> None:
|
espeak) -> None:
|
||||||
"""Use the desktop client to create a new post
|
"""Use the desktop client to create a new post
|
||||||
"""
|
"""
|
||||||
|
conversationId = None
|
||||||
sayStr = 'Create new post'
|
sayStr = 'Create new post'
|
||||||
_sayCommand(sayStr, sayStr, screenreader, systemLanguage, espeak)
|
_sayCommand(sayStr, sayStr, screenreader, systemLanguage, espeak)
|
||||||
sayStr = 'Type your post, then press Enter.'
|
sayStr = 'Type your post, then press Enter.'
|
||||||
|
@ -532,7 +533,7 @@ def _desktopNewPost(session,
|
||||||
attachedImageDescription, city,
|
attachedImageDescription, city,
|
||||||
cachedWebfingers, personCache, isArticle,
|
cachedWebfingers, personCache, isArticle,
|
||||||
systemLanguage, debug, None, None,
|
systemLanguage, debug, None, None,
|
||||||
subject) == 0:
|
conversationId, subject) == 0:
|
||||||
sayStr = 'Post sent'
|
sayStr = 'Post sent'
|
||||||
else:
|
else:
|
||||||
sayStr = 'Post failed'
|
sayStr = 'Post failed'
|
||||||
|
@ -1140,6 +1141,7 @@ def _desktopNewDMbase(session, toHandle: str,
|
||||||
espeak) -> None:
|
espeak) -> None:
|
||||||
"""Use the desktop client to create a new direct message
|
"""Use the desktop client to create a new direct message
|
||||||
"""
|
"""
|
||||||
|
conversationId = None
|
||||||
toPort = port
|
toPort = port
|
||||||
if '://' in toHandle:
|
if '://' in toHandle:
|
||||||
toNickname = getNicknameFromActor(toHandle)
|
toNickname = getNicknameFromActor(toHandle)
|
||||||
|
@ -1225,7 +1227,7 @@ def _desktopNewDMbase(session, toHandle: str,
|
||||||
attachedImageDescription, city,
|
attachedImageDescription, city,
|
||||||
cachedWebfingers, personCache, isArticle,
|
cachedWebfingers, personCache, isArticle,
|
||||||
systemLanguage, debug, None, None,
|
systemLanguage, debug, None, None,
|
||||||
subject) == 0:
|
conversationId, subject) == 0:
|
||||||
sayStr = 'Direct message sent'
|
sayStr = 'Direct message sent'
|
||||||
else:
|
else:
|
||||||
sayStr = 'Direct message failed'
|
sayStr = 'Direct message failed'
|
||||||
|
@ -1670,6 +1672,10 @@ def runDesktopClient(baseDir: str, proxyType: str, httpPrefix: str,
|
||||||
subject = None
|
subject = None
|
||||||
if postJsonObject['object'].get('summary'):
|
if postJsonObject['object'].get('summary'):
|
||||||
subject = postJsonObject['object']['summary']
|
subject = postJsonObject['object']['summary']
|
||||||
|
conversationId = None
|
||||||
|
if postJsonObject['object'].get('conversation'):
|
||||||
|
conversationId = \
|
||||||
|
postJsonObject['object']['conversation']
|
||||||
sessionReply = createSession(proxyType)
|
sessionReply = createSession(proxyType)
|
||||||
_desktopReplyToPost(sessionReply, postId,
|
_desktopReplyToPost(sessionReply, postId,
|
||||||
baseDir, nickname, password,
|
baseDir, nickname, password,
|
||||||
|
@ -1677,7 +1683,7 @@ def runDesktopClient(baseDir: str, proxyType: str, httpPrefix: str,
|
||||||
cachedWebfingers, personCache,
|
cachedWebfingers, personCache,
|
||||||
debug, subject,
|
debug, subject,
|
||||||
screenreader, systemLanguage,
|
screenreader, systemLanguage,
|
||||||
espeak)
|
espeak, conversationId)
|
||||||
refreshTimeline = True
|
refreshTimeline = True
|
||||||
print('')
|
print('')
|
||||||
elif (commandStr == 'post' or commandStr == 'p' or
|
elif (commandStr == 'post' or commandStr == 'p' or
|
||||||
|
|
23
epicyon.py
23
epicyon.py
|
@ -115,6 +115,10 @@ parser.add_argument('--userAgentBlocks', type=str,
|
||||||
parser.add_argument('--libretranslate', dest='libretranslateUrl', type=str,
|
parser.add_argument('--libretranslate', dest='libretranslateUrl', type=str,
|
||||||
default=None,
|
default=None,
|
||||||
help='URL for LibreTranslate service')
|
help='URL for LibreTranslate service')
|
||||||
|
parser.add_argument('--conversationId', dest='conversationId', type=str,
|
||||||
|
default=None,
|
||||||
|
help='Conversation Id which can be added ' +
|
||||||
|
'when sending a post')
|
||||||
parser.add_argument('--libretranslateApiKey',
|
parser.add_argument('--libretranslateApiKey',
|
||||||
dest='libretranslateApiKey', type=str,
|
dest='libretranslateApiKey', type=str,
|
||||||
default=None,
|
default=None,
|
||||||
|
@ -1179,7 +1183,7 @@ if args.message:
|
||||||
attachedImageDescription, city,
|
attachedImageDescription, city,
|
||||||
cachedWebfingers, personCache, isArticle,
|
cachedWebfingers, personCache, isArticle,
|
||||||
args.language, args.debug,
|
args.language, args.debug,
|
||||||
replyTo, replyTo, subject)
|
replyTo, replyTo, args.conversationId, subject)
|
||||||
for i in range(10):
|
for i in range(10):
|
||||||
# TODO detect send success/fail
|
# TODO detect send success/fail
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
|
@ -2408,6 +2412,7 @@ if args.testdata:
|
||||||
testEventTime = None
|
testEventTime = None
|
||||||
testLocation = None
|
testLocation = None
|
||||||
testIsArticle = False
|
testIsArticle = False
|
||||||
|
conversationId = None
|
||||||
|
|
||||||
createPublicPost(baseDir, nickname, domain, port, httpPrefix,
|
createPublicPost(baseDir, nickname, domain, port, httpPrefix,
|
||||||
"like this is totally just a #test man",
|
"like this is totally just a #test man",
|
||||||
|
@ -2420,7 +2425,7 @@ if args.testdata:
|
||||||
testInReplyTo, testInReplyToAtomUri,
|
testInReplyTo, testInReplyToAtomUri,
|
||||||
testSubject, testSchedulePost,
|
testSubject, testSchedulePost,
|
||||||
testEventDate, testEventTime, testLocation,
|
testEventDate, testEventTime, testLocation,
|
||||||
testIsArticle, args.language)
|
testIsArticle, args.language, conversationId)
|
||||||
createPublicPost(baseDir, nickname, domain, port, httpPrefix,
|
createPublicPost(baseDir, nickname, domain, port, httpPrefix,
|
||||||
"Zoiks!!!",
|
"Zoiks!!!",
|
||||||
testFollowersOnly,
|
testFollowersOnly,
|
||||||
|
@ -2432,7 +2437,7 @@ if args.testdata:
|
||||||
testInReplyTo, testInReplyToAtomUri,
|
testInReplyTo, testInReplyToAtomUri,
|
||||||
testSubject, testSchedulePost,
|
testSubject, testSchedulePost,
|
||||||
testEventDate, testEventTime, testLocation,
|
testEventDate, testEventTime, testLocation,
|
||||||
testIsArticle, args.language)
|
testIsArticle, args.language, conversationId)
|
||||||
createPublicPost(baseDir, nickname, domain, port, httpPrefix,
|
createPublicPost(baseDir, nickname, domain, port, httpPrefix,
|
||||||
"Hey scoob we need like a hundred more #milkshakes",
|
"Hey scoob we need like a hundred more #milkshakes",
|
||||||
testFollowersOnly,
|
testFollowersOnly,
|
||||||
|
@ -2444,7 +2449,7 @@ if args.testdata:
|
||||||
testInReplyTo, testInReplyToAtomUri,
|
testInReplyTo, testInReplyToAtomUri,
|
||||||
testSubject, testSchedulePost,
|
testSubject, testSchedulePost,
|
||||||
testEventDate, testEventTime, testLocation,
|
testEventDate, testEventTime, testLocation,
|
||||||
testIsArticle, args.language)
|
testIsArticle, args.language, conversationId)
|
||||||
createPublicPost(baseDir, nickname, domain, port, httpPrefix,
|
createPublicPost(baseDir, nickname, domain, port, httpPrefix,
|
||||||
"Getting kinda spooky around here",
|
"Getting kinda spooky around here",
|
||||||
testFollowersOnly,
|
testFollowersOnly,
|
||||||
|
@ -2456,7 +2461,7 @@ if args.testdata:
|
||||||
'someone', testInReplyToAtomUri,
|
'someone', testInReplyToAtomUri,
|
||||||
testSubject, testSchedulePost,
|
testSubject, testSchedulePost,
|
||||||
testEventDate, testEventTime, testLocation,
|
testEventDate, testEventTime, testLocation,
|
||||||
testIsArticle, args.language)
|
testIsArticle, args.language, conversationId)
|
||||||
createPublicPost(baseDir, nickname, domain, port, httpPrefix,
|
createPublicPost(baseDir, nickname, domain, port, httpPrefix,
|
||||||
"And they would have gotten away with it too" +
|
"And they would have gotten away with it too" +
|
||||||
"if it wasn't for those pesky hackers",
|
"if it wasn't for those pesky hackers",
|
||||||
|
@ -2469,7 +2474,7 @@ if args.testdata:
|
||||||
testInReplyTo, testInReplyToAtomUri,
|
testInReplyTo, testInReplyToAtomUri,
|
||||||
testSubject, testSchedulePost,
|
testSubject, testSchedulePost,
|
||||||
testEventDate, testEventTime, testLocation,
|
testEventDate, testEventTime, testLocation,
|
||||||
testIsArticle, args.language)
|
testIsArticle, args.language, conversationId)
|
||||||
createPublicPost(baseDir, nickname, domain, port, httpPrefix,
|
createPublicPost(baseDir, nickname, domain, port, httpPrefix,
|
||||||
"man these centralized sites are like the worst!",
|
"man these centralized sites are like the worst!",
|
||||||
testFollowersOnly,
|
testFollowersOnly,
|
||||||
|
@ -2481,7 +2486,7 @@ if args.testdata:
|
||||||
testInReplyTo, testInReplyToAtomUri,
|
testInReplyTo, testInReplyToAtomUri,
|
||||||
testSubject, testSchedulePost,
|
testSubject, testSchedulePost,
|
||||||
testEventDate, testEventTime, testLocation,
|
testEventDate, testEventTime, testLocation,
|
||||||
testIsArticle, args.language)
|
testIsArticle, args.language, conversationId)
|
||||||
createPublicPost(baseDir, nickname, domain, port, httpPrefix,
|
createPublicPost(baseDir, nickname, domain, port, httpPrefix,
|
||||||
"another mystery solved #test",
|
"another mystery solved #test",
|
||||||
testFollowersOnly,
|
testFollowersOnly,
|
||||||
|
@ -2493,7 +2498,7 @@ if args.testdata:
|
||||||
testInReplyTo, testInReplyToAtomUri,
|
testInReplyTo, testInReplyToAtomUri,
|
||||||
testSubject, testSchedulePost,
|
testSubject, testSchedulePost,
|
||||||
testEventDate, testEventTime, testLocation,
|
testEventDate, testEventTime, testLocation,
|
||||||
testIsArticle, args.language)
|
testIsArticle, args.language, conversationId)
|
||||||
createPublicPost(baseDir, nickname, domain, port, httpPrefix,
|
createPublicPost(baseDir, nickname, domain, port, httpPrefix,
|
||||||
"let's go bowling",
|
"let's go bowling",
|
||||||
testFollowersOnly,
|
testFollowersOnly,
|
||||||
|
@ -2505,7 +2510,7 @@ if args.testdata:
|
||||||
testInReplyTo, testInReplyToAtomUri,
|
testInReplyTo, testInReplyToAtomUri,
|
||||||
testSubject, testSchedulePost,
|
testSubject, testSchedulePost,
|
||||||
testEventDate, testEventTime, testLocation,
|
testEventDate, testEventTime, testLocation,
|
||||||
testIsArticle, args.language)
|
testIsArticle, args.language, conversationId)
|
||||||
domainFull = domain + ':' + str(port)
|
domainFull = domain + ':' + str(port)
|
||||||
clearFollows(baseDir, nickname, domain)
|
clearFollows(baseDir, nickname, domain)
|
||||||
followPerson(baseDir, nickname, domain, 'maxboardroom', domainFull,
|
followPerson(baseDir, nickname, domain, 'maxboardroom', domainFull,
|
||||||
|
|
3
inbox.py
3
inbox.py
|
@ -2111,6 +2111,7 @@ def _bounceDM(senderPostId: str, session, httpPrefix: str,
|
||||||
eventDate = None
|
eventDate = None
|
||||||
eventTime = None
|
eventTime = None
|
||||||
location = None
|
location = None
|
||||||
|
conversationId = None
|
||||||
postJsonObject = \
|
postJsonObject = \
|
||||||
createDirectMessagePost(baseDir, nickname, domain, port,
|
createDirectMessagePost(baseDir, nickname, domain, port,
|
||||||
httpPrefix, content, followersOnly,
|
httpPrefix, content, followersOnly,
|
||||||
|
@ -2121,7 +2122,7 @@ def _bounceDM(senderPostId: str, session, httpPrefix: str,
|
||||||
inReplyTo, inReplyToAtomUri,
|
inReplyTo, inReplyToAtomUri,
|
||||||
subject, debug, schedulePost,
|
subject, debug, schedulePost,
|
||||||
eventDate, eventTime, location,
|
eventDate, eventTime, location,
|
||||||
systemLanguage)
|
systemLanguage, conversationId)
|
||||||
if not postJsonObject:
|
if not postJsonObject:
|
||||||
print('WARN: unable to create bounce message to ' + sendingHandle)
|
print('WARN: unable to create bounce message to ' + sendingHandle)
|
||||||
return False
|
return False
|
||||||
|
|
|
@ -594,13 +594,15 @@ def _convertRSStoActivityPub(baseDir: str, httpPrefix: str,
|
||||||
mediaType = None
|
mediaType = None
|
||||||
imageDescription = None
|
imageDescription = None
|
||||||
city = 'London, England'
|
city = 'London, England'
|
||||||
|
conversationId = None
|
||||||
blog = createNewsPost(baseDir,
|
blog = createNewsPost(baseDir,
|
||||||
domain, port, httpPrefix,
|
domain, port, httpPrefix,
|
||||||
rssDescription,
|
rssDescription,
|
||||||
followersOnly, saveToFile,
|
followersOnly, saveToFile,
|
||||||
attachImageFilename, mediaType,
|
attachImageFilename, mediaType,
|
||||||
imageDescription, city,
|
imageDescription, city,
|
||||||
rssTitle, systemLanguage)
|
rssTitle, systemLanguage,
|
||||||
|
conversationId)
|
||||||
if not blog:
|
if not blog:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
|
69
posts.py
69
posts.py
|
@ -915,7 +915,8 @@ def _createPostS2S(baseDir: str, nickname: str, domain: str, port: int,
|
||||||
tags: [], attachImageFilename: str,
|
tags: [], attachImageFilename: str,
|
||||||
mediaType: str, imageDescription: str, city: str,
|
mediaType: str, imageDescription: str, city: str,
|
||||||
postObjectType: str, summary: str,
|
postObjectType: str, summary: str,
|
||||||
inReplyToAtomUri: str, systemLanguage: str) -> {}:
|
inReplyToAtomUri: str, systemLanguage: str,
|
||||||
|
conversationId: str) -> {}:
|
||||||
"""Creates a new server-to-server post
|
"""Creates a new server-to-server post
|
||||||
"""
|
"""
|
||||||
actorUrl = httpPrefix + '://' + domain + '/users/' + nickname
|
actorUrl = httpPrefix + '://' + domain + '/users/' + nickname
|
||||||
|
@ -926,6 +927,8 @@ def _createPostS2S(baseDir: str, nickname: str, domain: str, port: int,
|
||||||
httpPrefix + '://' + domain + '/@' + nickname + '/' + statusNumber
|
httpPrefix + '://' + domain + '/@' + nickname + '/' + statusNumber
|
||||||
newPostAttributedTo = \
|
newPostAttributedTo = \
|
||||||
httpPrefix + '://' + domain + '/users/' + nickname
|
httpPrefix + '://' + domain + '/users/' + nickname
|
||||||
|
if not conversationId:
|
||||||
|
conversationId = newPostId
|
||||||
newPost = {
|
newPost = {
|
||||||
'@context': postContext,
|
'@context': postContext,
|
||||||
'id': newPostId + '/activity',
|
'id': newPostId + '/activity',
|
||||||
|
@ -936,6 +939,7 @@ def _createPostS2S(baseDir: str, nickname: str, domain: str, port: int,
|
||||||
'cc': toCC,
|
'cc': toCC,
|
||||||
'object': {
|
'object': {
|
||||||
'id': newPostId,
|
'id': newPostId,
|
||||||
|
'conversation': conversationId,
|
||||||
'type': postObjectType,
|
'type': postObjectType,
|
||||||
'summary': summary,
|
'summary': summary,
|
||||||
'inReplyTo': inReplyTo,
|
'inReplyTo': inReplyTo,
|
||||||
|
@ -983,7 +987,8 @@ def _createPostC2S(baseDir: str, nickname: str, domain: str, port: int,
|
||||||
tags: [], attachImageFilename: str,
|
tags: [], attachImageFilename: str,
|
||||||
mediaType: str, imageDescription: str, city: str,
|
mediaType: str, imageDescription: str, city: str,
|
||||||
postObjectType: str, summary: str,
|
postObjectType: str, summary: str,
|
||||||
inReplyToAtomUri: str, systemLanguage: str) -> {}:
|
inReplyToAtomUri: str, systemLanguage: str,
|
||||||
|
conversationId: str) -> {}:
|
||||||
"""Creates a new client-to-server post
|
"""Creates a new client-to-server post
|
||||||
"""
|
"""
|
||||||
idStr = \
|
idStr = \
|
||||||
|
@ -991,9 +996,12 @@ def _createPostC2S(baseDir: str, nickname: str, domain: str, port: int,
|
||||||
'/statuses/' + statusNumber + '/replies'
|
'/statuses/' + statusNumber + '/replies'
|
||||||
newPostUrl = \
|
newPostUrl = \
|
||||||
httpPrefix + '://' + domain + '/@' + nickname + '/' + statusNumber
|
httpPrefix + '://' + domain + '/@' + nickname + '/' + statusNumber
|
||||||
|
if not conversationId:
|
||||||
|
conversationId = newPostId
|
||||||
newPost = {
|
newPost = {
|
||||||
"@context": postContext,
|
"@context": postContext,
|
||||||
'id': newPostId,
|
'id': newPostId,
|
||||||
|
'conversation': conversationId,
|
||||||
'type': postObjectType,
|
'type': postObjectType,
|
||||||
'summary': summary,
|
'summary': summary,
|
||||||
'inReplyTo': inReplyTo,
|
'inReplyTo': inReplyTo,
|
||||||
|
@ -1153,7 +1161,8 @@ def _createPostBase(baseDir: str, nickname: str, domain: str, port: int,
|
||||||
repliesModerationOption: str,
|
repliesModerationOption: str,
|
||||||
anonymousParticipationEnabled: bool,
|
anonymousParticipationEnabled: bool,
|
||||||
eventStatus: str, ticketUrl: str,
|
eventStatus: str, ticketUrl: str,
|
||||||
systemLanguage: str) -> {}:
|
systemLanguage: str,
|
||||||
|
conversationId: str) -> {}:
|
||||||
"""Creates a message
|
"""Creates a message
|
||||||
"""
|
"""
|
||||||
content = removeInvalidChars(content)
|
content = removeInvalidChars(content)
|
||||||
|
@ -1282,7 +1291,8 @@ def _createPostBase(baseDir: str, nickname: str, domain: str, port: int,
|
||||||
tags, attachImageFilename,
|
tags, attachImageFilename,
|
||||||
mediaType, imageDescription, city,
|
mediaType, imageDescription, city,
|
||||||
postObjectType, summary,
|
postObjectType, summary,
|
||||||
inReplyToAtomUri, systemLanguage)
|
inReplyToAtomUri, systemLanguage,
|
||||||
|
conversationId)
|
||||||
else:
|
else:
|
||||||
newPost = \
|
newPost = \
|
||||||
_createPostC2S(baseDir, nickname, domain, port,
|
_createPostC2S(baseDir, nickname, domain, port,
|
||||||
|
@ -1293,7 +1303,8 @@ def _createPostBase(baseDir: str, nickname: str, domain: str, port: int,
|
||||||
tags, attachImageFilename,
|
tags, attachImageFilename,
|
||||||
mediaType, imageDescription, city,
|
mediaType, imageDescription, city,
|
||||||
postObjectType, summary,
|
postObjectType, summary,
|
||||||
inReplyToAtomUri, systemLanguage)
|
inReplyToAtomUri, systemLanguage,
|
||||||
|
conversationId)
|
||||||
|
|
||||||
_createPostMentions(ccUrl, newPost, toRecipients, tags)
|
_createPostMentions(ccUrl, newPost, toRecipients, tags)
|
||||||
|
|
||||||
|
@ -1532,7 +1543,8 @@ def createPublicPost(baseDir: str,
|
||||||
eventDate: str, eventTime: str,
|
eventDate: str, eventTime: str,
|
||||||
location: str,
|
location: str,
|
||||||
isArticle: bool,
|
isArticle: bool,
|
||||||
systemLanguage: str) -> {}:
|
systemLanguage: str,
|
||||||
|
conversationId: str) -> {}:
|
||||||
"""Public post
|
"""Public post
|
||||||
"""
|
"""
|
||||||
domainFull = getFullDomain(domain, port)
|
domainFull = getFullDomain(domain, port)
|
||||||
|
@ -1562,7 +1574,8 @@ def createPublicPost(baseDir: str,
|
||||||
maximumAttendeeCapacity,
|
maximumAttendeeCapacity,
|
||||||
repliesModerationOption,
|
repliesModerationOption,
|
||||||
anonymousParticipationEnabled,
|
anonymousParticipationEnabled,
|
||||||
eventStatus, ticketUrl, systemLanguage)
|
eventStatus, ticketUrl, systemLanguage,
|
||||||
|
conversationId)
|
||||||
|
|
||||||
|
|
||||||
def _appendCitationsToBlogPost(baseDir: str,
|
def _appendCitationsToBlogPost(baseDir: str,
|
||||||
|
@ -1604,7 +1617,8 @@ def createBlogPost(baseDir: str,
|
||||||
inReplyTo: str, inReplyToAtomUri: str,
|
inReplyTo: str, inReplyToAtomUri: str,
|
||||||
subject: str, schedulePost: bool,
|
subject: str, schedulePost: bool,
|
||||||
eventDate: str, eventTime: str,
|
eventDate: str, eventTime: str,
|
||||||
location: str, systemLanguage: str) -> {}:
|
location: str, systemLanguage: str,
|
||||||
|
conversationId: str) -> {}:
|
||||||
blogJson = \
|
blogJson = \
|
||||||
createPublicPost(baseDir,
|
createPublicPost(baseDir,
|
||||||
nickname, domain, port, httpPrefix,
|
nickname, domain, port, httpPrefix,
|
||||||
|
@ -1615,7 +1629,7 @@ def createBlogPost(baseDir: str,
|
||||||
inReplyTo, inReplyToAtomUri, subject,
|
inReplyTo, inReplyToAtomUri, subject,
|
||||||
schedulePost,
|
schedulePost,
|
||||||
eventDate, eventTime, location,
|
eventDate, eventTime, location,
|
||||||
True, systemLanguage)
|
True, systemLanguage, conversationId)
|
||||||
blogJson['object']['url'] = \
|
blogJson['object']['url'] = \
|
||||||
blogJson['object']['url'].replace('/@', '/users/')
|
blogJson['object']['url'].replace('/@', '/users/')
|
||||||
_appendCitationsToBlogPost(baseDir, nickname, domain, blogJson)
|
_appendCitationsToBlogPost(baseDir, nickname, domain, blogJson)
|
||||||
|
@ -1628,7 +1642,8 @@ def createNewsPost(baseDir: str,
|
||||||
content: str, followersOnly: bool, saveToFile: bool,
|
content: str, followersOnly: bool, saveToFile: bool,
|
||||||
attachImageFilename: str, mediaType: str,
|
attachImageFilename: str, mediaType: str,
|
||||||
imageDescription: str, city: str,
|
imageDescription: str, city: str,
|
||||||
subject: str, systemLanguage: str) -> {}:
|
subject: str, systemLanguage: str,
|
||||||
|
conversationId: str) -> {}:
|
||||||
clientToServer = False
|
clientToServer = False
|
||||||
inReplyTo = None
|
inReplyTo = None
|
||||||
inReplyToAtomUri = None
|
inReplyToAtomUri = None
|
||||||
|
@ -1646,7 +1661,7 @@ def createNewsPost(baseDir: str,
|
||||||
inReplyTo, inReplyToAtomUri, subject,
|
inReplyTo, inReplyToAtomUri, subject,
|
||||||
schedulePost,
|
schedulePost,
|
||||||
eventDate, eventTime, location,
|
eventDate, eventTime, location,
|
||||||
True, systemLanguage)
|
True, systemLanguage, conversationId)
|
||||||
blog['object']['type'] = 'Article'
|
blog['object']['type'] = 'Article'
|
||||||
return blog
|
return blog
|
||||||
|
|
||||||
|
@ -1675,7 +1690,8 @@ def createQuestionPost(baseDir: str,
|
||||||
False, False, None, None, subject,
|
False, False, None, None, subject,
|
||||||
False, None, None, None, None, None,
|
False, None, None, None, None, None,
|
||||||
None, None, None,
|
None, None, None,
|
||||||
None, None, None, None, None, systemLanguage)
|
None, None, None, None, None, systemLanguage,
|
||||||
|
None)
|
||||||
messageJson['object']['type'] = 'Question'
|
messageJson['object']['type'] = 'Question'
|
||||||
messageJson['object']['oneOf'] = []
|
messageJson['object']['oneOf'] = []
|
||||||
messageJson['object']['votersCount'] = 0
|
messageJson['object']['votersCount'] = 0
|
||||||
|
@ -1706,7 +1722,8 @@ def createUnlistedPost(baseDir: str,
|
||||||
inReplyTo: str, inReplyToAtomUri: str,
|
inReplyTo: str, inReplyToAtomUri: str,
|
||||||
subject: str, schedulePost: bool,
|
subject: str, schedulePost: bool,
|
||||||
eventDate: str, eventTime: str,
|
eventDate: str, eventTime: str,
|
||||||
location: str, systemLanguage: str) -> {}:
|
location: str, systemLanguage: str,
|
||||||
|
conversationId: str) -> {}:
|
||||||
"""Unlisted post. This has the #Public and followers links inverted.
|
"""Unlisted post. This has the #Public and followers links inverted.
|
||||||
"""
|
"""
|
||||||
domainFull = getFullDomain(domain, port)
|
domainFull = getFullDomain(domain, port)
|
||||||
|
@ -1722,7 +1739,8 @@ def createUnlistedPost(baseDir: str,
|
||||||
inReplyTo, inReplyToAtomUri, subject,
|
inReplyTo, inReplyToAtomUri, subject,
|
||||||
schedulePost, eventDate, eventTime, location,
|
schedulePost, eventDate, eventTime, location,
|
||||||
None, None, None, None, None,
|
None, None, None, None, None,
|
||||||
None, None, None, None, None, systemLanguage)
|
None, None, None, None, None, systemLanguage,
|
||||||
|
conversationId)
|
||||||
|
|
||||||
|
|
||||||
def createFollowersOnlyPost(baseDir: str,
|
def createFollowersOnlyPost(baseDir: str,
|
||||||
|
@ -1737,7 +1755,8 @@ def createFollowersOnlyPost(baseDir: str,
|
||||||
inReplyToAtomUri: str,
|
inReplyToAtomUri: str,
|
||||||
subject: str, schedulePost: bool,
|
subject: str, schedulePost: bool,
|
||||||
eventDate: str, eventTime: str,
|
eventDate: str, eventTime: str,
|
||||||
location: str, systemLanguage: str) -> {}:
|
location: str, systemLanguage: str,
|
||||||
|
conversationId: str) -> {}:
|
||||||
"""Followers only post
|
"""Followers only post
|
||||||
"""
|
"""
|
||||||
domainFull = getFullDomain(domain, port)
|
domainFull = getFullDomain(domain, port)
|
||||||
|
@ -1753,7 +1772,8 @@ def createFollowersOnlyPost(baseDir: str,
|
||||||
inReplyTo, inReplyToAtomUri, subject,
|
inReplyTo, inReplyToAtomUri, subject,
|
||||||
schedulePost, eventDate, eventTime, location,
|
schedulePost, eventDate, eventTime, location,
|
||||||
None, None, None, None, None,
|
None, None, None, None, None,
|
||||||
None, None, None, None, None, systemLanguage)
|
None, None, None, None, None, systemLanguage,
|
||||||
|
conversationId)
|
||||||
|
|
||||||
|
|
||||||
def getMentionedPeople(baseDir: str, httpPrefix: str,
|
def getMentionedPeople(baseDir: str, httpPrefix: str,
|
||||||
|
@ -1805,7 +1825,8 @@ def createDirectMessagePost(baseDir: str,
|
||||||
subject: str, debug: bool,
|
subject: str, debug: bool,
|
||||||
schedulePost: bool,
|
schedulePost: bool,
|
||||||
eventDate: str, eventTime: str,
|
eventDate: str, eventTime: str,
|
||||||
location: str, systemLanguage: str) -> {}:
|
location: str, systemLanguage: str,
|
||||||
|
conversationId: str) -> {}:
|
||||||
"""Direct Message post
|
"""Direct Message post
|
||||||
"""
|
"""
|
||||||
content = resolvePetnames(baseDir, nickname, domain, content)
|
content = resolvePetnames(baseDir, nickname, domain, content)
|
||||||
|
@ -1828,7 +1849,8 @@ def createDirectMessagePost(baseDir: str,
|
||||||
inReplyTo, inReplyToAtomUri, subject,
|
inReplyTo, inReplyToAtomUri, subject,
|
||||||
schedulePost, eventDate, eventTime, location,
|
schedulePost, eventDate, eventTime, location,
|
||||||
None, None, None, None, None,
|
None, None, None, None, None,
|
||||||
None, None, None, None, None, systemLanguage)
|
None, None, None, None, None, systemLanguage,
|
||||||
|
conversationId)
|
||||||
# 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']
|
||||||
|
@ -1918,7 +1940,8 @@ def createReportPost(baseDir: str,
|
||||||
True, False, None, None, subject,
|
True, False, None, None, subject,
|
||||||
False, None, None, None, None, None,
|
False, None, None, None, None, None,
|
||||||
None, None, None,
|
None, None, None,
|
||||||
None, None, None, None, None, systemLanguage)
|
None, None, None, None, None, systemLanguage,
|
||||||
|
None)
|
||||||
if not postJsonObject:
|
if not postJsonObject:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
@ -2014,6 +2037,7 @@ def sendPost(projectVersion: str,
|
||||||
"""Post to another inbox. Used by unit tests.
|
"""Post to another inbox. Used by unit tests.
|
||||||
"""
|
"""
|
||||||
withDigest = True
|
withDigest = True
|
||||||
|
conversationId = None
|
||||||
|
|
||||||
if toNickname == 'inbox':
|
if toNickname == 'inbox':
|
||||||
# shared inbox actor on @domain@domain
|
# shared inbox actor on @domain@domain
|
||||||
|
@ -2069,7 +2093,8 @@ def sendPost(projectVersion: str,
|
||||||
inReplyToAtomUri, subject,
|
inReplyToAtomUri, subject,
|
||||||
False, None, None, None, None, None,
|
False, None, None, None, None, None,
|
||||||
None, None, None,
|
None, None, None,
|
||||||
None, None, None, None, None, systemLanguage)
|
None, None, None, None, None, systemLanguage,
|
||||||
|
conversationId)
|
||||||
|
|
||||||
# get the senders private key
|
# get the senders private key
|
||||||
privateKeyPem = _getPersonKey(nickname, domain, baseDir, 'private')
|
privateKeyPem = _getPersonKey(nickname, domain, baseDir, 'private')
|
||||||
|
@ -2152,6 +2177,7 @@ def sendPostViaServer(projectVersion: str,
|
||||||
debug: bool = False,
|
debug: bool = False,
|
||||||
inReplyTo: str = None,
|
inReplyTo: str = None,
|
||||||
inReplyToAtomUri: str = None,
|
inReplyToAtomUri: str = None,
|
||||||
|
conversationId: str = None,
|
||||||
subject: str = None) -> int:
|
subject: str = None) -> int:
|
||||||
"""Send a post via a proxy (c2s)
|
"""Send a post via a proxy (c2s)
|
||||||
"""
|
"""
|
||||||
|
@ -2230,7 +2256,8 @@ def sendPostViaServer(projectVersion: str,
|
||||||
inReplyToAtomUri, subject,
|
inReplyToAtomUri, subject,
|
||||||
False, None, None, None, None, None,
|
False, None, None, None, None, None,
|
||||||
None, None, None,
|
None, None, None,
|
||||||
None, None, None, None, None, systemLanguage)
|
None, None, None, None, None, systemLanguage,
|
||||||
|
conversationId)
|
||||||
|
|
||||||
authHeader = createBasicAuthHeader(fromNickname, password)
|
authHeader = createBasicAuthHeader(fromNickname, password)
|
||||||
|
|
||||||
|
|
29
tests.py
29
tests.py
|
@ -517,6 +517,7 @@ def createServerAlice(path: str, domain: str, port: int,
|
||||||
testEventTime = None
|
testEventTime = None
|
||||||
testLocation = None
|
testLocation = None
|
||||||
testIsArticle = False
|
testIsArticle = False
|
||||||
|
conversationId = None
|
||||||
createPublicPost(path, nickname, domain, port, httpPrefix,
|
createPublicPost(path, nickname, domain, port, httpPrefix,
|
||||||
"No wise fish would go anywhere without a porpoise",
|
"No wise fish would go anywhere without a porpoise",
|
||||||
testFollowersOnly,
|
testFollowersOnly,
|
||||||
|
@ -529,7 +530,7 @@ def createServerAlice(path: str, domain: str, port: int,
|
||||||
testInReplyTo, testInReplyToAtomUri,
|
testInReplyTo, testInReplyToAtomUri,
|
||||||
testSubject, testSchedulePost,
|
testSubject, testSchedulePost,
|
||||||
testEventDate, testEventTime, testLocation,
|
testEventDate, testEventTime, testLocation,
|
||||||
testIsArticle, systemLanguage)
|
testIsArticle, systemLanguage, conversationId)
|
||||||
createPublicPost(path, nickname, domain, port, httpPrefix,
|
createPublicPost(path, nickname, domain, port, httpPrefix,
|
||||||
"Curiouser and curiouser!",
|
"Curiouser and curiouser!",
|
||||||
testFollowersOnly,
|
testFollowersOnly,
|
||||||
|
@ -542,7 +543,7 @@ def createServerAlice(path: str, domain: str, port: int,
|
||||||
testInReplyTo, testInReplyToAtomUri,
|
testInReplyTo, testInReplyToAtomUri,
|
||||||
testSubject, testSchedulePost,
|
testSubject, testSchedulePost,
|
||||||
testEventDate, testEventTime, testLocation,
|
testEventDate, testEventTime, testLocation,
|
||||||
testIsArticle, systemLanguage)
|
testIsArticle, systemLanguage, conversationId)
|
||||||
createPublicPost(path, nickname, domain, port, httpPrefix,
|
createPublicPost(path, nickname, domain, port, httpPrefix,
|
||||||
"In the gardens of memory, in the palace " +
|
"In the gardens of memory, in the palace " +
|
||||||
"of dreams, that is where you and I shall meet",
|
"of dreams, that is where you and I shall meet",
|
||||||
|
@ -556,7 +557,7 @@ def createServerAlice(path: str, domain: str, port: int,
|
||||||
testInReplyTo, testInReplyToAtomUri,
|
testInReplyTo, testInReplyToAtomUri,
|
||||||
testSubject, testSchedulePost,
|
testSubject, testSchedulePost,
|
||||||
testEventDate, testEventTime, testLocation,
|
testEventDate, testEventTime, testLocation,
|
||||||
testIsArticle, systemLanguage)
|
testIsArticle, systemLanguage, conversationId)
|
||||||
regenerateIndexForBox(path, nickname, domain, 'outbox')
|
regenerateIndexForBox(path, nickname, domain, 'outbox')
|
||||||
global testServerAliceRunning
|
global testServerAliceRunning
|
||||||
testServerAliceRunning = True
|
testServerAliceRunning = True
|
||||||
|
@ -648,6 +649,7 @@ def createServerBob(path: str, domain: str, port: int,
|
||||||
testEventTime = None
|
testEventTime = None
|
||||||
testLocation = None
|
testLocation = None
|
||||||
testIsArticle = False
|
testIsArticle = False
|
||||||
|
conversationId = None
|
||||||
createPublicPost(path, nickname, domain, port, httpPrefix,
|
createPublicPost(path, nickname, domain, port, httpPrefix,
|
||||||
"It's your life, live it your way.",
|
"It's your life, live it your way.",
|
||||||
testFollowersOnly,
|
testFollowersOnly,
|
||||||
|
@ -660,7 +662,7 @@ def createServerBob(path: str, domain: str, port: int,
|
||||||
testInReplyTo, testInReplyToAtomUri,
|
testInReplyTo, testInReplyToAtomUri,
|
||||||
testSubject, testSchedulePost,
|
testSubject, testSchedulePost,
|
||||||
testEventDate, testEventTime, testLocation,
|
testEventDate, testEventTime, testLocation,
|
||||||
testIsArticle, systemLanguage)
|
testIsArticle, systemLanguage, conversationId)
|
||||||
createPublicPost(path, nickname, domain, port, httpPrefix,
|
createPublicPost(path, nickname, domain, port, httpPrefix,
|
||||||
"One of the things I've realised is that " +
|
"One of the things I've realised is that " +
|
||||||
"I am very simple",
|
"I am very simple",
|
||||||
|
@ -674,7 +676,7 @@ def createServerBob(path: str, domain: str, port: int,
|
||||||
testInReplyTo, testInReplyToAtomUri,
|
testInReplyTo, testInReplyToAtomUri,
|
||||||
testSubject, testSchedulePost,
|
testSubject, testSchedulePost,
|
||||||
testEventDate, testEventTime, testLocation,
|
testEventDate, testEventTime, testLocation,
|
||||||
testIsArticle, systemLanguage)
|
testIsArticle, systemLanguage, conversationId)
|
||||||
createPublicPost(path, nickname, domain, port, httpPrefix,
|
createPublicPost(path, nickname, domain, port, httpPrefix,
|
||||||
"Quantum physics is a bit of a passion of mine",
|
"Quantum physics is a bit of a passion of mine",
|
||||||
testFollowersOnly,
|
testFollowersOnly,
|
||||||
|
@ -687,7 +689,7 @@ def createServerBob(path: str, domain: str, port: int,
|
||||||
testInReplyTo, testInReplyToAtomUri,
|
testInReplyTo, testInReplyToAtomUri,
|
||||||
testSubject, testSchedulePost,
|
testSubject, testSchedulePost,
|
||||||
testEventDate, testEventTime, testLocation,
|
testEventDate, testEventTime, testLocation,
|
||||||
testIsArticle, systemLanguage)
|
testIsArticle, systemLanguage, conversationId)
|
||||||
regenerateIndexForBox(path, nickname, domain, 'outbox')
|
regenerateIndexForBox(path, nickname, domain, 'outbox')
|
||||||
global testServerBobRunning
|
global testServerBobRunning
|
||||||
testServerBobRunning = True
|
testServerBobRunning = True
|
||||||
|
@ -2353,6 +2355,7 @@ def _testCreatePerson():
|
||||||
commentsEnabled = True
|
commentsEnabled = True
|
||||||
attachImageFilename = None
|
attachImageFilename = None
|
||||||
mediaType = None
|
mediaType = None
|
||||||
|
conversationId = None
|
||||||
createPublicPost(baseDir, nickname, domain, port, httpPrefix,
|
createPublicPost(baseDir, nickname, domain, port, httpPrefix,
|
||||||
content, followersOnly, saveToFile, clientToServer,
|
content, followersOnly, saveToFile, clientToServer,
|
||||||
commentsEnabled, attachImageFilename, mediaType,
|
commentsEnabled, attachImageFilename, mediaType,
|
||||||
|
@ -2360,7 +2363,7 @@ def _testCreatePerson():
|
||||||
testInReplyTo, testInReplyToAtomUri,
|
testInReplyTo, testInReplyToAtomUri,
|
||||||
testSubject, testSchedulePost,
|
testSubject, testSchedulePost,
|
||||||
testEventDate, testEventTime, testLocation,
|
testEventDate, testEventTime, testLocation,
|
||||||
testIsArticle, systemLanguage)
|
testIsArticle, systemLanguage, conversationId)
|
||||||
|
|
||||||
os.chdir(currDir)
|
os.chdir(currDir)
|
||||||
shutil.rmtree(baseDir)
|
shutil.rmtree(baseDir)
|
||||||
|
@ -2495,6 +2498,7 @@ def testClientToServer():
|
||||||
cachedWebfingers = {}
|
cachedWebfingers = {}
|
||||||
personCache = {}
|
personCache = {}
|
||||||
password = 'alicepass'
|
password = 'alicepass'
|
||||||
|
conversationId = None
|
||||||
outboxPath = aliceDir + '/accounts/alice@' + aliceDomain + '/outbox'
|
outboxPath = aliceDir + '/accounts/alice@' + aliceDomain + '/outbox'
|
||||||
inboxPath = bobDir + '/accounts/bob@' + bobDomain + '/inbox'
|
inboxPath = bobDir + '/accounts/bob@' + bobDomain + '/inbox'
|
||||||
assert len([name for name in os.listdir(outboxPath)
|
assert len([name for name in os.listdir(outboxPath)
|
||||||
|
@ -2511,7 +2515,8 @@ def testClientToServer():
|
||||||
attachedImageFilename, mediaType,
|
attachedImageFilename, mediaType,
|
||||||
attachedImageDescription, city,
|
attachedImageDescription, city,
|
||||||
cachedWebfingers, personCache, isArticle,
|
cachedWebfingers, personCache, isArticle,
|
||||||
systemLanguage, True, None, None, None)
|
systemLanguage, True, None, None,
|
||||||
|
conversationId, None)
|
||||||
print('sendResult: ' + str(sendResult))
|
print('sendResult: ' + str(sendResult))
|
||||||
|
|
||||||
for i in range(30):
|
for i in range(30):
|
||||||
|
@ -3753,6 +3758,7 @@ def _testReplyToPublicPost() -> None:
|
||||||
testEventTime = None
|
testEventTime = None
|
||||||
testLocation = None
|
testLocation = None
|
||||||
testIsArticle = False
|
testIsArticle = False
|
||||||
|
conversationId = None
|
||||||
reply = \
|
reply = \
|
||||||
createPublicPost(baseDir, nickname, domain, port, httpPrefix,
|
createPublicPost(baseDir, nickname, domain, port, httpPrefix,
|
||||||
content, followersOnly, saveToFile,
|
content, followersOnly, saveToFile,
|
||||||
|
@ -3762,7 +3768,7 @@ def _testReplyToPublicPost() -> None:
|
||||||
testInReplyToAtomUri,
|
testInReplyToAtomUri,
|
||||||
testSubject, testSchedulePost,
|
testSubject, testSchedulePost,
|
||||||
testEventDate, testEventTime, testLocation,
|
testEventDate, testEventTime, testLocation,
|
||||||
testIsArticle, systemLanguage)
|
testIsArticle, systemLanguage, conversationId)
|
||||||
# print(str(reply))
|
# print(str(reply))
|
||||||
assert reply['object']['content'] == \
|
assert reply['object']['content'] == \
|
||||||
'<p><span class=\"h-card\">' + \
|
'<p><span class=\"h-card\">' + \
|
||||||
|
@ -4283,6 +4289,7 @@ def _testLinksWithinPost() -> None:
|
||||||
testEventTime = None
|
testEventTime = None
|
||||||
testLocation = None
|
testLocation = None
|
||||||
testIsArticle = False
|
testIsArticle = False
|
||||||
|
conversationId = None
|
||||||
|
|
||||||
postJsonObject = \
|
postJsonObject = \
|
||||||
createPublicPost(baseDir, nickname, domain, port, httpPrefix,
|
createPublicPost(baseDir, nickname, domain, port, httpPrefix,
|
||||||
|
@ -4293,7 +4300,7 @@ def _testLinksWithinPost() -> None:
|
||||||
testInReplyTo, testInReplyToAtomUri,
|
testInReplyTo, testInReplyToAtomUri,
|
||||||
testSubject, testSchedulePost,
|
testSubject, testSchedulePost,
|
||||||
testEventDate, testEventTime, testLocation,
|
testEventDate, testEventTime, testLocation,
|
||||||
testIsArticle, systemLanguage)
|
testIsArticle, systemLanguage, conversationId)
|
||||||
|
|
||||||
assert postJsonObject['object']['content'] == \
|
assert postJsonObject['object']['content'] == \
|
||||||
'<p>This is a test post with links.<br><br>' + \
|
'<p>This is a test post with links.<br><br>' + \
|
||||||
|
@ -4329,7 +4336,7 @@ def _testLinksWithinPost() -> None:
|
||||||
testInReplyTo, testInReplyToAtomUri,
|
testInReplyTo, testInReplyToAtomUri,
|
||||||
testSubject, testSchedulePost,
|
testSubject, testSchedulePost,
|
||||||
testEventDate, testEventTime, testLocation,
|
testEventDate, testEventTime, testLocation,
|
||||||
testIsArticle, systemLanguage)
|
testIsArticle, systemLanguage, conversationId)
|
||||||
assert postJsonObject['object']['content'] == content
|
assert postJsonObject['object']['content'] == content
|
||||||
assert postJsonObject['object']['contentMap'][systemLanguage] == content
|
assert postJsonObject['object']['contentMap'][systemLanguage] == content
|
||||||
|
|
||||||
|
|
|
@ -184,7 +184,8 @@ def htmlNewPost(cssCache: {}, mediaInstance: bool, translate: {},
|
||||||
domainFull: str,
|
domainFull: str,
|
||||||
defaultTimeline: str, newswire: {},
|
defaultTimeline: str, newswire: {},
|
||||||
theme: str, noDropDown: bool,
|
theme: str, noDropDown: bool,
|
||||||
accessKeys: {}, customSubmitText: str) -> str:
|
accessKeys: {}, customSubmitText: str,
|
||||||
|
conversationId: str) -> str:
|
||||||
"""New post screen
|
"""New post screen
|
||||||
"""
|
"""
|
||||||
replyStr = ''
|
replyStr = ''
|
||||||
|
@ -541,6 +542,12 @@ def htmlNewPost(cssCache: {}, mediaInstance: bool, translate: {},
|
||||||
dropdownFollowersSuffix += '?mention=' + mentionedActor
|
dropdownFollowersSuffix += '?mention=' + mentionedActor
|
||||||
dropdownDMSuffix += '?mention=' + mentionedActor
|
dropdownDMSuffix += '?mention=' + mentionedActor
|
||||||
dropdownReportSuffix += '?mention=' + mentionedActor
|
dropdownReportSuffix += '?mention=' + mentionedActor
|
||||||
|
if conversationId and inReplyTo:
|
||||||
|
dropdownNewPostSuffix += '?conversationId=' + conversationId
|
||||||
|
dropdownNewBlogSuffix += '?conversationId=' + conversationId
|
||||||
|
dropdownUnlistedSuffix += '?conversationId=' + conversationId
|
||||||
|
dropdownFollowersSuffix += '?conversationId=' + conversationId
|
||||||
|
dropdownDMSuffix += '?conversationId=' + conversationId
|
||||||
|
|
||||||
dropDownContent = ''
|
dropDownContent = ''
|
||||||
if not reportUrl and not shareDescription:
|
if not reportUrl and not shareDescription:
|
||||||
|
@ -568,6 +575,10 @@ def htmlNewPost(cssCache: {}, mediaInstance: bool, translate: {},
|
||||||
'<form enctype="multipart/form-data" method="POST" ' + \
|
'<form enctype="multipart/form-data" method="POST" ' + \
|
||||||
'accept-charset="UTF-8" action="' + \
|
'accept-charset="UTF-8" action="' + \
|
||||||
path + '?' + endpoint + '?page=' + str(pageNumber) + '">\n'
|
path + '?' + endpoint + '?page=' + str(pageNumber) + '">\n'
|
||||||
|
if conversationId:
|
||||||
|
newPostForm += \
|
||||||
|
' <input type="hidden" name="conversationId" value="' + \
|
||||||
|
conversationId + '">'
|
||||||
newPostForm += ' <div class="vertical-center">\n'
|
newPostForm += ' <div class="vertical-center">\n'
|
||||||
newPostForm += \
|
newPostForm += \
|
||||||
' <label for="nickname"><b>' + newPostText + '</b></label>\n'
|
' <label for="nickname"><b>' + newPostText + '</b></label>\n'
|
||||||
|
|
|
@ -276,7 +276,8 @@ def _getAvatarImageHtml(showAvatarOptions: bool,
|
||||||
def _getReplyIconHtml(nickname: str, isPublicRepeat: bool,
|
def _getReplyIconHtml(nickname: str, isPublicRepeat: bool,
|
||||||
showIcons: bool, commentsEnabled: bool,
|
showIcons: bool, commentsEnabled: bool,
|
||||||
postJsonObject: {}, pageNumberParam: str,
|
postJsonObject: {}, pageNumberParam: str,
|
||||||
translate: {}, systemLanguage: str) -> str:
|
translate: {}, systemLanguage: str,
|
||||||
|
conversationId: str) -> str:
|
||||||
"""Returns html for the reply icon/button
|
"""Returns html for the reply icon/button
|
||||||
"""
|
"""
|
||||||
replyStr = ''
|
replyStr = ''
|
||||||
|
@ -302,11 +303,15 @@ def _getReplyIconHtml(nickname: str, isPublicRepeat: bool,
|
||||||
|
|
||||||
replyStr = ''
|
replyStr = ''
|
||||||
replyToThisPostStr = translate['Reply to this post']
|
replyToThisPostStr = translate['Reply to this post']
|
||||||
|
conversationStr = ''
|
||||||
|
if conversationId:
|
||||||
|
conversationStr = '?conversationId=' + conversationId
|
||||||
if isPublicRepeat:
|
if isPublicRepeat:
|
||||||
replyStr += \
|
replyStr += \
|
||||||
' <a class="imageAnchor" href="/users/' + \
|
' <a class="imageAnchor" href="/users/' + \
|
||||||
nickname + '?replyto=' + replyToLink + \
|
nickname + '?replyto=' + replyToLink + \
|
||||||
'?actor=' + postJsonObject['actor'] + \
|
'?actor=' + postJsonObject['actor'] + \
|
||||||
|
conversationStr + \
|
||||||
'" title="' + replyToThisPostStr + '">\n'
|
'" title="' + replyToThisPostStr + '">\n'
|
||||||
else:
|
else:
|
||||||
if isDM(postJsonObject):
|
if isDM(postJsonObject):
|
||||||
|
@ -315,6 +320,7 @@ def _getReplyIconHtml(nickname: str, isPublicRepeat: bool,
|
||||||
'<a class="imageAnchor" href="/users/' + nickname + \
|
'<a class="imageAnchor" href="/users/' + nickname + \
|
||||||
'?replydm=' + replyToLink + \
|
'?replydm=' + replyToLink + \
|
||||||
'?actor=' + postJsonObject['actor'] + \
|
'?actor=' + postJsonObject['actor'] + \
|
||||||
|
conversationStr + \
|
||||||
'" title="' + replyToThisPostStr + '">\n'
|
'" title="' + replyToThisPostStr + '">\n'
|
||||||
else:
|
else:
|
||||||
replyStr += \
|
replyStr += \
|
||||||
|
@ -322,6 +328,7 @@ def _getReplyIconHtml(nickname: str, isPublicRepeat: bool,
|
||||||
'<a class="imageAnchor" href="/users/' + nickname + \
|
'<a class="imageAnchor" href="/users/' + nickname + \
|
||||||
'?replyfollowers=' + replyToLink + \
|
'?replyfollowers=' + replyToLink + \
|
||||||
'?actor=' + postJsonObject['actor'] + \
|
'?actor=' + postJsonObject['actor'] + \
|
||||||
|
conversationStr + \
|
||||||
'" title="' + replyToThisPostStr + '">\n'
|
'" title="' + replyToThisPostStr + '">\n'
|
||||||
|
|
||||||
replyStr += \
|
replyStr += \
|
||||||
|
@ -1350,10 +1357,15 @@ def individualPostAsHtml(allowDownloads: bool,
|
||||||
if postJsonObject['object']['rejectReplies']:
|
if postJsonObject['object']['rejectReplies']:
|
||||||
commentsEnabled = False
|
commentsEnabled = False
|
||||||
|
|
||||||
|
conversationId = None
|
||||||
|
if postJsonObject['object']['conversation']:
|
||||||
|
conversationId = postJsonObject['object']['conversation']
|
||||||
|
|
||||||
replyStr = _getReplyIconHtml(nickname, isPublicRepeat,
|
replyStr = _getReplyIconHtml(nickname, isPublicRepeat,
|
||||||
showIcons, commentsEnabled,
|
showIcons, commentsEnabled,
|
||||||
postJsonObject, pageNumberParam,
|
postJsonObject, pageNumberParam,
|
||||||
translate, systemLanguage)
|
translate, systemLanguage,
|
||||||
|
conversationId)
|
||||||
|
|
||||||
_logPostTiming(enableTimingLog, postStartTime, '10')
|
_logPostTiming(enableTimingLog, postStartTime, '10')
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue