move emuxifier into html filter to avoid link damage
This commit is contained in:
parent
4e052bcfde
commit
4b89e0a43a
|
@ -2,6 +2,8 @@ changelog
|
|||
|
||||
=== next
|
||||
|
||||
+ Reduce interference between various text substitution rules.
|
||||
|
||||
+ Fix crash in search with extra space.
|
||||
|
||||
+ Fix pubkey issue with domain only keys.
|
||||
|
|
43
fun.go
43
fun.go
|
@ -97,29 +97,6 @@ func reverbolate(userid int64, honks []*Honk) {
|
|||
htf.Imager = replaceimgsand(zap, false)
|
||||
htf.SpanClasses = allowedclasses
|
||||
htf.BaseURL, _ = url.Parse(h.XID)
|
||||
p, _ := htf.String(h.Precis)
|
||||
n, _ := htf.String(h.Noise)
|
||||
h.Precis = string(p)
|
||||
h.Noise = string(n)
|
||||
}
|
||||
j := 0
|
||||
for i := 0; i < len(h.Donks); i++ {
|
||||
if !zap[h.Donks[i].XID] {
|
||||
h.Donks[j] = h.Donks[i]
|
||||
j++
|
||||
}
|
||||
}
|
||||
h.Donks = h.Donks[:j]
|
||||
}
|
||||
|
||||
unsee(honks, userid)
|
||||
|
||||
for _, h := range honks {
|
||||
local := false
|
||||
if h.Whofore == 2 || h.Whofore == 3 {
|
||||
local = true
|
||||
}
|
||||
zap := make(map[string]bool)
|
||||
emuxifier := func(e string) string {
|
||||
for _, d := range h.Donks {
|
||||
if d.Name == e {
|
||||
|
@ -138,10 +115,16 @@ func reverbolate(userid int64, honks []*Honk) {
|
|||
}
|
||||
return e
|
||||
}
|
||||
renderflags(h)
|
||||
h.Precis = re_emus.ReplaceAllStringFunc(h.Precis, emuxifier)
|
||||
h.Noise = re_emus.ReplaceAllStringFunc(h.Noise, emuxifier)
|
||||
|
||||
htf.FilterText = func(w io.Writer, data string) {
|
||||
data = htfilter.EscapeText(data)
|
||||
data = re_emus.ReplaceAllStringFunc(data, emuxifier)
|
||||
io.WriteString(w, data)
|
||||
}
|
||||
p, _ := htf.String(h.Precis)
|
||||
n, _ := htf.String(h.Noise)
|
||||
h.Precis = string(p)
|
||||
h.Noise = string(n)
|
||||
}
|
||||
j := 0
|
||||
for i := 0; i < len(h.Donks); i++ {
|
||||
if !zap[h.Donks[i].XID] {
|
||||
|
@ -150,6 +133,12 @@ func reverbolate(userid int64, honks []*Honk) {
|
|||
}
|
||||
}
|
||||
h.Donks = h.Donks[:j]
|
||||
}
|
||||
|
||||
unsee(honks, userid)
|
||||
|
||||
for _, h := range honks {
|
||||
renderflags(h)
|
||||
|
||||
h.HTPrecis = template.HTML(h.Precis)
|
||||
h.HTML = template.HTML(h.Noise)
|
||||
|
|
2
go.mod
2
go.mod
|
@ -9,5 +9,5 @@ require (
|
|||
golang.org/x/crypto v0.0.0-20190621222207-cc06ce4a13d4
|
||||
golang.org/x/net v0.0.0-20190620200207-3b0461eec859
|
||||
humungus.tedunangst.com/r/go-sqlite3 v1.1.3
|
||||
humungus.tedunangst.com/r/webs v0.6.42
|
||||
humungus.tedunangst.com/r/webs v0.6.43
|
||||
)
|
||||
|
|
6
go.sum
6
go.sum
|
@ -22,7 +22,5 @@ golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=
|
|||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
humungus.tedunangst.com/r/go-sqlite3 v1.1.3 h1:G2N4wzDS0NbuvrZtQJhh4F+3X+s7BF8b9ga8k38geUI=
|
||||
humungus.tedunangst.com/r/go-sqlite3 v1.1.3/go.mod h1:FtEEmQM7U2Ey1TuEEOyY1BmphTZnmiEjPsNLEAkpf/M=
|
||||
humungus.tedunangst.com/r/webs v0.6.41 h1:kteIzz03ij7EujsLLbRlquSgONRzoqIm1o1Bc5ie6HU=
|
||||
humungus.tedunangst.com/r/webs v0.6.41/go.mod h1:S9sXpVSbgAIa24yYhnMN0C94LKHG+2rioS+NsiDimps=
|
||||
humungus.tedunangst.com/r/webs v0.6.42 h1:y1j7Z04Bs8/UmzYwsQb2OfOs1F1veJ6u9bwjc70PhLo=
|
||||
humungus.tedunangst.com/r/webs v0.6.42/go.mod h1:S9sXpVSbgAIa24yYhnMN0C94LKHG+2rioS+NsiDimps=
|
||||
humungus.tedunangst.com/r/webs v0.6.43 h1:V7tmvzXi/LETO2QfHyqvIivi1kbjRSHQoDFcR3hML+k=
|
||||
humungus.tedunangst.com/r/webs v0.6.43/go.mod h1:S9sXpVSbgAIa24yYhnMN0C94LKHG+2rioS+NsiDimps=
|
||||
|
|
Loading…
Reference in New Issue