]> git.mxchange.org Git - friendica.git/commitdiff
Allow support for allowlisted iframe sources in Content\text\BBCode::convert
authorHypolite Petovan <hypolite@mrpetovan.com>
Fri, 18 Dec 2020 06:17:49 +0000 (01:17 -0500)
committerHypolite Petovan <hypolite@mrpetovan.com>
Fri, 18 Dec 2020 15:32:36 +0000 (10:32 -0500)
- Support Youtube, Vimeo and unused local embeds

src/Content/Text/BBCode.php

index e41511f5a37f7be446e0bba1f14b7a84c9c367c7..2563194f2ce3dc91e485c025d3c4b742244020fe 100644 (file)
@@ -1876,6 +1876,14 @@ class BBCode
 
                $config = \HTMLPurifier_HTML5Config::createDefault();
                $config->set('HTML.Doctype', 'HTML5');
+               $config->set('HTML.SafeIframe', true);
+               $config->set('URI.SafeIframeRegexp', '%^(?:
+                       https://www.youtube.com/embed/
+                       |
+                       https://player.vimeo.com/video/
+                       |
+                       ' . DI::baseUrl() . '/oembed/ # Has to change with the source in Content\Oembed::iframe
+               )%xi');
                $config->set('Attr.AllowedRel', [
                        'noreferrer' => true,
                        'noopener' => true,