try processing forwarded creates
Ted Unangst tedu@tedunangst.com
Wed, 28 Feb 2024 03:08:39 -0500
3 files changed,
21 insertions(+),
11 deletions(-)
M
activity.go
→
activity.go
@@ -560,6 +560,20 @@ }
return "" } +func grabhonk(user *WhatAbout, xid string) { + if x := getxonk(user.ID, xid); x != nil { + dlog.Printf("already have it: %s", xid) + return + } + var final string + j, err := GetJunkTimeout(user.ID, xid, fastTimeout*time.Second, &final) + if err != nil { + dlog.Printf("unable to fetch xid: %s", err) + return + } + xonksaver(user, j, originate(final)) +} + var re_mast0link = regexp.MustCompile(`https://[[:alnum:].]+/users/[[:alnum:]]+/statuses/[[:digit:]]+`) var re_masto1ink = regexp.MustCompile(`https://([[:alnum:].]+)/@([[:alnum:]]+)(@[[:alnum:].]+)?/([[:digit:]]+)`) var re_misslink = regexp.MustCompile(`https://[[:alnum:].]+/notes/[[:alnum:]]+`)
M
syndicate.go
→
syndicate.go
@@ -23,18 +23,8 @@ return
} reverseItems(rss.Items) for _, item := range rss.Items { - var final string dlog.Printf("link: %s", item.Link) - if x := getxonk(user.ID, item.Link); x != nil { - dlog.Printf("already have it") - continue - } - j, err := GetJunkTimeout(user.ID, item.Link, fastTimeout*time.Second, &final) - if err != nil { - dlog.Printf("unable to fetch link: %s", err) - continue - } - xonksaver(user, j, originate(final)) + grabhonk(user, item.Link) } }
M
web.go
→
web.go
@@ -446,6 +446,12 @@ }
origin := keymatch(keyname, who) if origin == "" { ilog.Printf("keyname actor mismatch: %s <> %s", keyname, who) + if what == "Create" { + if xid, ok := j.GetString("object"); ok { + dlog.Printf("getting forwarded create from %s: %s", keyname, xid) + grabhonk(user, xid) + } + } return }