grotesque workaround for friendica style repeats
Ted Unangst tedu@tedunangst.com
Sat, 05 Oct 2019 02:46:01 -0400
1 files changed,
30 insertions(+),
0 deletions(-)
jump to
M
activity.go
→
activity.go
@@ -26,6 +26,7 @@ notrand "math/rand"
"net/http" "net/url" "os" + "regexp" "strings" "sync" "time"@@ -555,10 +556,39 @@ fd.Close()
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)