From 25c46f5839e449f1bc60e03e00b2c20ed2791ebd Mon Sep 17 00:00:00 2001 From: Ted Unangst Date: Sat, 5 Oct 2019 02:46:01 -0400 Subject: [PATCH] grotesque workaround for friendica style repeats --- activity.go | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/activity.go b/activity.go index 2f53296..2cb523f 100644 --- a/activity.go +++ b/activity.go @@ -26,6 +26,7 @@ import ( "net/http" "net/url" "os" + "regexp" "strings" "sync" "time" @@ -555,10 +556,39 @@ func xonksaver(user *WhatAbout, item junk.Junk, origin string) *Honk { return nil } + if obj != nil { + _, ok := obj.GetString("diaspora:guid") + if ok { + // frienda does the silliest bonks + c, ok := item.FindString([]string{"source", "content"}) + if ok { + re_link := regexp.MustCompile(`link='([^']*)'`) + m := re_link.FindStringSubmatch(c) + if len(m) > 1 { + xid := m[1] + log.Printf("getting friendica flavored bonk: %s", xid) + if !needxonkid(user, xid) { + return nil + } + newobj, err := GetJunkHardMode(xid) + if err != nil { + log.Printf("error getting bonk: %s: %s", xid, err) + } else { + obj = newobj + origin = originate(xid) + what = "bonk" + } + } + } + } + } var xonk Honk // early init xonk.UserID = user.ID xonk.Honker, _ = item.GetString("actor") + if xonk.Honker == "" { + xonk.Honker, _ = item.GetString("attributedTo") + } if obj != nil { if xonk.Honker == "" { xonk.Honker = extractattrto(obj)