Basedir in public posts

master
Bob Mottram 2019-07-01 13:23:15 +01:00
parent 503db492e5
commit 156e36aa66
3 changed files with 10 additions and 10 deletions

View File

@ -78,7 +78,7 @@ privateKeyPem,publicKeyPem,person,wfEndpoint=createPerson(baseDir,username,domai
#deleteAllPosts(username,domain) #deleteAllPosts(username,domain)
setPreferredUsername(baseDir,username,domain,'badger') setPreferredUsername(baseDir,username,domain,'badger')
setBio(baseDir,username,domain,'Some personal info') setBio(baseDir,username,domain,'Some personal info')
#createPublicPost(username, domain, https, "G'day world!", False, True, None, None, 'Not suitable for Vogons') #createPublicPost(baseDir,username, domain, https, "G'day world!", False, True, None, None, 'Not suitable for Vogons')
#archivePosts(username,domain,baseDir,4) #archivePosts(username,domain,baseDir,4)
#outboxJson=createOutbox(baseDir,username,domain,port,https,2,True,None) #outboxJson=createOutbox(baseDir,username,domain,port,https,2,True,None)
#pprint(outboxJson) #pprint(outboxJson)

View File

@ -311,13 +311,13 @@ def createPostBase(baseDir: str,username: str, domain: str, toUrl: str, ccUrl: s
commentjson.dump(newPost, fp, indent=4, sort_keys=False) commentjson.dump(newPost, fp, indent=4, sort_keys=False)
return newPost return newPost
def createPublicPost(username: str, domain: str, https: bool, content: str, followersOnly: bool, saveToFile: bool, inReplyTo=None, inReplyToAtomUri=None, subject=None) -> {}: def createPublicPost(baseDir: str,username: str, domain: str, https: bool, content: str, followersOnly: bool, saveToFile: bool, inReplyTo=None, inReplyToAtomUri=None, subject=None) -> {}:
"""Public post to the outbox """Public post to the outbox
""" """
prefix='https' prefix='https'
if not https: if not https:
prefix='http' prefix='http'
return createPostBase(username, domain, 'https://www.w3.org/ns/activitystreams#Public', prefix+'://'+domain+'/users/'+username+'/followers', https, content, followersOnly, saveToFile, inReplyTo, inReplyToAtomUri, subject) return createPostBase(baseDir,username, domain, 'https://www.w3.org/ns/activitystreams#Public', prefix+'://'+domain+'/users/'+username+'/followers', https, content, followersOnly, saveToFile, inReplyTo, inReplyToAtomUri, subject)
def threadSendPost(session,postJsonObject: {},federationList: [],inboxUrl: str,baseDir: str,signatureHeaderJson: {},postLog: []) -> None: def threadSendPost(session,postJsonObject: {},federationList: [],inboxUrl: str,baseDir: str,signatureHeaderJson: {},postLog: []) -> None:
"""Sends a post with exponential backoff """Sends a post with exponential backoff
@ -372,7 +372,7 @@ def sendPost(session,baseDir: str,username: str, domain: str, port: int, toUsern
print('*************Creating post') print('*************Creating post')
print('toPersonId: '+toPersonId) print('toPersonId: '+toPersonId)
postJsonObject=createPostBase(username, domain, toPersonId, cc, https, content, followersOnly, saveToFile, inReplyTo, inReplyToAtomUri, subject) postJsonObject=createPostBase(baseDir,username, domain, toPersonId, cc, https, content, followersOnly, saveToFile, inReplyTo, inReplyToAtomUri, subject)
# get the senders private key # get the senders private key
privateKeyPem=getPersonKey(username,domain,baseDir,'private') privateKeyPem=getPersonKey(username,domain,baseDir,'private')

View File

@ -112,9 +112,9 @@ def createServerAlice(path: str,port: int):
deleteAllPosts(username,domain,path) deleteAllPosts(username,domain,path)
followPerson(path,username,domain,'bob','127.0.0.1:61936',federationList) followPerson(path,username,domain,'bob','127.0.0.1:61936',federationList)
followerOfPerson(path,username,domain,'bob','127.0.0.1:61936',federationList) followerOfPerson(path,username,domain,'bob','127.0.0.1:61936',federationList)
createPublicPost(username, domain, https, "No wise fish would go anywhere without a porpoise", False, True) createPublicPost(path,username, domain, https, "No wise fish would go anywhere without a porpoise", False, True)
createPublicPost(username, domain, https, "Curiouser and curiouser!", False, True) createPublicPost(path,username, domain, https, "Curiouser and curiouser!", False, True)
createPublicPost(username, domain, https, "In the gardens of memory, in the palace of dreams, that is where you and I shall meet", False, True) createPublicPost(path,username, domain, https, "In the gardens of memory, in the palace of dreams, that is where you and I shall meet", False, True)
global testServerAliceRunning global testServerAliceRunning
testServerAliceRunning = True testServerAliceRunning = True
print('Server running: Alice') print('Server running: Alice')
@ -135,9 +135,9 @@ def createServerBob(path: str,port: int):
deleteAllPosts(username,domain,path) deleteAllPosts(username,domain,path)
followPerson(path,username,domain,'alice','127.0.0.1:61935',federationList) followPerson(path,username,domain,'alice','127.0.0.1:61935',federationList)
followerOfPerson(path,username,domain,'alice','127.0.0.1:61935',federationList) followerOfPerson(path,username,domain,'alice','127.0.0.1:61935',federationList)
createPublicPost(username, domain, https, "It's your life, live it your way.", False, True) createPublicPost(path,username, domain, https, "It's your life, live it your way.", False, True)
createPublicPost(username, domain, https, "One of the things I've realised is that I am very simple", False, True) createPublicPost(path,username, domain, https, "One of the things I've realised is that I am very simple", False, True)
createPublicPost(username, domain, https, "Quantum physics is a bit of a passion of mine", False, True) createPublicPost(path,username, domain, https, "Quantum physics is a bit of a passion of mine", False, True)
global testServerBobRunning global testServerBobRunning
testServerBobRunning = True testServerBobRunning = True
print('Server running: Bob') print('Server running: Bob')