From 9eecf1c90234ebedaac1f60c961d617a5e252642 Mon Sep 17 00:00:00 2001 From: Gabe Kangas Date: Wed, 12 Jan 2022 18:42:33 -0800 Subject: [PATCH] Handle create requests but immediately throw an error that we ignore them --- activitypub/inbox/create.go | 13 +++++++++++++ activitypub/inbox/worker.go | 8 +++----- 2 files changed, 16 insertions(+), 5 deletions(-) create mode 100644 activitypub/inbox/create.go diff --git a/activitypub/inbox/create.go b/activitypub/inbox/create.go new file mode 100644 index 000000000..3eab72a5e --- /dev/null +++ b/activitypub/inbox/create.go @@ -0,0 +1,13 @@ +package inbox + +import ( + "context" + + "github.com/go-fed/activity/streams/vocab" + "github.com/pkg/errors" +) + +func handleCreateRequest(c context.Context, activity vocab.ActivityStreamsCreate) error { + iri := activity.GetJSONLDId().GetIRI().String() + return errors.New("not handling create request of: " + iri) +} diff --git a/activitypub/inbox/worker.go b/activitypub/inbox/worker.go index 609a0e932..03e5c985f 100644 --- a/activitypub/inbox/worker.go +++ b/activitypub/inbox/worker.go @@ -24,14 +24,12 @@ func handle(request apmodels.InboxRequest) { log.Debugln("Error in attempting to verify request", err) return } else if !verified { - log.Errorln("Request failed verification", err) + log.Debugln("Request failed verification", err) return } - // c := context.WithValue(context.Background(), "account", request.ForLocalAccount) //nolint - - if err := resolvers.Resolve(context.Background(), request.Body, handleUpdateRequest, handleFollowInboxRequest, handleLikeRequest, handleAnnounceRequest, handleUndoInboxRequest); err != nil { - log.Errorln("resolver error:", err) + if err := resolvers.Resolve(context.Background(), request.Body, handleUpdateRequest, handleFollowInboxRequest, handleLikeRequest, handleAnnounceRequest, handleUndoInboxRequest, handleCreateRequest); err != nil { + log.Debugln("resolver error:", err) } }