Group webfinger

merge-requests/30/head
Bob Mottram 2021-07-29 17:16:42 +01:00
parent 4a5a22c105
commit cf809f3b09
1 changed files with 20 additions and 5 deletions

View File

@ -63,20 +63,35 @@ def webfingerHandle(session, handle: str, httpPrefix: str,
print('Webfinger from cache: ' + str(wf)) print('Webfinger from cache: ' + str(wf))
return wf return wf
url = '{}://{}/.well-known/webfinger'.format(httpPrefix, domain) url = '{}://{}/.well-known/webfinger'.format(httpPrefix, domain)
par = {
'resource': 'acct:{}'.format(nickname + '@' + wfDomain)
}
hdr = { hdr = {
'Accept': 'application/jrd+json' 'Accept': 'application/jrd+json'
} }
par = {
'resource': 'acct:{}'.format(nickname + '@' + wfDomain)
}
success = False
try: try:
result = \ result = \
getJson(session, url, hdr, par, getJson(session, url, hdr, par,
debug, projectVersion, debug, projectVersion,
httpPrefix, fromDomain) httpPrefix, fromDomain)
if result:
success = True
except Exception as e: except Exception as e:
print('ERROR: webfingerHandle ' + str(e)) print('ERROR: webfingerHandle acct ' + str(e))
return None pass
if not success:
par['resource'] = par['resource'].replace('acct:', 'group:')
try:
result = \
getJson(session, url, hdr, par,
debug, projectVersion,
httpPrefix, fromDomain)
if result:
success = True
except Exception as e:
print('ERROR: webfingerHandle group ' + str(e))
return None
if result: if result:
storeWebfingerInCache(nickname + '@' + wfDomain, storeWebfingerInCache(nickname + '@' + wfDomain,