forked from indymedia/epicyon
Store cached actors to file
parent
0030b9fcf8
commit
8bd42b9d59
|
@ -393,7 +393,8 @@ def undoRepeatPost(session,baseDir: str,federationList: [], \
|
||||||
personCache,cachedWebfingers, \
|
personCache,cachedWebfingers, \
|
||||||
debug)
|
debug)
|
||||||
|
|
||||||
def sendAnnounceViaServer(session,fromNickname: str,password: str,
|
def sendAnnounceViaServer(baseDir: str,session, \
|
||||||
|
fromNickname: str,password: str,
|
||||||
fromDomain: str,fromPort: int, \
|
fromDomain: str,fromPort: int, \
|
||||||
httpPrefix: str,repeatObjectUrl: str, \
|
httpPrefix: str,repeatObjectUrl: str, \
|
||||||
cachedWebfingers: {},personCache: {}, \
|
cachedWebfingers: {},personCache: {}, \
|
||||||
|
@ -445,7 +446,7 @@ def sendAnnounceViaServer(session,fromNickname: str,password: str,
|
||||||
|
|
||||||
# get the actor inbox for the To handle
|
# get the actor inbox for the To handle
|
||||||
inboxUrl,pubKeyId,pubKey,fromPersonId,sharedInbox,capabilityAcquisition,avatarUrl,preferredName = \
|
inboxUrl,pubKeyId,pubKey,fromPersonId,sharedInbox,capabilityAcquisition,avatarUrl,preferredName = \
|
||||||
getPersonBox(session,wfRequest,personCache, \
|
getPersonBox(baseDir,session,wfRequest,personCache, \
|
||||||
projectVersion,httpPrefix,fromDomain,postToBox)
|
projectVersion,httpPrefix,fromDomain,postToBox)
|
||||||
|
|
||||||
if not inboxUrl:
|
if not inboxUrl:
|
||||||
|
|
|
@ -68,7 +68,8 @@ def outboxAvailability(baseDir: str,nickname: str,messageJson: {},debug: bool) -
|
||||||
|
|
||||||
return setAvailability(baseDir,nickname,domain,status)
|
return setAvailability(baseDir,nickname,domain,status)
|
||||||
|
|
||||||
def sendAvailabilityViaServer(session,nickname: str,password: str,
|
def sendAvailabilityViaServer(baseDir: str,session, \
|
||||||
|
nickname: str,password: str, \
|
||||||
domain: str,port: int, \
|
domain: str,port: int, \
|
||||||
httpPrefix: str, \
|
httpPrefix: str, \
|
||||||
status: str, \
|
status: str, \
|
||||||
|
@ -111,7 +112,7 @@ def sendAvailabilityViaServer(session,nickname: str,password: str,
|
||||||
|
|
||||||
# get the actor inbox for the To handle
|
# get the actor inbox for the To handle
|
||||||
inboxUrl,pubKeyId,pubKey,fromPersonId,sharedInbox,capabilityAcquisition,avatarUrl,preferredName = \
|
inboxUrl,pubKeyId,pubKey,fromPersonId,sharedInbox,capabilityAcquisition,avatarUrl,preferredName = \
|
||||||
getPersonBox(session,wfRequest,personCache, \
|
getPersonBox(baseDir,session,wfRequest,personCache, \
|
||||||
projectVersion,httpPrefix,domain,postToBox)
|
projectVersion,httpPrefix,domain,postToBox)
|
||||||
|
|
||||||
if not inboxUrl:
|
if not inboxUrl:
|
||||||
|
|
10
blocking.py
10
blocking.py
|
@ -136,7 +136,8 @@ def isBlocked(baseDir: str,nickname: str,domain: str, \
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def sendBlockViaServer(session,fromNickname: str,password: str,
|
def sendBlockViaServer(baseDir: str,session, \
|
||||||
|
fromNickname: str,password: str, \
|
||||||
fromDomain: str,fromPort: int, \
|
fromDomain: str,fromPort: int, \
|
||||||
httpPrefix: str,blockedUrl: str, \
|
httpPrefix: str,blockedUrl: str, \
|
||||||
cachedWebfingers: {},personCache: {}, \
|
cachedWebfingers: {},personCache: {}, \
|
||||||
|
@ -180,7 +181,7 @@ def sendBlockViaServer(session,fromNickname: str,password: str,
|
||||||
|
|
||||||
# get the actor inbox for the To handle
|
# get the actor inbox for the To handle
|
||||||
inboxUrl,pubKeyId,pubKey,fromPersonId,sharedInbox,capabilityAcquisition,avatarUrl,preferredName = \
|
inboxUrl,pubKeyId,pubKey,fromPersonId,sharedInbox,capabilityAcquisition,avatarUrl,preferredName = \
|
||||||
getPersonBox(session,wfRequest,personCache, \
|
getPersonBox(baseDir,session,wfRequest,personCache, \
|
||||||
projectVersion,httpPrefix,fromDomain,postToBox)
|
projectVersion,httpPrefix,fromDomain,postToBox)
|
||||||
|
|
||||||
if not inboxUrl:
|
if not inboxUrl:
|
||||||
|
@ -209,7 +210,8 @@ def sendBlockViaServer(session,fromNickname: str,password: str,
|
||||||
|
|
||||||
return newBlockJson
|
return newBlockJson
|
||||||
|
|
||||||
def sendUndoBlockViaServer(session,fromNickname: str,password: str,
|
def sendUndoBlockViaServer(baseDir: str,session, \
|
||||||
|
fromNickname: str,password: str, \
|
||||||
fromDomain: str,fromPort: int, \
|
fromDomain: str,fromPort: int, \
|
||||||
httpPrefix: str,blockedUrl: str, \
|
httpPrefix: str,blockedUrl: str, \
|
||||||
cachedWebfingers: {},personCache: {}, \
|
cachedWebfingers: {},personCache: {}, \
|
||||||
|
@ -257,7 +259,7 @@ def sendUndoBlockViaServer(session,fromNickname: str,password: str,
|
||||||
|
|
||||||
# get the actor inbox for the To handle
|
# get the actor inbox for the To handle
|
||||||
inboxUrl,pubKeyId,pubKey,fromPersonId,sharedInbox,capabilityAcquisition,avatarUrl,preferredName = \
|
inboxUrl,pubKeyId,pubKey,fromPersonId,sharedInbox,capabilityAcquisition,avatarUrl,preferredName = \
|
||||||
getPersonBox(session,wfRequest,personCache, \
|
getPersonBox(baseDir,session,wfRequest,personCache, \
|
||||||
projectVersion,httpPrefix,fromDomain,postToBox)
|
projectVersion,httpPrefix,fromDomain,postToBox)
|
||||||
|
|
||||||
if not inboxUrl:
|
if not inboxUrl:
|
||||||
|
|
16
cache.py
16
cache.py
|
@ -6,9 +6,11 @@ __maintainer__ = "Bob Mottram"
|
||||||
__email__ = "bob@freedombone.net"
|
__email__ = "bob@freedombone.net"
|
||||||
__status__ = "Production"
|
__status__ = "Production"
|
||||||
|
|
||||||
|
import os
|
||||||
import datetime
|
import datetime
|
||||||
|
import commentjson
|
||||||
|
|
||||||
def storePersonInCache(personUrl: str,personJson: {},personCache: {}) -> None:
|
def storePersonInCache(baseDir: str,personUrl: str,personJson: {},personCache: {}) -> None:
|
||||||
"""Store an actor in the cache
|
"""Store an actor in the cache
|
||||||
"""
|
"""
|
||||||
currTime=datetime.datetime.utcnow()
|
currTime=datetime.datetime.utcnow()
|
||||||
|
@ -16,6 +18,18 @@ def storePersonInCache(personUrl: str,personJson: {},personCache: {}) -> None:
|
||||||
"actor": personJson,
|
"actor": personJson,
|
||||||
"timestamp": currTime.strftime("%Y-%m-%dT%H:%M:%SZ")
|
"timestamp": currTime.strftime("%Y-%m-%dT%H:%M:%SZ")
|
||||||
}
|
}
|
||||||
|
if not baseDir:
|
||||||
|
return
|
||||||
|
|
||||||
|
# store to file
|
||||||
|
if not os.path.isdir(baseDir+'/cache'):
|
||||||
|
os.mkdir(baseDir+'/cache')
|
||||||
|
if not os.path.isdir(baseDir+'/cache/actors'):
|
||||||
|
os.mkdir(baseDir+'/cache/actors')
|
||||||
|
cacheFilename=baseDir+'/cache/actors/'+personUrl.replace('/','#')+'.json'
|
||||||
|
if not os.path.isfile(cacheFilename):
|
||||||
|
with open(cacheFilename, 'w') as fp:
|
||||||
|
commentjson.dump(personJson, fp, indent=4, sort_keys=False)
|
||||||
|
|
||||||
def storeWebfingerInCache(handle: str,wf,cachedWebfingers: {}) -> None:
|
def storeWebfingerInCache(handle: str,wf,cachedWebfingers: {}) -> None:
|
||||||
"""Store a webfinger endpoint in the cache
|
"""Store a webfinger endpoint in the cache
|
||||||
|
|
|
@ -82,7 +82,8 @@ def createDelete(session,baseDir: str,federationList: [], \
|
||||||
|
|
||||||
return newDelete
|
return newDelete
|
||||||
|
|
||||||
def sendDeleteViaServer(session,fromNickname: str,password: str,
|
def sendDeleteViaServer(baseDir: str,session, \
|
||||||
|
fromNickname: str,password: str, \
|
||||||
fromDomain: str,fromPort: int, \
|
fromDomain: str,fromPort: int, \
|
||||||
httpPrefix: str,deleteObjectUrl: str, \
|
httpPrefix: str,deleteObjectUrl: str, \
|
||||||
cachedWebfingers: {},personCache: {}, \
|
cachedWebfingers: {},personCache: {}, \
|
||||||
|
@ -125,7 +126,7 @@ def sendDeleteViaServer(session,fromNickname: str,password: str,
|
||||||
|
|
||||||
# get the actor inbox for the To handle
|
# get the actor inbox for the To handle
|
||||||
inboxUrl,pubKeyId,pubKey,fromPersonId,sharedInbox,capabilityAcquisition,avatarUrl,preferredName = \
|
inboxUrl,pubKeyId,pubKey,fromPersonId,sharedInbox,capabilityAcquisition,avatarUrl,preferredName = \
|
||||||
getPersonBox(session,wfRequest,personCache, \
|
getPersonBox(baseDir,session,wfRequest,personCache, \
|
||||||
projectVersion,httpPrefix,fromDomain,postToBox)
|
projectVersion,httpPrefix,fromDomain,postToBox)
|
||||||
|
|
||||||
if not inboxUrl:
|
if not inboxUrl:
|
||||||
|
|
38
epicyon.py
38
epicyon.py
|
@ -295,7 +295,7 @@ if args.posts:
|
||||||
args.port=443
|
args.port=443
|
||||||
nickname=args.posts.split('@')[0]
|
nickname=args.posts.split('@')[0]
|
||||||
domain=args.posts.split('@')[1]
|
domain=args.posts.split('@')[1]
|
||||||
getPublicPostsOfPerson(nickname,domain,False,True, \
|
getPublicPostsOfPerson(baseDir,nickname,domain,False,True, \
|
||||||
args.tor,args.port,httpPrefix,debug, \
|
args.tor,args.port,httpPrefix,debug, \
|
||||||
__version__)
|
__version__)
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
@ -308,7 +308,7 @@ if args.postsraw:
|
||||||
args.port=443
|
args.port=443
|
||||||
nickname=args.postsraw.split('@')[0]
|
nickname=args.postsraw.split('@')[0]
|
||||||
domain=args.postsraw.split('@')[1]
|
domain=args.postsraw.split('@')[1]
|
||||||
getPublicPostsOfPerson(nickname,domain,False,False, \
|
getPublicPostsOfPerson(baseDir,nickname,domain,False,False, \
|
||||||
args.tor,args.port,httpPrefix,debug, \
|
args.tor,args.port,httpPrefix,debug, \
|
||||||
__version__)
|
__version__)
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
@ -543,7 +543,7 @@ if args.announce:
|
||||||
cachedWebfingers={}
|
cachedWebfingers={}
|
||||||
print('Sending announce/repeat of '+args.announce)
|
print('Sending announce/repeat of '+args.announce)
|
||||||
|
|
||||||
sendAnnounceViaServer(session,args.nickname,args.password,
|
sendAnnounceViaServer(baseDir,session,args.nickname,args.password,
|
||||||
domain,port, \
|
domain,port, \
|
||||||
httpPrefix,args.announce, \
|
httpPrefix,args.announce, \
|
||||||
cachedWebfingers,personCache, \
|
cachedWebfingers,personCache, \
|
||||||
|
@ -587,7 +587,7 @@ if args.itemName:
|
||||||
cachedWebfingers={}
|
cachedWebfingers={}
|
||||||
print('Sending shared item: '+args.itemName)
|
print('Sending shared item: '+args.itemName)
|
||||||
|
|
||||||
sendShareViaServer(session, \
|
sendShareViaServer(baseDir,session, \
|
||||||
args.nickname,args.password, \
|
args.nickname,args.password, \
|
||||||
domain,port, \
|
domain,port, \
|
||||||
httpPrefix, \
|
httpPrefix, \
|
||||||
|
@ -645,7 +645,8 @@ if args.like:
|
||||||
cachedWebfingers={}
|
cachedWebfingers={}
|
||||||
print('Sending like of '+args.like)
|
print('Sending like of '+args.like)
|
||||||
|
|
||||||
sendLikeViaServer(session,args.nickname,args.password,
|
sendLikeViaServer(baseDir,session, \
|
||||||
|
args.nickname,args.password, \
|
||||||
domain,port, \
|
domain,port, \
|
||||||
httpPrefix,args.like, \
|
httpPrefix,args.like, \
|
||||||
cachedWebfingers,personCache, \
|
cachedWebfingers,personCache, \
|
||||||
|
@ -669,7 +670,8 @@ if args.undolike:
|
||||||
cachedWebfingers={}
|
cachedWebfingers={}
|
||||||
print('Sending undo like of '+args.undolike)
|
print('Sending undo like of '+args.undolike)
|
||||||
|
|
||||||
sendUndoLikeViaServer(session,args.nickname,args.password,
|
sendUndoLikeViaServer(baseDir,session, \
|
||||||
|
args.nickname,args.password, \
|
||||||
domain,port, \
|
domain,port, \
|
||||||
httpPrefix,args.undolike, \
|
httpPrefix,args.undolike, \
|
||||||
cachedWebfingers,personCache, \
|
cachedWebfingers,personCache, \
|
||||||
|
@ -693,7 +695,8 @@ if args.delete:
|
||||||
cachedWebfingers={}
|
cachedWebfingers={}
|
||||||
print('Sending delete request of '+args.delete)
|
print('Sending delete request of '+args.delete)
|
||||||
|
|
||||||
sendDeleteViaServer(session,args.nickname,args.password,
|
sendDeleteViaServer(baseDir,session, \
|
||||||
|
args.nickname,args.password, \
|
||||||
domain,port, \
|
domain,port, \
|
||||||
httpPrefix,args.delete, \
|
httpPrefix,args.delete, \
|
||||||
cachedWebfingers,personCache, \
|
cachedWebfingers,personCache, \
|
||||||
|
@ -725,7 +728,8 @@ if args.follow:
|
||||||
if args.follow.startswith('https'):
|
if args.follow.startswith('https'):
|
||||||
followHttpPrefix='https'
|
followHttpPrefix='https'
|
||||||
|
|
||||||
sendFollowRequestViaServer(session,args.nickname,args.password, \
|
sendFollowRequestViaServer(baseDir,session, \
|
||||||
|
args.nickname,args.password, \
|
||||||
domain,port, \
|
domain,port, \
|
||||||
followNickname,followDomain,followPort, \
|
followNickname,followDomain,followPort, \
|
||||||
httpPrefix, \
|
httpPrefix, \
|
||||||
|
@ -759,7 +763,8 @@ if args.unfollow:
|
||||||
if args.follow.startswith('https'):
|
if args.follow.startswith('https'):
|
||||||
followHttpPrefix='https'
|
followHttpPrefix='https'
|
||||||
|
|
||||||
sendUnfollowRequestViaServer(session,args.nickname,args.password, \
|
sendUnfollowRequestViaServer(baseDir,session, \
|
||||||
|
args.nickname,args.password, \
|
||||||
domain,port, \
|
domain,port, \
|
||||||
followNickname,followDomain,followPort, \
|
followNickname,followDomain,followPort, \
|
||||||
httpPrefix, \
|
httpPrefix, \
|
||||||
|
@ -985,7 +990,8 @@ if args.skill:
|
||||||
cachedWebfingers={}
|
cachedWebfingers={}
|
||||||
print('Sending '+args.skill+' skill level '+str(args.skillLevelPercent)+' for '+nickname)
|
print('Sending '+args.skill+' skill level '+str(args.skillLevelPercent)+' for '+nickname)
|
||||||
|
|
||||||
sendSkillViaServer(session,nickname,args.password,
|
sendSkillViaServer(baseDir,session, \
|
||||||
|
nickname,args.password, \
|
||||||
domain,port, \
|
domain,port, \
|
||||||
httpPrefix, \
|
httpPrefix, \
|
||||||
args.skill,args.skillLevelPercent, \
|
args.skill,args.skillLevelPercent, \
|
||||||
|
@ -1010,7 +1016,7 @@ if args.availability:
|
||||||
cachedWebfingers={}
|
cachedWebfingers={}
|
||||||
print('Sending availability status of '+nickname+' as '+args.availability)
|
print('Sending availability status of '+nickname+' as '+args.availability)
|
||||||
|
|
||||||
sendAvailabilityViaServer(session,nickname,args.password,
|
sendAvailabilityViaServer(baseDir,session,nickname,args.password,
|
||||||
domain,port, \
|
domain,port, \
|
||||||
httpPrefix, \
|
httpPrefix, \
|
||||||
args.availability, \
|
args.availability, \
|
||||||
|
@ -1055,7 +1061,7 @@ if args.block:
|
||||||
cachedWebfingers={}
|
cachedWebfingers={}
|
||||||
print('Sending block of '+args.block)
|
print('Sending block of '+args.block)
|
||||||
|
|
||||||
sendBlockViaServer(session,nickname,args.password,
|
sendBlockViaServer(baseDir,session,nickname,args.password,
|
||||||
domain,port, \
|
domain,port, \
|
||||||
httpPrefix,args.block, \
|
httpPrefix,args.block, \
|
||||||
cachedWebfingers,personCache, \
|
cachedWebfingers,personCache, \
|
||||||
|
@ -1091,7 +1097,8 @@ if args.delegate:
|
||||||
cachedWebfingers={}
|
cachedWebfingers={}
|
||||||
print('Sending delegation for '+args.delegate+' with role '+args.role+' in project '+args.project)
|
print('Sending delegation for '+args.delegate+' with role '+args.role+' in project '+args.project)
|
||||||
|
|
||||||
sendRoleViaServer(session,nickname,args.password,
|
sendRoleViaServer(baseDir,session, \
|
||||||
|
nickname,args.password, \
|
||||||
domain,port, \
|
domain,port, \
|
||||||
httpPrefix,args.delegate, \
|
httpPrefix,args.delegate, \
|
||||||
args.project,args.role, \
|
args.project,args.role, \
|
||||||
|
@ -1124,7 +1131,8 @@ if args.undelegate:
|
||||||
cachedWebfingers={}
|
cachedWebfingers={}
|
||||||
print('Sending delegation removal for '+args.undelegate+' from role '+args.role+' in project '+args.project)
|
print('Sending delegation removal for '+args.undelegate+' from role '+args.role+' in project '+args.project)
|
||||||
|
|
||||||
sendRoleViaServer(session,nickname,args.password,
|
sendRoleViaServer(baseDir,session, \
|
||||||
|
nickname,args.password, \
|
||||||
domain,port, \
|
domain,port, \
|
||||||
httpPrefix,args.delegate, \
|
httpPrefix,args.delegate, \
|
||||||
args.project,None, \
|
args.project,None, \
|
||||||
|
@ -1159,7 +1167,7 @@ if args.unblock:
|
||||||
cachedWebfingers={}
|
cachedWebfingers={}
|
||||||
print('Sending undo block of '+args.unblock)
|
print('Sending undo block of '+args.unblock)
|
||||||
|
|
||||||
sendUndoBlockViaServer(session,nickname,args.password,
|
sendUndoBlockViaServer(baseDir,session,nickname,args.password,
|
||||||
domain,port, \
|
domain,port, \
|
||||||
httpPrefix,args.unblock, \
|
httpPrefix,args.unblock, \
|
||||||
cachedWebfingers,personCache, \
|
cachedWebfingers,personCache, \
|
||||||
|
|
10
follow.py
10
follow.py
|
@ -508,7 +508,8 @@ def sendFollowRequest(session,baseDir: str, \
|
||||||
|
|
||||||
return newFollowJson
|
return newFollowJson
|
||||||
|
|
||||||
def sendFollowRequestViaServer(session,fromNickname: str,password: str,
|
def sendFollowRequestViaServer(baseDir: str,session, \
|
||||||
|
fromNickname: str,password: str, \
|
||||||
fromDomain: str,fromPort: int, \
|
fromDomain: str,fromPort: int, \
|
||||||
followNickname: str,followDomain: str,followPort: int, \
|
followNickname: str,followDomain: str,followPort: int, \
|
||||||
httpPrefix: str, \
|
httpPrefix: str, \
|
||||||
|
@ -558,7 +559,7 @@ def sendFollowRequestViaServer(session,fromNickname: str,password: str,
|
||||||
|
|
||||||
# get the actor inbox for the To handle
|
# get the actor inbox for the To handle
|
||||||
inboxUrl,pubKeyId,pubKey,fromPersonId,sharedInbox,capabilityAcquisition,avatarUrl,preferredName = \
|
inboxUrl,pubKeyId,pubKey,fromPersonId,sharedInbox,capabilityAcquisition,avatarUrl,preferredName = \
|
||||||
getPersonBox(session,wfRequest,personCache, \
|
getPersonBox(baseDir,session,wfRequest,personCache, \
|
||||||
projectVersion,httpPrefix,fromDomain,postToBox)
|
projectVersion,httpPrefix,fromDomain,postToBox)
|
||||||
|
|
||||||
if not inboxUrl:
|
if not inboxUrl:
|
||||||
|
@ -587,7 +588,8 @@ def sendFollowRequestViaServer(session,fromNickname: str,password: str,
|
||||||
|
|
||||||
return newFollowJson
|
return newFollowJson
|
||||||
|
|
||||||
def sendUnfollowRequestViaServer(session,fromNickname: str,password: str,
|
def sendUnfollowRequestViaServer(baseDir: str,session, \
|
||||||
|
fromNickname: str,password: str, \
|
||||||
fromDomain: str,fromPort: int, \
|
fromDomain: str,fromPort: int, \
|
||||||
followNickname: str,followDomain: str,followPort: int, \
|
followNickname: str,followDomain: str,followPort: int, \
|
||||||
httpPrefix: str, \
|
httpPrefix: str, \
|
||||||
|
@ -641,7 +643,7 @@ def sendUnfollowRequestViaServer(session,fromNickname: str,password: str,
|
||||||
|
|
||||||
# get the actor inbox for the To handle
|
# get the actor inbox for the To handle
|
||||||
inboxUrl,pubKeyId,pubKey,fromPersonId,sharedInbox,capabilityAcquisition,avatarUrl,preferredName = \
|
inboxUrl,pubKeyId,pubKey,fromPersonId,sharedInbox,capabilityAcquisition,avatarUrl,preferredName = \
|
||||||
getPersonBox(session,wfRequest,personCache, \
|
getPersonBox(baseDir,session,wfRequest,personCache, \
|
||||||
projectVersion,httpPrefix,fromDomain,postToBox)
|
projectVersion,httpPrefix,fromDomain,postToBox)
|
||||||
|
|
||||||
if not inboxUrl:
|
if not inboxUrl:
|
||||||
|
|
8
inbox.py
8
inbox.py
|
@ -85,7 +85,8 @@ def validInboxFilenames(baseDir: str,nickname: str,domain: str, \
|
||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def getPersonPubKey(session,personUrl: str,personCache: {},debug: bool, \
|
def getPersonPubKey(baseDir: str,session,personUrl: str, \
|
||||||
|
personCache: {},debug: bool, \
|
||||||
projectVersion: str,httpPrefix: str,domain: str) -> str:
|
projectVersion: str,httpPrefix: str,domain: str) -> str:
|
||||||
if not personUrl:
|
if not personUrl:
|
||||||
return None
|
return None
|
||||||
|
@ -114,7 +115,7 @@ def getPersonPubKey(session,personUrl: str,personCache: {},debug: bool, \
|
||||||
if debug:
|
if debug:
|
||||||
print('DEBUG: Public key not found for '+personUrl)
|
print('DEBUG: Public key not found for '+personUrl)
|
||||||
|
|
||||||
storePersonInCache(personUrl,personJson,personCache)
|
storePersonInCache(baseDir,personUrl,personJson,personCache)
|
||||||
return pubKey
|
return pubKey
|
||||||
|
|
||||||
def inboxMessageHasParams(messageJson: {}) -> bool:
|
def inboxMessageHasParams(messageJson: {}) -> bool:
|
||||||
|
@ -1168,7 +1169,8 @@ def runInboxQueue(projectVersion: str, \
|
||||||
continue
|
continue
|
||||||
|
|
||||||
pubKey= \
|
pubKey= \
|
||||||
getPersonPubKey(session,keyId,personCache,debug, \
|
getPersonPubKey(baseDir,session,keyId, \
|
||||||
|
personCache,debug, \
|
||||||
projectVersion,httpPrefix,domain)
|
projectVersion,httpPrefix,domain)
|
||||||
if pubKey:
|
if pubKey:
|
||||||
print('DEBUG: public key: '+str(pubKey))
|
print('DEBUG: public key: '+str(pubKey))
|
||||||
|
|
10
like.py
10
like.py
|
@ -310,7 +310,8 @@ def undoLikePost(session,baseDir: str,federationList: [], \
|
||||||
ccList,httpPrefix,objectUrl,clientToServer, \
|
ccList,httpPrefix,objectUrl,clientToServer, \
|
||||||
sendThreads,postLog,personCache,cachedWebfingers,debug)
|
sendThreads,postLog,personCache,cachedWebfingers,debug)
|
||||||
|
|
||||||
def sendLikeViaServer(session,fromNickname: str,password: str,
|
def sendLikeViaServer(baseDir: str,session, \
|
||||||
|
fromNickname: str,password: str,
|
||||||
fromDomain: str,fromPort: int, \
|
fromDomain: str,fromPort: int, \
|
||||||
httpPrefix: str,likeUrl: str, \
|
httpPrefix: str,likeUrl: str, \
|
||||||
cachedWebfingers: {},personCache: {}, \
|
cachedWebfingers: {},personCache: {}, \
|
||||||
|
@ -354,7 +355,7 @@ def sendLikeViaServer(session,fromNickname: str,password: str,
|
||||||
|
|
||||||
# get the actor inbox for the To handle
|
# get the actor inbox for the To handle
|
||||||
inboxUrl,pubKeyId,pubKey,fromPersonId,sharedInbox,capabilityAcquisition,avatarUrl,preferredName = \
|
inboxUrl,pubKeyId,pubKey,fromPersonId,sharedInbox,capabilityAcquisition,avatarUrl,preferredName = \
|
||||||
getPersonBox(session,wfRequest,personCache, \
|
getPersonBox(baseDir,session,wfRequest,personCache, \
|
||||||
projectVersion,httpPrefix,fromDomain,postToBox)
|
projectVersion,httpPrefix,fromDomain,postToBox)
|
||||||
|
|
||||||
if not inboxUrl:
|
if not inboxUrl:
|
||||||
|
@ -383,7 +384,8 @@ def sendLikeViaServer(session,fromNickname: str,password: str,
|
||||||
|
|
||||||
return newLikeJson
|
return newLikeJson
|
||||||
|
|
||||||
def sendUndoLikeViaServer(session,fromNickname: str,password: str,
|
def sendUndoLikeViaServer(baseDir: str,session, \
|
||||||
|
fromNickname: str,password: str, \
|
||||||
fromDomain: str,fromPort: int, \
|
fromDomain: str,fromPort: int, \
|
||||||
httpPrefix: str,likeUrl: str, \
|
httpPrefix: str,likeUrl: str, \
|
||||||
cachedWebfingers: {},personCache: {}, \
|
cachedWebfingers: {},personCache: {}, \
|
||||||
|
@ -431,7 +433,7 @@ def sendUndoLikeViaServer(session,fromNickname: str,password: str,
|
||||||
|
|
||||||
# get the actor inbox for the To handle
|
# get the actor inbox for the To handle
|
||||||
inboxUrl,pubKeyId,pubKey,fromPersonId,sharedInbox,capabilityAcquisition,avatarUrl,preferredName = \
|
inboxUrl,pubKeyId,pubKey,fromPersonId,sharedInbox,capabilityAcquisition,avatarUrl,preferredName = \
|
||||||
getPersonBox(session,wfRequest,personCache, \
|
getPersonBox(baseDir,session,wfRequest,personCache, \
|
||||||
projectVersion,httpPrefix,fromDomain,postToBox)
|
projectVersion,httpPrefix,fromDomain,postToBox)
|
||||||
|
|
||||||
if not inboxUrl:
|
if not inboxUrl:
|
||||||
|
|
16
posts.py
16
posts.py
|
@ -139,7 +139,7 @@ def parseUserFeed(session,feedUrl: str,asHeader: {}, \
|
||||||
projectVersion,httpPrefix,domain):
|
projectVersion,httpPrefix,domain):
|
||||||
yield item
|
yield item
|
||||||
|
|
||||||
def getPersonBox(session,wfRequest: {},personCache: {}, \
|
def getPersonBox(baseDir: str,session,wfRequest: {},personCache: {}, \
|
||||||
projectVersion: str,httpPrefix: str,domain: str, \
|
projectVersion: str,httpPrefix: str,domain: str, \
|
||||||
boxName='inbox') -> (str,str,str,str,str,str,str,str):
|
boxName='inbox') -> (str,str,str,str,str,str,str,str):
|
||||||
asHeader = {'Accept': 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"'}
|
asHeader = {'Accept': 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"'}
|
||||||
|
@ -191,7 +191,7 @@ def getPersonBox(session,wfRequest: {},personCache: {}, \
|
||||||
if personJson.get('preferredUsername'):
|
if personJson.get('preferredUsername'):
|
||||||
preferredName=personJson['preferredUsername']
|
preferredName=personJson['preferredUsername']
|
||||||
|
|
||||||
storePersonInCache(personUrl,personJson,personCache)
|
storePersonInCache(baseDir,personUrl,personJson,personCache)
|
||||||
|
|
||||||
return boxJson,pubKeyId,pubKey,personId,sharedInbox,capabilityAcquisition,avatarUrl,preferredName
|
return boxJson,pubKeyId,pubKey,personId,sharedInbox,capabilityAcquisition,avatarUrl,preferredName
|
||||||
|
|
||||||
|
@ -959,7 +959,7 @@ def sendPost(projectVersion: str, \
|
||||||
|
|
||||||
# get the actor inbox for the To handle
|
# get the actor inbox for the To handle
|
||||||
inboxUrl,pubKeyId,pubKey,toPersonId,sharedInbox,capabilityAcquisition,avatarUrl,preferredName = \
|
inboxUrl,pubKeyId,pubKey,toPersonId,sharedInbox,capabilityAcquisition,avatarUrl,preferredName = \
|
||||||
getPersonBox(session,wfRequest,personCache, \
|
getPersonBox(baseDir,session,wfRequest,personCache, \
|
||||||
projectVersion,httpPrefix,domain,postToBox)
|
projectVersion,httpPrefix,domain,postToBox)
|
||||||
|
|
||||||
# If there are more than one followers on the target domain
|
# If there are more than one followers on the target domain
|
||||||
|
@ -1022,7 +1022,7 @@ def sendPost(projectVersion: str, \
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
def sendPostViaServer(projectVersion: str, \
|
def sendPostViaServer(projectVersion: str, \
|
||||||
baseDir,session,fromNickname: str,password: str, \
|
baseDir: str,session,fromNickname: str,password: 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, \
|
||||||
|
@ -1055,7 +1055,7 @@ def sendPostViaServer(projectVersion: str, \
|
||||||
|
|
||||||
# get the actor inbox for the To handle
|
# get the actor inbox for the To handle
|
||||||
inboxUrl,pubKeyId,pubKey,fromPersonId,sharedInbox,capabilityAcquisition,avatarUrl,preferredName = \
|
inboxUrl,pubKeyId,pubKey,fromPersonId,sharedInbox,capabilityAcquisition,avatarUrl,preferredName = \
|
||||||
getPersonBox(session,wfRequest,personCache, \
|
getPersonBox(baseDir,session,wfRequest,personCache, \
|
||||||
projectVersion,httpPrefix,fromDomain,postToBox)
|
projectVersion,httpPrefix,fromDomain,postToBox)
|
||||||
|
|
||||||
if not inboxUrl:
|
if not inboxUrl:
|
||||||
|
@ -1187,7 +1187,7 @@ def sendSignedJson(postJsonObject: {},session,baseDir: str, \
|
||||||
|
|
||||||
# get the actor inbox/outbox/capabilities for the To handle
|
# get the actor inbox/outbox/capabilities for the To handle
|
||||||
inboxUrl,pubKeyId,pubKey,toPersonId,sharedInboxUrl,capabilityAcquisition,avatarUrl,preferredName = \
|
inboxUrl,pubKeyId,pubKey,toPersonId,sharedInboxUrl,capabilityAcquisition,avatarUrl,preferredName = \
|
||||||
getPersonBox(session,wfRequest,personCache, \
|
getPersonBox(baseDir,session,wfRequest,personCache, \
|
||||||
projectVersion,httpPrefix,domain,postToBox)
|
projectVersion,httpPrefix,domain,postToBox)
|
||||||
|
|
||||||
if nickname=='capabilities':
|
if nickname=='capabilities':
|
||||||
|
@ -1769,7 +1769,7 @@ def archivePostsForPerson(httpPrefix: str,nickname: str,domain: str,baseDir: str
|
||||||
if noOfPosts <= maxPostsInBox:
|
if noOfPosts <= maxPostsInBox:
|
||||||
break
|
break
|
||||||
|
|
||||||
def getPublicPostsOfPerson(nickname: str,domain: str, \
|
def getPublicPostsOfPerson(baseDir: str,nickname: str,domain: str, \
|
||||||
raw: bool,simple: bool,useTor: bool, \
|
raw: bool,simple: bool,useTor: bool, \
|
||||||
port: int,httpPrefix: str, \
|
port: int,httpPrefix: str, \
|
||||||
debug: bool,projectVersion: str) -> None:
|
debug: bool,projectVersion: str) -> None:
|
||||||
|
@ -1793,7 +1793,7 @@ def getPublicPostsOfPerson(nickname: str,domain: str, \
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
|
||||||
personUrl,pubKeyId,pubKey,personId,shaedInbox,capabilityAcquisition,avatarUrl,preferredName= \
|
personUrl,pubKeyId,pubKey,personId,shaedInbox,capabilityAcquisition,avatarUrl,preferredName= \
|
||||||
getPersonBox(session,wfRequest,personCache, \
|
getPersonBox(baseDir,session,wfRequest,personCache, \
|
||||||
projectVersion,httpPrefix,domain,'outbox')
|
projectVersion,httpPrefix,domain,'outbox')
|
||||||
wfResult = json.dumps(wfRequest, indent=4, sort_keys=True)
|
wfResult = json.dumps(wfRequest, indent=4, sort_keys=True)
|
||||||
|
|
||||||
|
|
5
roles.py
5
roles.py
|
@ -203,7 +203,8 @@ def outboxDelegate(baseDir: str,authenticatedNickname: str,messageJson: {},debug
|
||||||
print(nickname+'@'+domain+' assigned to the role '+role+' within the project '+project)
|
print(nickname+'@'+domain+' assigned to the role '+role+' within the project '+project)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def sendRoleViaServer(session,delegatorNickname: str,password: str,
|
def sendRoleViaServer(baseDir: str,session, \
|
||||||
|
delegatorNickname: str,password: str, \
|
||||||
delegatorDomain: str,delegatorPort: int, \
|
delegatorDomain: str,delegatorPort: int, \
|
||||||
httpPrefix: str,nickname: str, \
|
httpPrefix: str,nickname: str, \
|
||||||
project: str,role: str, \
|
project: str,role: str, \
|
||||||
|
@ -257,7 +258,7 @@ def sendRoleViaServer(session,delegatorNickname: str,password: str,
|
||||||
|
|
||||||
# get the actor inbox for the To handle
|
# get the actor inbox for the To handle
|
||||||
inboxUrl,pubKeyId,pubKey,fromPersonId,sharedInbox,capabilityAcquisition,avatarUrl,preferredName = \
|
inboxUrl,pubKeyId,pubKey,fromPersonId,sharedInbox,capabilityAcquisition,avatarUrl,preferredName = \
|
||||||
getPersonBox(session,wfRequest,personCache, \
|
getPersonBox(baseDir,session,wfRequest,personCache, \
|
||||||
projectVersion,httpPrefix,delegatorDomain,postToBox)
|
projectVersion,httpPrefix,delegatorDomain,postToBox)
|
||||||
|
|
||||||
if not inboxUrl:
|
if not inboxUrl:
|
||||||
|
|
10
shares.py
10
shares.py
|
@ -267,7 +267,8 @@ def getSharesFeedForPerson(baseDir: str, \
|
||||||
shares['next']=httpPrefix+'://'+domain+'/users/'+nickname+'/shares?page='+str(lastPage)
|
shares['next']=httpPrefix+'://'+domain+'/users/'+nickname+'/shares?page='+str(lastPage)
|
||||||
return shares
|
return shares
|
||||||
|
|
||||||
def sendShareViaServer(session,fromNickname: str,password: str,
|
def sendShareViaServer(baseDir,session, \
|
||||||
|
fromNickname: str,password: str, \
|
||||||
fromDomain: str,fromPort: int, \
|
fromDomain: str,fromPort: int, \
|
||||||
httpPrefix: str, \
|
httpPrefix: str, \
|
||||||
displayName: str, \
|
displayName: str, \
|
||||||
|
@ -329,7 +330,7 @@ def sendShareViaServer(session,fromNickname: str,password: str,
|
||||||
|
|
||||||
# get the actor inbox for the To handle
|
# get the actor inbox for the To handle
|
||||||
inboxUrl,pubKeyId,pubKey,fromPersonId,sharedInbox,capabilityAcquisition,avatarUrl,preferredName = \
|
inboxUrl,pubKeyId,pubKey,fromPersonId,sharedInbox,capabilityAcquisition,avatarUrl,preferredName = \
|
||||||
getPersonBox(session,wfRequest,personCache, \
|
getPersonBox(baseDir,session,wfRequest,personCache, \
|
||||||
projectVersion,httpPrefix,fromDomain,postToBox)
|
projectVersion,httpPrefix,fromDomain,postToBox)
|
||||||
|
|
||||||
if not inboxUrl:
|
if not inboxUrl:
|
||||||
|
@ -364,7 +365,8 @@ def sendShareViaServer(session,fromNickname: str,password: str,
|
||||||
|
|
||||||
return newShareJson
|
return newShareJson
|
||||||
|
|
||||||
def sendUndoShareViaServer(session,fromNickname: str,password: str,
|
def sendUndoShareViaServer(baseDir: str,session, \
|
||||||
|
fromNickname: str,password: str, \
|
||||||
fromDomain: str,fromPort: int, \
|
fromDomain: str,fromPort: int, \
|
||||||
httpPrefix: str, \
|
httpPrefix: str, \
|
||||||
displayName: str, \
|
displayName: str, \
|
||||||
|
@ -414,7 +416,7 @@ def sendUndoShareViaServer(session,fromNickname: str,password: str,
|
||||||
|
|
||||||
# get the actor inbox for the To handle
|
# get the actor inbox for the To handle
|
||||||
inboxUrl,pubKeyId,pubKey,fromPersonId,sharedInbox,capabilityAcquisition,avatarUrl,preferredName = \
|
inboxUrl,pubKeyId,pubKey,fromPersonId,sharedInbox,capabilityAcquisition,avatarUrl,preferredName = \
|
||||||
getPersonBox(session,wfRequest,personCache, \
|
getPersonBox(baseDir,session,wfRequest,personCache, \
|
||||||
projectVersion,httpPrefix,fromDomain,postToBox)
|
projectVersion,httpPrefix,fromDomain,postToBox)
|
||||||
|
|
||||||
if not inboxUrl:
|
if not inboxUrl:
|
||||||
|
|
|
@ -85,7 +85,7 @@ def outboxSkills(baseDir: str,nickname: str,messageJson: {},debug: bool) -> bool
|
||||||
return setSkillLevel(baseDir,nickname,domain, \
|
return setSkillLevel(baseDir,nickname,domain, \
|
||||||
skill,skillLevelPercent)
|
skill,skillLevelPercent)
|
||||||
|
|
||||||
def sendSkillViaServer(session,nickname: str,password: str,
|
def sendSkillViaServer(baseDir: str,session,nickname: str,password: str,
|
||||||
domain: str,port: int, \
|
domain: str,port: int, \
|
||||||
httpPrefix: str, \
|
httpPrefix: str, \
|
||||||
skill: str,skillLevelPercent: int, \
|
skill: str,skillLevelPercent: int, \
|
||||||
|
@ -132,7 +132,7 @@ def sendSkillViaServer(session,nickname: str,password: str,
|
||||||
|
|
||||||
# get the actor inbox for the To handle
|
# get the actor inbox for the To handle
|
||||||
inboxUrl,pubKeyId,pubKey,fromPersonId,sharedInbox,capabilityAcquisition,avatarUrl,preferredName = \
|
inboxUrl,pubKeyId,pubKey,fromPersonId,sharedInbox,capabilityAcquisition,avatarUrl,preferredName = \
|
||||||
getPersonBox(session,wfRequest,personCache, \
|
getPersonBox(baseDir,session,wfRequest,personCache, \
|
||||||
projectVersion,httpPrefix,domain,postToBox)
|
projectVersion,httpPrefix,domain,postToBox)
|
||||||
|
|
||||||
if not inboxUrl:
|
if not inboxUrl:
|
||||||
|
|
18
tests.py
18
tests.py
|
@ -146,7 +146,7 @@ def testCache():
|
||||||
personUrl="cat@cardboard.box"
|
personUrl="cat@cardboard.box"
|
||||||
personJson={ "id": 123456, "test": "This is a test" }
|
personJson={ "id": 123456, "test": "This is a test" }
|
||||||
personCache={}
|
personCache={}
|
||||||
storePersonInCache(personUrl,personJson,personCache)
|
storePersonInCache(None,personUrl,personJson,personCache)
|
||||||
result=getPersonFromCache(personUrl,personCache)
|
result=getPersonFromCache(personUrl,personCache)
|
||||||
assert result['id']==123456
|
assert result['id']==123456
|
||||||
assert result['test']=='This is a test'
|
assert result['test']=='This is a test'
|
||||||
|
@ -1190,7 +1190,8 @@ def testClientToServer():
|
||||||
assert validInboxFilenames(bobDir,'bob',bobDomain,aliceDomain,alicePort)
|
assert validInboxFilenames(bobDir,'bob',bobDomain,aliceDomain,alicePort)
|
||||||
|
|
||||||
print('\n\nAlice follows Bob')
|
print('\n\nAlice follows Bob')
|
||||||
sendFollowRequestViaServer(sessionAlice,'alice',password, \
|
sendFollowRequestViaServer(aliceDir,sessionAlice, \
|
||||||
|
'alice',password, \
|
||||||
aliceDomain,alicePort, \
|
aliceDomain,alicePort, \
|
||||||
'bob',bobDomain,bobPort, \
|
'bob',bobDomain,bobPort, \
|
||||||
httpPrefix, \
|
httpPrefix, \
|
||||||
|
@ -1212,7 +1213,8 @@ def testClientToServer():
|
||||||
assert validInboxFilenames(bobDir,'bob',bobDomain,aliceDomain,alicePort)
|
assert validInboxFilenames(bobDir,'bob',bobDomain,aliceDomain,alicePort)
|
||||||
|
|
||||||
print('\n\nBob follows Alice')
|
print('\n\nBob follows Alice')
|
||||||
sendFollowRequestViaServer(sessionAlice,'bob','bobpass', \
|
sendFollowRequestViaServer(aliceDir,sessionAlice, \
|
||||||
|
'bob','bobpass', \
|
||||||
bobDomain,bobPort, \
|
bobDomain,bobPort, \
|
||||||
'alice',aliceDomain,alicePort, \
|
'alice',aliceDomain,alicePort, \
|
||||||
httpPrefix, \
|
httpPrefix, \
|
||||||
|
@ -1241,7 +1243,8 @@ def testClientToServer():
|
||||||
assert len([name for name in os.listdir(outboxPath) if os.path.isfile(os.path.join(outboxPath, name))])==1
|
assert len([name for name in os.listdir(outboxPath) if os.path.isfile(os.path.join(outboxPath, name))])==1
|
||||||
print(str(len([name for name in os.listdir(inboxPath) if os.path.isfile(os.path.join(inboxPath, name))])))
|
print(str(len([name for name in os.listdir(inboxPath) if os.path.isfile(os.path.join(inboxPath, name))])))
|
||||||
assert len([name for name in os.listdir(inboxPath) if os.path.isfile(os.path.join(inboxPath, name))])==1
|
assert len([name for name in os.listdir(inboxPath) if os.path.isfile(os.path.join(inboxPath, name))])==1
|
||||||
sendLikeViaServer(sessionBob,'bob','bobpass', \
|
sendLikeViaServer(bobDir,sessionBob, \
|
||||||
|
'bob','bobpass', \
|
||||||
bobDomain,bobPort, \
|
bobDomain,bobPort, \
|
||||||
httpPrefix,outboxPostId, \
|
httpPrefix,outboxPostId, \
|
||||||
cachedWebfingers,personCache, \
|
cachedWebfingers,personCache, \
|
||||||
|
@ -1261,7 +1264,7 @@ def testClientToServer():
|
||||||
assert len([name for name in os.listdir(outboxPath) if os.path.isfile(os.path.join(outboxPath, name))])==2
|
assert len([name for name in os.listdir(outboxPath) if os.path.isfile(os.path.join(outboxPath, name))])==2
|
||||||
print(str(len([name for name in os.listdir(inboxPath) if os.path.isfile(os.path.join(inboxPath, name))])))
|
print(str(len([name for name in os.listdir(inboxPath) if os.path.isfile(os.path.join(inboxPath, name))])))
|
||||||
assert len([name for name in os.listdir(inboxPath) if os.path.isfile(os.path.join(inboxPath, name))])==1
|
assert len([name for name in os.listdir(inboxPath) if os.path.isfile(os.path.join(inboxPath, name))])==1
|
||||||
sendAnnounceViaServer(sessionBob,'bob',password, \
|
sendAnnounceViaServer(bobDir,sessionBob,'bob',password, \
|
||||||
bobDomain,bobPort, \
|
bobDomain,bobPort, \
|
||||||
httpPrefix,outboxPostId, \
|
httpPrefix,outboxPostId, \
|
||||||
cachedWebfingers, \
|
cachedWebfingers, \
|
||||||
|
@ -1283,7 +1286,7 @@ def testClientToServer():
|
||||||
postsBefore = len([name for name in os.listdir(inboxPath) if os.path.isfile(os.path.join(inboxPath, name))])
|
postsBefore = len([name for name in os.listdir(inboxPath) if os.path.isfile(os.path.join(inboxPath, name))])
|
||||||
print('\n\nAlice deletes her post: '+outboxPostId+' '+str(postsBefore))
|
print('\n\nAlice deletes her post: '+outboxPostId+' '+str(postsBefore))
|
||||||
password='alicepass'
|
password='alicepass'
|
||||||
sendDeleteViaServer(sessionAlice,'alice',password,
|
sendDeleteViaServer(aliceDir,sessionAlice,'alice',password,
|
||||||
aliceDomain,alicePort, \
|
aliceDomain,alicePort, \
|
||||||
httpPrefix,outboxPostId, \
|
httpPrefix,outboxPostId, \
|
||||||
cachedWebfingers,personCache, \
|
cachedWebfingers,personCache, \
|
||||||
|
@ -1302,7 +1305,8 @@ def testClientToServer():
|
||||||
|
|
||||||
print('\n\nAlice unfollows Bob')
|
print('\n\nAlice unfollows Bob')
|
||||||
password='alicepass'
|
password='alicepass'
|
||||||
sendUnfollowRequestViaServer(sessionAlice,'alice',password, \
|
sendUnfollowRequestViaServer(baseDir,sessionAlice, \
|
||||||
|
'alice',password, \
|
||||||
aliceDomain,alicePort, \
|
aliceDomain,alicePort, \
|
||||||
'bob',bobDomain,bobPort, \
|
'bob',bobDomain,bobPort, \
|
||||||
httpPrefix, \
|
httpPrefix, \
|
||||||
|
|
|
@ -738,7 +738,8 @@ def htmlProfileFollowing(baseDir: str,httpPrefix: str, \
|
||||||
profileStr=''
|
profileStr=''
|
||||||
for item in followingJson['orderedItems']:
|
for item in followingJson['orderedItems']:
|
||||||
profileStr+= \
|
profileStr+= \
|
||||||
individualFollowAsHtml(session,wfRequest,personCache, \
|
individualFollowAsHtml(baseDir,session, \
|
||||||
|
wfRequest,personCache, \
|
||||||
domain,item,authorized,nickname, \
|
domain,item,authorized,nickname, \
|
||||||
httpPrefix,projectVersion, \
|
httpPrefix,projectVersion, \
|
||||||
buttons)
|
buttons)
|
||||||
|
@ -935,7 +936,7 @@ def htmlProfile(projectVersion: str, \
|
||||||
profileStr=htmlHeader(profileStyle)+profileStr+htmlFooter()
|
profileStr=htmlHeader(profileStyle)+profileStr+htmlFooter()
|
||||||
return profileStr
|
return profileStr
|
||||||
|
|
||||||
def individualFollowAsHtml(session,wfRequest: {}, \
|
def individualFollowAsHtml(baseDir: str,session,wfRequest: {}, \
|
||||||
personCache: {},domain: str, \
|
personCache: {},domain: str, \
|
||||||
followUrl: str, \
|
followUrl: str, \
|
||||||
authorized: bool, \
|
authorized: bool, \
|
||||||
|
@ -951,7 +952,7 @@ def individualFollowAsHtml(session,wfRequest: {}, \
|
||||||
avatarUrl=followUrl+'/avatar.png'
|
avatarUrl=followUrl+'/avatar.png'
|
||||||
if domain not in followUrl:
|
if domain not in followUrl:
|
||||||
inboxUrl,pubKeyId,pubKey,fromPersonId,sharedInbox,capabilityAcquisition,avatarUrl2,preferredName = \
|
inboxUrl,pubKeyId,pubKey,fromPersonId,sharedInbox,capabilityAcquisition,avatarUrl2,preferredName = \
|
||||||
getPersonBox(session,wfRequest,personCache, \
|
getPersonBox(baseDir,session,wfRequest,personCache, \
|
||||||
projectVersion,httpPrefix,domain,'outbox')
|
projectVersion,httpPrefix,domain,'outbox')
|
||||||
if avatarUrl2:
|
if avatarUrl2:
|
||||||
avatarUrl=avatarUrl2
|
avatarUrl=avatarUrl2
|
||||||
|
@ -1104,7 +1105,7 @@ def individualPostAsHtml(baseDir: str, \
|
||||||
|
|
||||||
if fullDomain not in postJsonObject['actor']:
|
if fullDomain not in postJsonObject['actor']:
|
||||||
inboxUrl,pubKeyId,pubKey,fromPersonId,sharedInbox,capabilityAcquisition,avatarUrl2,preferredName = \
|
inboxUrl,pubKeyId,pubKey,fromPersonId,sharedInbox,capabilityAcquisition,avatarUrl2,preferredName = \
|
||||||
getPersonBox(session,wfRequest,personCache, \
|
getPersonBox(baseDir,session,wfRequest,personCache, \
|
||||||
projectVersion,httpPrefix,domain,'outbox')
|
projectVersion,httpPrefix,domain,'outbox')
|
||||||
if avatarUrl2:
|
if avatarUrl2:
|
||||||
avatarUrl=avatarUrl2
|
avatarUrl=avatarUrl2
|
||||||
|
|
Loading…
Reference in New Issue