forked from tangled.org/core
Monorepo for Tangled

appview: pages/markup: add support for video

authored by anirudh.fi and committed by Tangled c458235d 2268ed60

Changed files
+11 -3
appview
pages
markup
camo
+9 -2
appview/pages/markup/markdown.go
··· 122 122 func visitNode(ctx *RenderContext, node *htmlparse.Node) { 123 123 switch node.Type { 124 124 case htmlparse.ElementNode: 125 - if node.Data == "img" { 125 + if node.Data == "img" || node.Data == "source" { 126 126 for i, attr := range node.Attr { 127 127 if attr.Key != "src" { 128 128 continue ··· 142 142 143 143 func (rctx *RenderContext) Sanitize(html string) string { 144 144 policy := bluemonday.UGCPolicy() 145 - policy.AllowAttrs("align", "style").Globally() 145 + 146 + // video 147 + policy.AllowElements("video") 148 + policy.AllowAttrs("controls").OnElements("video") 149 + policy.AllowElements("source") 150 + policy.AllowAttrs("src", "type").OnElements("source") 151 + 152 + policy.AllowAttrs("align", "style", "width", "height").Globally() 146 153 policy.AllowStyles( 147 154 "margin", 148 155 "padding",
+2 -1
camo/src/mimetypes.json
··· 41 41 "image/x-rgb", 42 42 "image/x-xbitmap", 43 43 "image/x-xpixmap", 44 - "image/x-xwindowdump" 44 + "image/x-xwindowdump", 45 + "video/mp4" 45 46 ]