Command to list pending follower approvals

master
Bob Mottram 2019-07-19 21:16:37 +01:00
parent 365b544d87
commit ebcd8d771d
2 changed files with 25 additions and 1 deletions

View File

@ -196,6 +196,9 @@ parser.add_argument('--reply','--replyto', dest='replyto', type=str,default=None
parser.add_argument("--followersonly", type=str2bool, nargs='?', \
const=True, default=True, \
help="Send to followers only")
parser.add_argument("--followerspending", type=str2bool, nargs='?', \
const=True, default=True, \
help="Show a list of followers pending")
parser.add_argument("-c","--client", type=str2bool, nargs='?', \
const=True, default=False, \
help="Use as an ActivityPub client")
@ -320,6 +323,24 @@ useTor=args.tor
if domain.endswith('.onion'):
useTor=True
if args.followerspending:
if not args.nickname:
print('Specify a nickname with the --nickname option')
sys.exit()
accountsDir=baseDir+'/accounts/'+args.nickname+'@'+domain
approveFollowsFilename=accountDir+'/followrequests.txt'
approveCtr=0
if os.path.isfile(approveFollowsFilename):
with open(approveFollowsFilename, 'r') as approvefile:
for approve in approvefile:
print(approve.replace('\n',''))
approveCtr+=1
if approveCtr==0:
print('There are no follow requests pending approval.')
sys.exit()
if args.message:
if not args.nickname:
print('Specify a nickname with the --nickname option')

View File

@ -336,7 +336,10 @@ def receiveFollowRequest(session,baseDir: str,httpPrefix: str, \
domainToFollow,debug):
accountsDir=baseDir+'/accounts/'+nicknameToFollow+'@'+domainToFollow
if os.path.isdir(accountDir):
if port!=80 and port!=443:
approveHandle=nicknameToFollow+'@'+domainToFollow+':'+str(port)
else:
approveHandle=nicknameToFollow+'@'+domainToFollow
approveFollowsFilename=accountDir+'/followrequests.txt'
if os.path.isfile(approveFollowsFilename):
if approveHandle not in open(approveFollowsFilename).read():