all repos — honk @ 3be4faf1e5fe58610d74cb7930dab4e915c410b7

my fork of honk

better outbound emoji
Ted Unangst tedu@tedunangst.com
Mon, 27 Jul 2020 00:30:01 -0400
commit

3be4faf1e5fe58610d74cb7930dab4e915c410b7

parent

6e06b3da023f9d93e3d71c6da0c889e803d06c9c

3 files changed, 29 insertions(+), 9 deletions(-)

jump to
M activity.goactivity.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.gofun.go

@@ -177,19 +177,23 @@ return string(templates.Sprintf(`&lt;img alt="%s" src="<a href="%s">%s</a>"&gt;`, 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 {
M web.goweb.go

@@ -1825,7 +1825,7 @@ if d != nil {

ch.Donks = append(ch.Donks, d) } - filterchonk(&ch) + translatechonk(&ch) savechonk(&ch) // reload for consistency ch.Donks = nil