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