move sanitizeXSS() to markdown.go

This commit is contained in:
fiatjaf
2025-01-14 00:30:56 -03:00
committed by dtonon
parent 644bc48947
commit ca21f46a20
2 changed files with 10 additions and 11 deletions

View File

@@ -14,7 +14,6 @@ import (
"sync"
"time"
"github.com/microcosm-cc/bluemonday"
"github.com/puzpuzpuz/xsync/v3"
"mvdan.cc/xurls/v2"
@@ -339,16 +338,6 @@ func linkQuotes(input string) string {
})
}
func sanitizeXSS(html string) string {
p := bluemonday.UGCPolicy()
p.AllowStyling()
p.RequireNoFollowOnLinks(false)
p.AllowElements("video", "source")
p.AllowAttrs("controls", "width").OnElements("video")
p.AllowAttrs("src", "width").OnElements("source")
return p.Sanitize(html)
}
func basicFormatting(input string, skipNostrEventLinks bool, usingTelegramInstantView bool, skipLinks bool) string {
nostrMatcher := nostrEveryMatcher
if skipNostrEventLinks {