diff options
author | Andrew Godwin | 2022-11-05 17:51:54 -0600 |
---|---|---|
committer | Andrew Godwin | 2022-11-05 17:51:54 -0600 |
commit | e44a321ec53bc84b5986ac0371b4122201fa3a5a (patch) | |
tree | b3a5c4b42e59ad912001cf51c39db494b78aa07d /users/views | |
parent | 57e33f1215ee28f557f2765ec7864c6741d61e26 (diff) | |
download | takahe-e44a321ec53bc84b5986ac0371b4122201fa3a5a.tar.gz takahe-e44a321ec53bc84b5986ac0371b4122201fa3a5a.tar.bz2 takahe-e44a321ec53bc84b5986ac0371b4122201fa3a5a.zip |
Get Actor fetching and parsing working
Diffstat (limited to 'users/views')
-rw-r--r-- | users/views/identity.py | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/users/views/identity.py b/users/views/identity.py index 63b7fb8..9f2a7f9 100644 --- a/users/views/identity.py +++ b/users/views/identity.py @@ -4,6 +4,7 @@ from django.contrib.auth.decorators import login_required from django.http import Http404, JsonResponse from django.shortcuts import redirect from django.utils.decorators import method_decorator +from django.views.decorators.csrf import csrf_exempt from django.views.generic import FormView, TemplateView, View from core.forms import FormHelper @@ -88,7 +89,7 @@ class Actor(View): ], "id": f"https://{settings.DEFAULT_DOMAIN}{identity.urls.actor}", "type": "Person", - "preferredUsername": "alice", + "preferredUsername": identity.short_handle, "inbox": f"https://{settings.DEFAULT_DOMAIN}{identity.urls.inbox}", "publicKey": { "id": f"https://{settings.DEFAULT_DOMAIN}{identity.urls.actor}#main-key", @@ -99,6 +100,19 @@ class Actor(View): ) +@method_decorator(csrf_exempt, name="dispatch") +class Inbox(View): + """ + AP Inbox endpoint + """ + + def post(self, request, handle): + # Validate the signature + signature = request.META.get("HTTP_SIGNATURE") + print(signature) + print(request.body) + + class Webfinger(View): """ Services webfinger requests |