forked from tangled.org/core
this repo has no description

appview: pages/markup: add support for video

Changed files
+11 -3
appview
pages
markup
camo
+9 -2
appview/pages/markup/markdown.go
···
func visitNode(ctx *RenderContext, node *htmlparse.Node) {
switch node.Type {
case htmlparse.ElementNode:
-
if node.Data == "img" {
for i, attr := range node.Attr {
if attr.Key != "src" {
continue
···
func (rctx *RenderContext) Sanitize(html string) string {
policy := bluemonday.UGCPolicy()
-
policy.AllowAttrs("align", "style").Globally()
policy.AllowStyles(
"margin",
"padding",
···
func visitNode(ctx *RenderContext, node *htmlparse.Node) {
switch node.Type {
case htmlparse.ElementNode:
+
if node.Data == "img" || node.Data == "source" {
for i, attr := range node.Attr {
if attr.Key != "src" {
continue
···
func (rctx *RenderContext) Sanitize(html string) string {
policy := bluemonday.UGCPolicy()
+
+
// video
+
policy.AllowElements("video")
+
policy.AllowAttrs("controls").OnElements("video")
+
policy.AllowElements("source")
+
policy.AllowAttrs("src", "type").OnElements("source")
+
+
policy.AllowAttrs("align", "style", "width", "height").Globally()
policy.AllowStyles(
"margin",
"padding",
+2 -1
camo/src/mimetypes.json
···
"image/x-rgb",
"image/x-xbitmap",
"image/x-xpixmap",
-
"image/x-xwindowdump"
]
···
"image/x-rgb",
"image/x-xbitmap",
"image/x-xpixmap",
+
"image/x-xwindowdump",
+
"video/mp4"
]