mirror of https://gitlab.com/bashrc2/epicyon
Follow file not strictly required for approval
parent
2276b5661b
commit
d1493585bc
26
follow.py
26
follow.py
|
@ -525,7 +525,7 @@ def receiveFollowRequest(session,baseDir: str,httpPrefix: str, \
|
|||
messageJson,acceptedCaps, \
|
||||
sendThreads,postLog, \
|
||||
cachedWebfingers,personCache, \
|
||||
debug,projectVersion)
|
||||
debug,projectVersion,True)
|
||||
|
||||
def followedAccountAccepts(session,baseDir: str,httpPrefix: str, \
|
||||
nicknameToFollow: str,domainToFollow: str,port: int, \
|
||||
|
@ -534,7 +534,8 @@ def followedAccountAccepts(session,baseDir: str,httpPrefix: str, \
|
|||
followJson: {},acceptedCaps: [], \
|
||||
sendThreads: [],postLog: [], \
|
||||
cachedWebfingers: {},personCache: {}, \
|
||||
debug: bool,projectVersion: str):
|
||||
debug: bool,projectVersion: str, \
|
||||
removeFollowActivity: bool):
|
||||
"""The person receiving a follow request accepts the new follower
|
||||
and sends back an Accept activity
|
||||
"""
|
||||
|
@ -555,16 +556,17 @@ def followedAccountAccepts(session,baseDir: str,httpPrefix: str, \
|
|||
acceptHandle+' port '+ str(fromPort))
|
||||
clientToServer=False
|
||||
|
||||
# remove the follow request json
|
||||
followActivityfilename= \
|
||||
baseDir+'/accounts/'+ \
|
||||
nicknameToFollow+'@'+domainToFollow+'/requests/'+ \
|
||||
nickname+'@'+domain+'.follow'
|
||||
if os.path.isfile(followActivityfilename):
|
||||
try:
|
||||
os.remove(followActivityfilename)
|
||||
except:
|
||||
pass
|
||||
if removeFollowActivity:
|
||||
# remove the follow request json
|
||||
followActivityfilename= \
|
||||
baseDir+'/accounts/'+ \
|
||||
nicknameToFollow+'@'+domainToFollow+'/requests/'+ \
|
||||
nickname+'@'+domain+'.follow'
|
||||
if os.path.isfile(followActivityfilename):
|
||||
try:
|
||||
os.remove(followActivityfilename)
|
||||
except:
|
||||
pass
|
||||
|
||||
return sendSignedJson(acceptJson,session,baseDir, \
|
||||
nicknameToFollow,domainToFollow,port, \
|
||||
|
|
|
@ -86,6 +86,7 @@ def manualApproveFollowRequest(session,baseDir: str, \
|
|||
|
||||
approvefilenew = open(approveFollowsFilename+'.new', 'w+')
|
||||
updateApprovedFollowers=False
|
||||
followActivityfilename=None
|
||||
with open(approveFollowsFilename, 'r') as approvefile:
|
||||
for handleOfFollowRequester in approvefile:
|
||||
# is this the approved follow?
|
||||
|
@ -113,8 +114,8 @@ def manualApproveFollowRequest(session,baseDir: str, \
|
|||
followJson,acceptedCaps, \
|
||||
sendThreads,postLog, \
|
||||
cachedWebfingers,personCache, \
|
||||
debug,projectVersion)
|
||||
updateApprovedFollowers=True
|
||||
debug,projectVersion,False)
|
||||
updateApprovedFollowers=True
|
||||
else:
|
||||
# this isn't the approved follow so it will remain
|
||||
# in the requests file
|
||||
|
@ -147,5 +148,9 @@ def manualApproveFollowRequest(session,baseDir: str, \
|
|||
if approveHandle in open(followersFilename).read():
|
||||
# update the follow requests with the handles not yet approved
|
||||
os.rename(approveFollowsFilename+'.new',approveFollowsFilename)
|
||||
# remove the .follow file
|
||||
if followActivityfilename:
|
||||
if os.path.isfile(followActivityfilename):
|
||||
os.remove(followActivityfilename)
|
||||
else:
|
||||
os.remove(approveFollowsFilename+'.new')
|
||||
|
|
Loading…
Reference in New Issue