still tweaking webfinger syntax

This commit is contained in:
Mouse Reeve 2020-11-01 12:29:31 -08:00
parent 65371d6904
commit 4b7de93c90
2 changed files with 3 additions and 3 deletions

View file

@ -52,7 +52,7 @@ def handle_remote_webfinger(query):
try: try:
user = models.User.objects.get(username=query) user = models.User.objects.get(username=query)
except models.User.DoesNotExist: except models.User.DoesNotExist:
url = 'https://%s/.well-known/webfinger?resource=acct:@%s' % \ url = 'https://%s/.well-known/webfinger?resource=acct:%s' % \
(domain, query) (domain, query)
try: try:
response = requests.get(url) response = requests.get(url)

View file

@ -19,14 +19,14 @@ def webfinger(request):
if not resource and not resource.startswith('acct:'): if not resource and not resource.startswith('acct:'):
return HttpResponseNotFound() return HttpResponseNotFound()
username = resource.replace('acct:@', '') username = resource.replace('acct:', '')
try: try:
user = models.User.objects.get(username=username) user = models.User.objects.get(username=username)
except models.User.DoesNotExist: except models.User.DoesNotExist:
return HttpResponseNotFound('No account found') return HttpResponseNotFound('No account found')
return JsonResponse({ return JsonResponse({
'subject': 'acct:@%s' % (user.username), 'subject': 'acct:%s' % (user.username),
'links': [ 'links': [
{ {
'rel': 'self', 'rel': 'self',