From d217762b5ec7cac3f9c23a12c78ab177144d50e2 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sun, 1 Sep 2019 21:28:43 +0100 Subject: [PATCH] Fix adding followers without approval --- follow.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/follow.py b/follow.py index 84f9fef6..39f7cba5 100644 --- a/follow.py +++ b/follow.py @@ -440,6 +440,22 @@ def receiveFollowRequest(session,baseDir: str,httpPrefix: str, \ messageJson,debug) else: print('Follow request does not require approval') + # update the followers + if os.path.isdir(baseDir+'/accounts/'+nicknameToFollow+'@'+domainToFollow): + followersFilename=baseDir+'/accounts/'+nicknameToFollow+'@'+domainToFollow+'/followers.txt' + approveHandle=nickname+'@'+domain + if fromPort: + approveHandle=approveHandle+':'+str(fromPort) + print('Updating followers file: '+followersFilename+' adding '+approveHandle) + if os.path.isfile(followersFilename): + if approveHandle not in open(followersFilename).read(): + followersFile=open(followersFilename, "a+") + followersFile.write(approveHandle+'\n') + followersFile.close() + else: + followersFile=open(followersFilename, "w+") + followersFile.write(approveHandle+'\n') + followersFile.close() print('Beginning follow accept') return followedAccountAccepts(session,baseDir,httpPrefix, \