Use actor if webfinger fails

main2
Bob Mottram 2019-10-17 16:08:25 +01:00
parent 9ac770dc50
commit 2f716975e4
1 changed files with 8 additions and 2 deletions

View File

@ -842,6 +842,7 @@ if args.dat:
httpPrefix='dat'
if args.actor:
originalActor=args.actor
if '/@' in args.actor or '/users/' in args.actor or args.actor.startswith('http') or args.actor.startswith('dat'):
# format: https://domain/@nick
args.actor=args.actor.replace('https://','').replace('http://','').replace('dat://','').replace('/@','/users/')
@ -883,11 +884,16 @@ if args.actor:
print('Unable to webfinger '+nickname+'@'+domain)
sys.exit()
personUrl=None
if wfRequest.get('errors'):
print('wfRequest error: '+str(wfRequest['errors']))
if '/users/' in args.actor:
personUrl=originalActor
else:
sys.exit()
asHeader = {'Accept': 'application/activity+json; profile="https://www.w3.org/ns/activitystreams"'}
if not personUrl:
personUrl = getUserUrl(wfRequest)
if nickname==domain:
personUrl=personUrl.replace('/users/','/actor/')