From e44a321ec53bc84b5986ac0371b4122201fa3a5a Mon Sep 17 00:00:00 2001 From: Andrew Godwin Date: Sat, 5 Nov 2022 17:51:54 -0600 Subject: Get Actor fetching and parsing working --- users/views/identity.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'users/views') 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 -- cgit v1.2.3