Different media types

master
Bob Mottram 2019-08-30 16:50:20 +01:00
parent 80e4779d44
commit 2ad1b51f9a
5 changed files with 96 additions and 41 deletions

View File

@ -1802,6 +1802,7 @@ class PubServer(BaseHTTPRequestHandler):
messageFields=msg.get_payload(decode=False).split(boundary) messageFields=msg.get_payload(decode=False).split(boundary)
fields={} fields={}
filename=None filename=None
attachmentMediaType=None
for f in messageFields: for f in messageFields:
if f=='--': if f=='--':
continue continue
@ -1837,6 +1838,7 @@ class PubServer(BaseHTTPRequestHandler):
if extension=='jpeg': if extension=='jpeg':
extension='jpg' extension='jpg'
filename=filenameBase+'.'+extension filename=filenameBase+'.'+extension
attachmentMediaType=mType
break break
if filename and imageLocation>-1: if filename and imageLocation>-1:
# locate the beginning of the image, after any # locate the beginning of the image, after any
@ -1875,7 +1877,7 @@ class PubServer(BaseHTTPRequestHandler):
self.server.domain,self.server.port, \ self.server.domain,self.server.port, \
self.server.httpPrefix, \ self.server.httpPrefix, \
fields['message'],False,False,False, \ fields['message'],False,False,False, \
filename,fields['imageDescription'],True, \ filename,attachmentMediaType,fields['imageDescription'],True, \
fields['replyTo'], fields['replyTo'],fields['subject']) fields['replyTo'], fields['replyTo'],fields['subject'])
if messageJson: if messageJson:
self.postToNickname=nickname self.postToNickname=nickname
@ -1897,7 +1899,7 @@ class PubServer(BaseHTTPRequestHandler):
self.server.domain,self.server.port, \ self.server.domain,self.server.port, \
self.server.httpPrefix, \ self.server.httpPrefix, \
fields['message'],False,False,False, \ fields['message'],False,False,False, \
filename,fields['imageDescription'],True, \ filename,attachmentMediaType,fields['imageDescription'],True, \
fields['replyTo'], fields['replyTo'],fields['subject']) fields['replyTo'], fields['replyTo'],fields['subject'])
if messageJson: if messageJson:
self.postToNickname=nickname self.postToNickname=nickname
@ -1919,7 +1921,7 @@ class PubServer(BaseHTTPRequestHandler):
self.server.domain,self.server.port, \ self.server.domain,self.server.port, \
self.server.httpPrefix, \ self.server.httpPrefix, \
fields['message'],True,False,False, \ fields['message'],True,False,False, \
filename,fields['imageDescription'],True, \ filename,attachmentMediaType,fields['imageDescription'],True, \
fields['replyTo'], fields['replyTo'],fields['subject']) fields['replyTo'], fields['replyTo'],fields['subject'])
if messageJson: if messageJson:
self.postToNickname=nickname self.postToNickname=nickname
@ -1943,7 +1945,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.domain,self.server.port, \ self.server.domain,self.server.port, \
self.server.httpPrefix, \ self.server.httpPrefix, \
fields['message'],True,False,False, \ fields['message'],True,False,False, \
filename,fields['imageDescription'],True, \ filename,attachmentMediaType, \
fields['imageDescription'],True, \
fields['replyTo'],fields['replyTo'], \ fields['replyTo'],fields['replyTo'], \
fields['subject'], \ fields['subject'], \
self.server.debug) self.server.debug)
@ -1963,6 +1966,9 @@ class PubServer(BaseHTTPRequestHandler):
return -1 return -1
if postType=='newreport': if postType=='newreport':
if attachmentMediaType:
if attachmentMediaType!='image':
return -1
# So as to be sure that this only goes to moderators # So as to be sure that this only goes to moderators
# and not accounts being reported we disable any # and not accounts being reported we disable any
# included fediverse addresses by replacing '@' with '-at-' # included fediverse addresses by replacing '@' with '-at-'
@ -1973,7 +1979,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.domain,self.server.port, \ self.server.domain,self.server.port, \
self.server.httpPrefix, \ self.server.httpPrefix, \
fields['message'],True,False,False, \ fields['message'],True,False,False, \
filename,fields['imageDescription'],True, \ filename,attachmentMediaType, \
fields['imageDescription'],True, \
self.server.debug,fields['subject']) self.server.debug,fields['subject'])
if messageJson: if messageJson:
self.postToNickname=nickname self.postToNickname=nickname
@ -1984,13 +1991,16 @@ class PubServer(BaseHTTPRequestHandler):
if postType=='newshare': if postType=='newshare':
if not fields.get('itemType'): if not fields.get('itemType'):
return False return -1
if not fields.get('category'): if not fields.get('category'):
return False return -1
if not fields.get('location'): if not fields.get('location'):
return False return -1
if not fields.get('duration'): if not fields.get('duration'):
return False return -1
if attachmentMediaType:
if attachmentMediaType!='image':
return -1
addShare(self.server.baseDir, \ addShare(self.server.baseDir, \
self.server.httpPrefix, \ self.server.httpPrefix, \
nickname, \ nickname, \

View File

@ -62,6 +62,7 @@ from utils import getNicknameFromActor
from utils import followPerson from utils import followPerson
from utils import validNickname from utils import validNickname
from media import archiveMedia from media import archiveMedia
from media import getAttachmentMediaType
from delete import sendDeleteViaServer from delete import sendDeleteViaServer
from like import sendLikeViaServer from like import sendLikeViaServer
from like import sendUndoLikeViaServer from like import sendUndoLikeViaServer
@ -525,6 +526,9 @@ if args.message:
cachedWebfingers={} cachedWebfingers={}
subject=args.subject subject=args.subject
attach=args.attach attach=args.attach
mediaType=None
if attach:
mediaType=getAttachmentMediaType(attach)
replyTo=args.replyto replyTo=args.replyto
followersOnly=False followersOnly=False
print('Sending post to '+args.sendto) print('Sending post to '+args.sendto)
@ -534,7 +538,8 @@ if args.message:
domain,port, \ domain,port, \
toNickname,toDomain,toPort,ccUrl, \ toNickname,toDomain,toPort,ccUrl, \
httpPrefix,sendMessage,followersOnly, \ httpPrefix,sendMessage,followersOnly, \
attach,attachedImageDescription,useBlurhash, \ attach,mediaType, \
attachedImageDescription,useBlurhash, \
cachedWebfingers,personCache, \ cachedWebfingers,personCache, \
args.debug,replyTo,replyTo,subject) args.debug,replyTo,replyTo,subject)
for i in range(10): for i in range(10):

View File

@ -47,9 +47,29 @@ def getMediaPath() -> str:
currTime=datetime.datetime.utcnow() currTime=datetime.datetime.utcnow()
weeksSinceEpoch=int((currTime - datetime.datetime(1970,1,1)).days/7) weeksSinceEpoch=int((currTime - datetime.datetime(1970,1,1)).days/7)
return 'media/'+str(weeksSinceEpoch) return 'media/'+str(weeksSinceEpoch)
def getAttachmentMediaType(filename: str) -> str:
"""Returns the type of media for the given file
image, video or audio
"""
mediaType=None
imageTypes=['png','jpg','jpeg','gif']
for mType in imageTypes:
if filename.endswith('.'+mType):
return 'image'
videoTypes=['mp4','webm','ogv']
for mType in videoTypes:
if filename.endswith('.'+mType):
return 'video'
audioTypes=['mp3','ogg']
for mType in audioTypes:
if filename.endswith('.'+mType):
return 'audio'
return mediaType
def attachImage(baseDir: str,httpPrefix: str,domain: str,port: int, \ def attachImage(baseDir: str,httpPrefix: str,domain: str,port: int, \
postJson: {},imageFilename: str,description: str, \ postJson: {},imageFilename: str, \
mediaType: str,description: str, \
useBlurhash: bool) -> {}: useBlurhash: bool) -> {}:
"""Attaches an image to a json object post """Attaches an image to a json object post
The description can be None The description can be None
@ -58,14 +78,16 @@ def attachImage(baseDir: str,httpPrefix: str,domain: str,port: int, \
if not isImage(imageFilename): if not isImage(imageFilename):
return postJson return postJson
mediaType='image/png' acceptedTypes=['png','jpg','gif','mp4','webm','ogv','mp3','ogg']
fileExtension='png' for mType in acceptedTypes:
if imageFilename.endswith('.jpg'): if imageFilename.endswith('.'+mType):
mediaType='image/jpeg' fileExtension=mType
if mType=='jpg':
mType='jpeg'
mediaType=mediaType+'/'+fileExtension
if fileExtension=='jpeg':
fileExtension='jpg' fileExtension='jpg'
if imageFilename.endswith('.gif'):
mediaType='image/gif'
fileExtension='gif'
if port: if port:
if port!=80 and port!=443: if port!=80 and port!=443:
@ -84,7 +106,7 @@ def attachImage(baseDir: str,httpPrefix: str,domain: str,port: int, \
'type': 'Document', 'type': 'Document',
'url': httpPrefix+'://'+domain+'/'+mediaPath 'url': httpPrefix+'://'+domain+'/'+mediaPath
} }
if useBlurhash: if useBlurhash and not mediaType.startswith('video'):
attachmentJson['blurhash']=getImageHash(imageFilename) attachmentJson['blurhash']=getImageHash(imageFilename)
postJson['attachment']=[attachmentJson] postJson['attachment']=[attachmentJson]

View File

@ -423,7 +423,7 @@ def updateHashtagsIndex(baseDir: str,tag: {},newPostId: str) -> None:
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, \
attachImageFilename: str,imageDescription: str, \ attachImageFilename: str,mediaType: str,imageDescription: str, \
useBlurhash: bool,isModerationReport: bool,inReplyTo=None, \ useBlurhash: bool,isModerationReport: bool,inReplyTo=None, \
inReplyToAtomUri=None, subject=None) -> {}: inReplyToAtomUri=None, subject=None) -> {}:
"""Creates a message """Creates a message
@ -543,7 +543,7 @@ def createPostBase(baseDir: str,nickname: str, domain: str, port: int, \
newPost['object']= \ newPost['object']= \
attachImage(baseDir,httpPrefix,domain,port, \ attachImage(baseDir,httpPrefix,domain,port, \
newPost['object'],attachImageFilename, \ newPost['object'],attachImageFilename, \
imageDescription,useBlurhash) mediaType,imageDescription,useBlurhash)
else: else:
newPost = { newPost = {
"@context": "https://www.w3.org/ns/activitystreams", "@context": "https://www.w3.org/ns/activitystreams",
@ -579,7 +579,7 @@ def createPostBase(baseDir: str,nickname: str, domain: str, port: int, \
newPost= \ newPost= \
attachImage(baseDir,httpPrefix,domain,port, \ attachImage(baseDir,httpPrefix,domain,port, \
newPost,attachImageFilename, \ newPost,attachImageFilename, \
imageDescription,useBlurhash) mediaType,imageDescription,useBlurhash)
if ccUrl: if ccUrl:
if len(ccUrl)>0: if len(ccUrl)>0:
newPost['cc']=[ccUrl] newPost['cc']=[ccUrl]
@ -707,7 +707,8 @@ def createPublicPost(baseDir: str,
nickname: str, domain: str, port: int,httpPrefix: str, \ nickname: str, domain: str, port: int,httpPrefix: str, \
content: str, followersOnly: bool, saveToFile: bool, content: str, followersOnly: bool, saveToFile: bool,
clientToServer: bool,\ clientToServer: bool,\
attachImageFilename: str,imageDescription: str,useBlurhash: bool, \ attachImageFilename: str,mediaType: str, \
imageDescription: str,useBlurhash: bool, \
inReplyTo=None, inReplyToAtomUri=None, subject=None) -> {}: inReplyTo=None, inReplyToAtomUri=None, subject=None) -> {}:
"""Public post """Public post
""" """
@ -721,14 +722,16 @@ def createPublicPost(baseDir: str,
httpPrefix+'://'+domainFull+'/users/'+nickname+'/followers', \ httpPrefix+'://'+domainFull+'/users/'+nickname+'/followers', \
httpPrefix, content, followersOnly, saveToFile, \ httpPrefix, content, followersOnly, saveToFile, \
clientToServer, \ clientToServer, \
attachImageFilename,imageDescription,useBlurhash, \ attachImageFilename,mediaType, \
imageDescription,useBlurhash, \
False,inReplyTo,inReplyToAtomUri,subject) False,inReplyTo,inReplyToAtomUri,subject)
def createUnlistedPost(baseDir: str, def createUnlistedPost(baseDir: str,
nickname: str, domain: str, port: int,httpPrefix: str, \ nickname: str, domain: str, port: int,httpPrefix: str, \
content: str, followersOnly: bool, saveToFile: bool, content: str, followersOnly: bool, saveToFile: bool,
clientToServer: bool,\ clientToServer: bool,\
attachImageFilename: str,imageDescription: str,useBlurhash: bool, \ attachImageFilename: str,mediaType: str, \
imageDescription: str,useBlurhash: bool, \
inReplyTo=None, inReplyToAtomUri=None, subject=None) -> {}: inReplyTo=None, inReplyToAtomUri=None, subject=None) -> {}:
"""Unlisted post. This has the #Public and followers links inverted. """Unlisted post. This has the #Public and followers links inverted.
""" """
@ -742,14 +745,16 @@ def createUnlistedPost(baseDir: str,
'https://www.w3.org/ns/activitystreams#Public', \ 'https://www.w3.org/ns/activitystreams#Public', \
httpPrefix, content, followersOnly, saveToFile, \ httpPrefix, content, followersOnly, saveToFile, \
clientToServer, \ clientToServer, \
attachImageFilename,imageDescription,useBlurhash, \ attachImageFilename,mediaType, \
imageDescription,useBlurhash, \
False,inReplyTo, inReplyToAtomUri, subject) False,inReplyTo, inReplyToAtomUri, subject)
def createFollowersOnlyPost(baseDir: str, def createFollowersOnlyPost(baseDir: str,
nickname: str, domain: str, port: int,httpPrefix: str, \ nickname: str, domain: str, port: int,httpPrefix: str, \
content: str, followersOnly: bool, saveToFile: bool, content: str, followersOnly: bool, saveToFile: bool,
clientToServer: bool,\ clientToServer: bool,\
attachImageFilename: str,imageDescription: str,useBlurhash: bool, \ attachImageFilename: str,mediaType: str, \
imageDescription: str,useBlurhash: bool, \
inReplyTo=None, inReplyToAtomUri=None, subject=None) -> {}: inReplyTo=None, inReplyToAtomUri=None, subject=None) -> {}:
"""Followers only post """Followers only post
""" """
@ -763,7 +768,8 @@ def createFollowersOnlyPost(baseDir: str,
None, None,
httpPrefix, content, followersOnly, saveToFile, \ httpPrefix, content, followersOnly, saveToFile, \
clientToServer, \ clientToServer, \
attachImageFilename,imageDescription,useBlurhash, \ attachImageFilename,mediaType, \
imageDescription,useBlurhash, \
False,inReplyTo, inReplyToAtomUri, subject) False,inReplyTo, inReplyToAtomUri, subject)
def getMentionedPeople(baseDir: str,httpPrefix: str, \ def getMentionedPeople(baseDir: str,httpPrefix: str, \
@ -801,7 +807,8 @@ def createDirectMessagePost(baseDir: str,
nickname: str, domain: str, port: int,httpPrefix: str, \ nickname: str, domain: str, port: int,httpPrefix: str, \
content: str, followersOnly: bool, saveToFile: bool, content: str, followersOnly: bool, saveToFile: bool,
clientToServer: bool,\ clientToServer: bool,\
attachImageFilename: str,imageDescription: str,useBlurhash: bool, \ attachImageFilename: str,mediaType: str, \
imageDescription: str,useBlurhash: bool, \
inReplyTo=None, inReplyToAtomUri=None, subject=None,debug=False) -> {}: inReplyTo=None, inReplyToAtomUri=None, subject=None,debug=False) -> {}:
"""Direct Message post """Direct Message post
""" """
@ -816,14 +823,16 @@ def createDirectMessagePost(baseDir: str,
postTo,postCc, \ postTo,postCc, \
httpPrefix, content, followersOnly, saveToFile, \ httpPrefix, content, followersOnly, saveToFile, \
clientToServer, \ clientToServer, \
attachImageFilename,imageDescription,useBlurhash, \ attachImageFilename,mediaType, \
imageDescription,useBlurhash, \
False,inReplyTo, inReplyToAtomUri, subject) False,inReplyTo, inReplyToAtomUri, subject)
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,\
attachImageFilename: str,imageDescription: str,useBlurhash: bool, \ attachImageFilename: str,mediaType: str, \
imageDescription: str,useBlurhash: bool, \
debug: bool,subject=None) -> {}: debug: bool,subject=None) -> {}:
"""Send a report to moderators """Send a report to moderators
""" """
@ -888,7 +897,8 @@ def createReportPost(baseDir: str,
toUrl,postCc, \ toUrl,postCc, \
httpPrefix, content, followersOnly, saveToFile, \ httpPrefix, content, followersOnly, saveToFile, \
clientToServer, \ clientToServer, \
attachImageFilename,imageDescription,useBlurhash, \ attachImageFilename,mediaType, \
imageDescription,useBlurhash, \
True,None, None, subject) True,None, None, subject)
return postJsonObject return postJsonObject
@ -936,7 +946,8 @@ 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, \
attachImageFilename: str,imageDescription: str,useBlurhash: bool, \ attachImageFilename: str,mediaType: str, \
imageDescription: str,useBlurhash: bool, \
federationList: [],\ federationList: [],\
sendThreads: [], postLog: [], cachedWebfingers: {},personCache: {}, \ sendThreads: [], postLog: [], cachedWebfingers: {},personCache: {}, \
debug=False,inReplyTo=None,inReplyToAtomUri=None,subject=None) -> int: debug=False,inReplyTo=None,inReplyToAtomUri=None,subject=None) -> int:
@ -991,7 +1002,8 @@ 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, \
attachImageFilename,imageDescription,useBlurhash, \ attachImageFilename,mediaType, \
imageDescription,useBlurhash, \
False,inReplyTo,inReplyToAtomUri,subject) False,inReplyTo,inReplyToAtomUri,subject)
# get the senders private key # get the senders private key
@ -1033,7 +1045,8 @@ 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, \
attachImageFilename: str,imageDescription: str,useBlurhash: bool, \ attachImageFilename: str,mediaType: str, \
imageDescription: str,useBlurhash: bool, \
cachedWebfingers: {},personCache: {}, \ cachedWebfingers: {},personCache: {}, \
debug=False,inReplyTo=None,inReplyToAtomUri=None,subject=None) -> int: debug=False,inReplyTo=None,inReplyToAtomUri=None,subject=None) -> int:
"""Send a post via a proxy (c2s) """Send a post via a proxy (c2s)
@ -1102,7 +1115,8 @@ def sendPostViaServer(projectVersion: str, \
fromNickname,fromDomain,fromPort, \ fromNickname,fromDomain,fromPort, \
toPersonId,cc,httpPrefix,content, \ toPersonId,cc,httpPrefix,content, \
followersOnly,saveToFile,clientToServer, \ followersOnly,saveToFile,clientToServer, \
attachImageFilename,imageDescription,useBlurhash, \ attachImageFilename,mediaType, \
imageDescription,useBlurhash, \
False,inReplyTo,inReplyToAtomUri,subject) False,inReplyTo,inReplyToAtomUri,subject)
authHeader=createBasicAuthHeader(fromNickname,password) authHeader=createBasicAuthHeader(fromNickname,password)

View File

@ -60,6 +60,7 @@ from like import sendLikeViaServer
from announce import announcePublic from announce import announcePublic
from announce import sendAnnounceViaServer from announce import sendAnnounceViaServer
from media import getMediaPath from media import getMediaPath
from media import getAttachmentMediaType
from delete import sendDeleteViaServer from delete import sendDeleteViaServer
from inbox import validInbox from inbox import validInbox
from inbox import validInboxFilenames from inbox import validInboxFilenames
@ -368,6 +369,7 @@ def testPostMessageBetweenServers():
alicePersonCache={} alicePersonCache={}
aliceCachedWebfingers={} aliceCachedWebfingers={}
attachedImageFilename=baseDir+'/img/logo.png' attachedImageFilename=baseDir+'/img/logo.png'
mediaType=getAttachmentMediaType(attachedImageFilename)
attachedImageDescription='Logo' attachedImageDescription='Logo'
useBlurhash=True useBlurhash=True
# nothing in Alice's outbox # nothing in Alice's outbox
@ -379,7 +381,7 @@ def testPostMessageBetweenServers():
sessionAlice,aliceDir,'alice', aliceDomain, alicePort, \ sessionAlice,aliceDir,'alice', aliceDomain, alicePort, \
'bob', bobDomain, bobPort, ccUrl, httpPrefix, \ 'bob', bobDomain, bobPort, ccUrl, httpPrefix, \
'Why is a mouse when it spins? #sillyquestion', followersOnly, \ 'Why is a mouse when it spins? #sillyquestion', followersOnly, \
saveToFile, clientToServer,attachedImageFilename, \ saveToFile, clientToServer,attachedImageFilename,mediaType, \
attachedImageDescription,useBlurhash, federationList, \ attachedImageDescription,useBlurhash, federationList, \
aliceSendThreads, alicePostLog, aliceCachedWebfingers, \ aliceSendThreads, alicePostLog, aliceCachedWebfingers, \
alicePersonCache,inReplyTo, inReplyToAtomUri, subject) alicePersonCache,inReplyTo, inReplyToAtomUri, subject)
@ -620,7 +622,7 @@ def testFollowBetweenServers():
sessionEve,eveDir,'eve', eveDomain, evePort, \ sessionEve,eveDir,'eve', eveDomain, evePort, \
'bob', bobDomain, bobPort, ccUrl, \ 'bob', bobDomain, bobPort, ccUrl, \
httpPrefix, 'Eve message', followersOnly, \ httpPrefix, 'Eve message', followersOnly, \
saveToFile, clientToServer,None,None, \ saveToFile, clientToServer,None,None,None, \
useBlurhash, federationList, eveSendThreads, \ useBlurhash, federationList, eveSendThreads, \
evePostLog, eveCachedWebfingers, \ evePostLog, eveCachedWebfingers, \
evePersonCache,inReplyTo, inReplyToAtomUri, subject) evePersonCache,inReplyTo, inReplyToAtomUri, subject)
@ -655,7 +657,7 @@ def testFollowBetweenServers():
sessionAlice,aliceDir,'alice', aliceDomain, alicePort, \ sessionAlice,aliceDir,'alice', aliceDomain, alicePort, \
'bob', bobDomain, bobPort, ccUrl, \ 'bob', bobDomain, bobPort, ccUrl, \
httpPrefix, 'Alice message', followersOnly, saveToFile, \ httpPrefix, 'Alice message', followersOnly, saveToFile, \
clientToServer,None,None,useBlurhash, federationList, \ clientToServer,None,None,None,useBlurhash, federationList, \
aliceSendThreads, alicePostLog, aliceCachedWebfingers, \ aliceSendThreads, alicePostLog, aliceCachedWebfingers, \
alicePersonCache,inReplyTo, inReplyToAtomUri, subject) alicePersonCache,inReplyTo, inReplyToAtomUri, subject)
print('sendResult: '+str(sendResult)) print('sendResult: '+str(sendResult))
@ -1136,6 +1138,7 @@ def testClientToServer():
sessionAlice = createSession(aliceDomain,alicePort,useTor) sessionAlice = createSession(aliceDomain,alicePort,useTor)
followersOnly=False followersOnly=False
attachedImageFilename=baseDir+'/img/logo.png' attachedImageFilename=baseDir+'/img/logo.png'
mediaType=getAttachmentMediaType(attachedImageFilename)
attachedImageDescription='Logo' attachedImageDescription='Logo'
useBlurhash=False useBlurhash=False
cachedWebfingers={} cachedWebfingers={}
@ -1151,7 +1154,8 @@ def testClientToServer():
aliceDomain,alicePort, \ aliceDomain,alicePort, \
'bob',bobDomain,bobPort,None, \ 'bob',bobDomain,bobPort,None, \
httpPrefix,'Sent from my ActivityPub client',followersOnly, \ httpPrefix,'Sent from my ActivityPub client',followersOnly, \
attachedImageFilename,attachedImageDescription,useBlurhash, \ attachedImageFilename,mediaType, \
attachedImageDescription,useBlurhash, \
cachedWebfingers,personCache, \ cachedWebfingers,personCache, \
True,None,None,None) True,None,None,None)
print('sendResult: '+str(sendResult)) print('sendResult: '+str(sendResult))