From ca8f5fd483db14e9c4d061963c1ad5e5af217d69 Mon Sep 17 00:00:00 2001 From: mstar Date: Thu, 22 May 2025 17:01:02 +0200 Subject: [PATCH] Modify note inbox to use inbox actor for requesting the note --- web/public/api/activitypub/inbox.go | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/web/public/api/activitypub/inbox.go b/web/public/api/activitypub/inbox.go index e9b6ed9..e135ad1 100644 --- a/web/public/api/activitypub/inbox.go +++ b/web/public/api/activitypub/inbox.go @@ -694,7 +694,17 @@ func handleCreate(w http.ResponseWriter, r *http.Request, object map[string]any) } switch val := activity.Object.(type) { case string: - activitypub.ImportRemoteNote(val) + actor, err := dbgen.User.GetById(r.PathValue("id")) + if err != nil { + log.Error().Err(err).Msg("Failed to get local actor for importing targeted note") + webutils.ProblemDetailsStatusOnly(w, http.StatusInternalServerError) + return + } + _, err = activitypub.ImportRemoteNote(val, actor) + if err != nil { + log.Error().Err(err).Str("note-url", val).Msg("Failed to import remote note that landed as id in the inbox") + webutils.ProblemDetailsStatusOnly(w, http.StatusInternalServerError) + } return case map[string]any: default: