better outbound emoji

Ted Unangst 4 years ago
parent 4064d45595
commit 76e35e2d51

@ -1306,6 +1306,22 @@ func chonkifymsg(user *WhatAbout, ch *Chonk) []byte {
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

@ -177,19 +177,23 @@ func replaceimgsand(zap map[string]bool, absolute bool) func(node *html.Node) st
}
}
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 {

@ -1825,7 +1825,7 @@ func submitchonk(w http.ResponseWriter, r *http.Request) {
ch.Donks = append(ch.Donks, d)
}
filterchonk(&ch)
translatechonk(&ch)
savechonk(&ch)
// reload for consistency
ch.Donks = nil

Loading…
Cancel
Save