Store full actor if not following /users/ convention

main
Bob Mottram 2020-10-24 10:43:00 +01:00
parent a2db59371b
commit 92256f20f8
1 changed files with 9 additions and 2 deletions

View File

@ -545,7 +545,7 @@ def receiveFollowRequest(session, baseDir: str, httpPrefix: str,
'/channel/' not in messageJson['actor'] and \ '/channel/' not in messageJson['actor'] and \
'/profile/' not in messageJson['actor']: '/profile/' not in messageJson['actor']:
if debug: if debug:
print('DEBUG: "users" or "profile" missing from actor') print('DEBUG: users/profile/accounts/channel missing from actor')
return False return False
domain, tempPort = getDomainFromActor(messageJson['actor']) domain, tempPort = getDomainFromActor(messageJson['actor'])
fromPort = port fromPort = port
@ -573,7 +573,8 @@ def receiveFollowRequest(session, baseDir: str, httpPrefix: str,
'/channel/' not in messageJson['object'] and \ '/channel/' not in messageJson['object'] and \
'/profile/' not in messageJson['object']: '/profile/' not in messageJson['object']:
if debug: if debug:
print('DEBUG: "users" or "profile" not found within object') print('DEBUG: users/profile/channel/accounts ' +
'not found within object')
return False return False
domainToFollow, tempPort = getDomainFromActor(messageJson['object']) domainToFollow, tempPort = getDomainFromActor(messageJson['object'])
if not domainPermitted(domainToFollow, federationList): if not domainPermitted(domainToFollow, federationList):
@ -662,6 +663,12 @@ def receiveFollowRequest(session, baseDir: str, httpPrefix: str,
followersFilename = \ followersFilename = \
baseDir + '/accounts/' + \ baseDir + '/accounts/' + \
nicknameToFollow + '@' + domainToFollow + '/followers.txt' nicknameToFollow + '@' + domainToFollow + '/followers.txt'
# for actors which don't follow the mastodon
# /users/ path convention store the full actor
if '/users/' not in messageJson['actor']:
approveHandle = messageJson['actor']
print('Updating followers file: ' + print('Updating followers file: ' +
followersFilename + ' adding ' + approveHandle) followersFilename + ' adding ' + approveHandle)
if os.path.isfile(followersFilename): if os.path.isfile(followersFilename):