Add PGP keys and XMPP handle to the WebFinger output

This commit is contained in:
Danielle McLean 2017-11-10 10:30:09 +11:00
parent 85d95fb5d7
commit a518d72a7d
Signed by: 00dani
GPG key ID: 5A5D2D1AFF12EEC5

View file

@ -29,15 +29,22 @@ def webfinger(request):
def link(rel, href, type):
return {'rel': rel, 'href': urljoin(base, href), 'type': type}
key_links = tuple(link(
rel='pgpkey',
href=key.file.url,
type='application/pgp-keys',
) for key in user.keys.all())
info = {
'subject': 'acct:' + user.email,
'aliases': (
urljoin(base, user.url),
'mailto:' + user.email,
'xmpp:' + user.xmpp,
),
'links': (
link(rel=AVATAR, href=user.avatar.url, type='image/png'),
link(rel=PROFILE_PAGE, href=user.url, type='text/html'),
),
) + key_links,
}
return JsonResponse(info, content_type='application/jrd+json')