master
Bob Mottram 2019-08-07 17:09:53 +01:00
parent 1645e223f0
commit d929818532
2 changed files with 13 additions and 0 deletions

View File

@ -754,10 +754,15 @@ class PubServer(BaseHTTPRequestHandler):
originPathStr=self.path.split('/followapprove=')[0] originPathStr=self.path.split('/followapprove=')[0]
followerNickname=originPathStr.replace('/users/','') followerNickname=originPathStr.replace('/users/','')
followingHandle=self.path.split('/followapprove=')[1] followingHandle=self.path.split('/followapprove=')[1]
print('*********************************************')
print('followingHandle: '+followingHandle)
print('followerNickname: '+followerNickname)
if '@' in followingHandle: if '@' in followingHandle:
print('Test1')
if not self.server.session: if not self.server.session:
self.server.session= \ self.server.session= \
createSession(self.server.domain,self.server.port,self.server.useTor) createSession(self.server.domain,self.server.port,self.server.useTor)
print('Test2')
manualApproveFollowRequest(self.server.session, \ manualApproveFollowRequest(self.server.session, \
self.server.baseDir, \ self.server.baseDir, \
self.server.httpPrefix, \ self.server.httpPrefix, \

View File

@ -44,6 +44,7 @@ def manualApproveFollowRequest(session,baseDir: str, \
debug: bool) -> None: debug: bool) -> None:
"""Manually approve a follow request """Manually approve a follow request
""" """
print('Test3')
handle=nickname+'@'+domain handle=nickname+'@'+domain
accountsDir=baseDir+'/accounts/'+handle accountsDir=baseDir+'/accounts/'+handle
approveFollowsFilename=accountsDir+'/followrequests.txt' approveFollowsFilename=accountsDir+'/followrequests.txt'
@ -55,17 +56,22 @@ def manualApproveFollowRequest(session,baseDir: str, \
if debug: if debug:
print(handle+' not in '+approveFollowsFilename) print(handle+' not in '+approveFollowsFilename)
return return
print('Test4')
approvefilenew = open(approveFollowsFilename+'.new', 'w+') approvefilenew = open(approveFollowsFilename+'.new', 'w+')
with open(approveFollowsFilename, 'r') as approvefile: with open(approveFollowsFilename, 'r') as approvefile:
for handle in approvefile: for handle in approvefile:
if handle.startswith(approveHandle): if handle.startswith(approveHandle):
print('Test5: '+handle)
port2=port port2=port
if ':' in handle: if ':' in handle:
port2=int(handle.split(':')[1].replace('\n','')) port2=int(handle.split(':')[1].replace('\n',''))
requestsDir=accountsDir+'/requests' requestsDir=accountsDir+'/requests'
followActivityfilename=requestsDir+'/'+handle+'.follow' followActivityfilename=requestsDir+'/'+handle+'.follow'
print('Test6: '+followActivityfilename)
if os.path.isfile(followActivityfilename): if os.path.isfile(followActivityfilename):
print('Test6')
with open(followActivityfilename, 'r') as fp: with open(followActivityfilename, 'r') as fp:
print('Test7')
followJson=commentjson.load(fp) followJson=commentjson.load(fp)
approveNickname=approveHandle.split('@')[0] approveNickname=approveHandle.split('@')[0]
approveDomain=approveHandle.split('@')[1].replace('\n','') approveDomain=approveHandle.split('@')[1].replace('\n','')
@ -73,6 +79,7 @@ def manualApproveFollowRequest(session,baseDir: str, \
if ':' in approveDomain: if ':' in approveDomain:
approvePort=approveDomain.split(':')[1] approvePort=approveDomain.split(':')[1]
approveDomain=approveDomain.split(':')[0] approveDomain=approveDomain.split(':')[0]
print('Test8: '+approveNickname+' '+approveDomain+' '+approvePort+' '+followJson['actor'])
followedAccountAccepts(session,baseDir,httpPrefix, \ followedAccountAccepts(session,baseDir,httpPrefix, \
nickname,domain,port, \ nickname,domain,port, \
approveNickname,approveDomain,approvePort, \ approveNickname,approveDomain,approvePort, \
@ -81,6 +88,7 @@ def manualApproveFollowRequest(session,baseDir: str, \
sendThreads,postLog, \ sendThreads,postLog, \
cachedWebfingers,personCache, \ cachedWebfingers,personCache, \
debug) debug)
print("Test9")
os.remove(followActivityfilename) os.remove(followActivityfilename)
else: else:
approvefilenew.write(handle) approvefilenew.write(handle)