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