mirror of https://github.com/jlelse/GoBlog
Check for public namespace in to or cc of activitypub replies
This commit is contained in:
parent
84b75467ca
commit
35dddbd852
|
@ -208,12 +208,11 @@ func (a *goBlog) apHandleInbox(w http.ResponseWriter, r *http.Request) {
|
|||
}
|
||||
case ap.CreateType, ap.UpdateType:
|
||||
if activity.Object.IsObject() {
|
||||
object, err := ap.ToObject(activity.Object)
|
||||
if err == nil && (object.GetType() == ap.NoteType || object.GetType() == ap.ArticleType) {
|
||||
objectLink := object.GetID()
|
||||
if replyTo := object.InReplyTo.GetID(); objectLink != "" && replyTo != "" && strings.HasPrefix(replyTo.String(), blogIri) {
|
||||
target := replyTo.String()
|
||||
original := objectLink.String()
|
||||
if object, err := ap.ToObject(activity.Object); err == nil &&
|
||||
(object.GetType() == ap.NoteType || object.GetType() == ap.ArticleType) &&
|
||||
(object.To.Contains(ap.PublicNS) || object.CC.Contains(ap.PublicNS)) {
|
||||
target := object.InReplyTo.GetID().String()
|
||||
original := object.GetID().String()
|
||||
name := requestActor.Name.First().Value.String()
|
||||
if username := requestActor.PreferredUsername.First().String(); name == "" && username != "" {
|
||||
name = username
|
||||
|
@ -223,8 +222,7 @@ func (a *goBlog) apHandleInbox(w http.ResponseWriter, r *http.Request) {
|
|||
website = actorUrl.String()
|
||||
}
|
||||
content := object.Content.First().Value.String()
|
||||
a.createComment(blog, target, content, name, website, original)
|
||||
}
|
||||
_, _, _ = a.createComment(blog, target, content, name, website, original)
|
||||
}
|
||||
}
|
||||
case ap.DeleteType, ap.BlockType:
|
||||
|
|
Loading…
Reference in New Issue