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,23 +208,21 @@ func (a *goBlog) apHandleInbox(w http.ResponseWriter, r *http.Request) {
|
||||||
}
|
}
|
||||||
case ap.CreateType, ap.UpdateType:
|
case ap.CreateType, ap.UpdateType:
|
||||||
if activity.Object.IsObject() {
|
if activity.Object.IsObject() {
|
||||||
object, err := ap.ToObject(activity.Object)
|
if object, err := ap.ToObject(activity.Object); err == nil &&
|
||||||
if err == nil && (object.GetType() == ap.NoteType || object.GetType() == ap.ArticleType) {
|
(object.GetType() == ap.NoteType || object.GetType() == ap.ArticleType) &&
|
||||||
objectLink := object.GetID()
|
(object.To.Contains(ap.PublicNS) || object.CC.Contains(ap.PublicNS)) {
|
||||||
if replyTo := object.InReplyTo.GetID(); objectLink != "" && replyTo != "" && strings.HasPrefix(replyTo.String(), blogIri) {
|
target := object.InReplyTo.GetID().String()
|
||||||
target := replyTo.String()
|
original := object.GetID().String()
|
||||||
original := objectLink.String()
|
name := requestActor.Name.First().Value.String()
|
||||||
name := requestActor.Name.First().Value.String()
|
if username := requestActor.PreferredUsername.First().String(); name == "" && username != "" {
|
||||||
if username := requestActor.PreferredUsername.First().String(); name == "" && username != "" {
|
name = username
|
||||||
name = username
|
|
||||||
}
|
|
||||||
website := requestActor.GetLink().String()
|
|
||||||
if actorUrl := requestActor.URL.GetLink(); actorUrl != "" {
|
|
||||||
website = actorUrl.String()
|
|
||||||
}
|
|
||||||
content := object.Content.First().Value.String()
|
|
||||||
a.createComment(blog, target, content, name, website, original)
|
|
||||||
}
|
}
|
||||||
|
website := requestActor.GetLink().String()
|
||||||
|
if actorUrl := requestActor.URL.GetLink(); actorUrl != "" {
|
||||||
|
website = actorUrl.String()
|
||||||
|
}
|
||||||
|
content := object.Content.First().Value.String()
|
||||||
|
_, _, _ = a.createComment(blog, target, content, name, website, original)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
case ap.DeleteType, ap.BlockType:
|
case ap.DeleteType, ap.BlockType:
|
||||||
|
|
Loading…
Reference in New Issue