all repos — honk @ 4d706e02a810a41ecd16359374c65aef93c28e68

my fork of honk

handle quoteUrl property
Ted Unangst tedu@tedunangst.com
Wed, 29 Nov 2023 15:32:06 -0500
commit

4d706e02a810a41ecd16359374c65aef93c28e68

parent

1d94b143cf264324326221dca3ad8d71d9392ed9

2 files changed, 14 insertions(+), 4 deletions(-)

jump to
M activity.goactivity.go

@@ -495,7 +495,7 @@ currenttid := ""

goingup := 0 var xonkxonkfn func(junk.Junk, string, bool, string) *Honk - qutify := func(user *WhatAbout, content string) string { + qutify := func(user *WhatAbout, qurl, content string) string { if depth >= maxdepth { ilog.Printf("in too deep") return content

@@ -504,6 +504,9 @@ // well this is gross

malcontent := strings.ReplaceAll(content, `</span><span class="ellipsis">`, "") malcontent = strings.ReplaceAll(malcontent, `</span><span class="invisible">`, "") mlinks := re_qtlinks.FindAllString(malcontent, -1) + if qurl != "" { + mlinks = append(mlinks, ">"+qurl+"<") + } for _, m := range mlinks { tryit := false m = m[1 : len(m)-1]

@@ -516,12 +519,16 @@ m = re_masto1ink.ReplaceAllString(m, "https://$1/users/$2/statuses/$3")

tryit = true } if tryit { + var prefix string + if m == qurl { + prefix += fmt.Sprintf("<p><a href=\"%s\">%s</a>", m, m) + } if x := getxonk(user.ID, m); x != nil { - content = fmt.Sprintf("%s<blockquote>%s</blockquote>", content, x.Noise) + content = fmt.Sprintf("%s%s<blockquote>%s</blockquote>", content, prefix, x.Noise) } else if j, err := GetJunk(user.ID, m); err == nil { q, ok := j.GetString("content") if ok { - content = fmt.Sprintf("%s<blockquote>%s</blockquote>", content, q) + content = fmt.Sprintf("%s%s<blockquote>%s</blockquote>", content, prefix, q) } prevdepth := depth depth = maxdepth

@@ -798,7 +805,8 @@ content += fmt.Sprintf(`<p><a href="%s">%s</a>`, url, url)

url = xid } if user.Options.InlineQuotes { - content = qutify(user, content) + qurl, _ := obj.GetString("quoteUrl") + content = qutify(user, qurl, content) } rid, ok = obj.GetString("inReplyTo") if !ok {
M docs/changelog.txtdocs/changelog.txt

@@ -2,6 +2,8 @@ changelog

### next ++ Handle quoteUrl property. + + Reroute memes to donks in emergencies. + Fix handling of svg with bom fucks.