From 92256f20f8789a42a723d77f73e2ff28933aa7ea Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sat, 24 Oct 2020 10:43:00 +0100 Subject: [PATCH] Store full actor if not following /users/ convention --- follow.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/follow.py b/follow.py index 90795607..d9a22f09 100644 --- a/follow.py +++ b/follow.py @@ -545,7 +545,7 @@ def receiveFollowRequest(session, baseDir: str, httpPrefix: str, '/channel/' not in messageJson['actor'] and \ '/profile/' not in messageJson['actor']: if debug: - print('DEBUG: "users" or "profile" missing from actor') + print('DEBUG: users/profile/accounts/channel missing from actor') return False domain, tempPort = getDomainFromActor(messageJson['actor']) fromPort = port @@ -573,7 +573,8 @@ def receiveFollowRequest(session, baseDir: str, httpPrefix: str, '/channel/' not in messageJson['object'] and \ '/profile/' not in messageJson['object']: if debug: - print('DEBUG: "users" or "profile" not found within object') + print('DEBUG: users/profile/channel/accounts ' + + 'not found within object') return False domainToFollow, tempPort = getDomainFromActor(messageJson['object']) if not domainPermitted(domainToFollow, federationList): @@ -662,6 +663,12 @@ def receiveFollowRequest(session, baseDir: str, httpPrefix: str, followersFilename = \ baseDir + '/accounts/' + \ 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: ' + followersFilename + ' adding ' + approveHandle) if os.path.isfile(followersFilename):