better outbound emoji
Ted Unangst tedu@tedunangst.com
Mon, 27 Jul 2020 00:30:01 -0400
3 files changed,
29 insertions(+),
9 deletions(-)
M
activity.go
→
activity.go
@@ -1306,6 +1306,22 @@ atts := activatedonks(ch.Donks)
if len(atts) > 0 { jo["attachment"] = atts } + var tags []junk.Junk + for _, e := range herdofemus(ch.Noise) { + t := junk.New() + t["id"] = e.ID + t["type"] = "Emoji" + t["name"] = e.Name + i := junk.New() + i["type"] = "Image" + i["mediaType"] = "image/png" + i["url"] = e.ID + t["icon"] = i + tags = append(tags, t) + } + if len(tags) > 0 { + jo["tag"] = tags + } j := junk.New() j["@context"] = itiswhatitis
M
fun.go
→
fun.go
@@ -177,19 +177,23 @@ return string(templates.Sprintf(`<img alt="%s" src="<a href="%s">%s</a>">`, alt, src, src))
} } -func filterchonk(ch *Chonk) { - var htf htfilter.Filter - htf.SpanClasses = allowedclasses - htf.BaseURL, _ = url.Parse(ch.XID) +func translatechonk(ch *Chonk) { noise := ch.Noise - local := false if ch.Format == "markdown" { noise = markitzero(noise) - local = true } - + var htf htfilter.Filter + htf.SpanClasses = allowedclasses + htf.BaseURL, _ = url.Parse(ch.XID) ch.HTML, _ = htf.String(noise) - noise = string(ch.HTML) +} + +func filterchonk(ch *Chonk) { + translatechonk(ch) + + noise := string(ch.HTML) + + local := originate(ch.XID) == serverName zap := make(map[string]bool) emuxifier := func(e string) string {