s9e Media Sites

s9e Media Sites 2.16.7

No permission to download
yeah. the only issue i see with this optional setting is that if you migrate to some other forum software in future, getting the embeds to work would require too much work. regular embed codes might work out of the box for some of the services.
 
At least this way the original URL is preserved so rendering a url after the embed is easy while keeping it as just the single bb-code
I should mention that currently, even if you've enabled the XenForo option to add a link after regular embeds, that link won't be added added after the custom [URL] tag. This is not because of some technical reason, I just didn't want to end up with duplicate links everywhere. It could be changed back and/or be made an option but I'm not sure it's worth adding yet another option to the admin panel. If anyone's interested, the extra markup can be re-enabled (at posting time only) with this change:
Diff:
diff --git a/addon/Parser.php b/addon/Parser.php
index d9c6fcd..270dae0 100644
--- a/addon/Parser.php
+++ b/addon/Parser.php
@@ -311,7 +311,7 @@ class Parser
 
    public static function convertMediaTag(string $url, string $markup, ?Unfurl $unfurl): string
    {
-       if (preg_match('(^\\[MEDIA=(\\w++)\\]([^"\\[]++)\\[/MEDIA\\])i', $markup, $m))
+       if (preg_match('(^\\[MEDIA=(\\w++)\\]([^"\\[]++)\\[/MEDIA\\](.*))is', $markup, $m))
        {
            $attr = '';
            if (isset($unfurl))
@@ -320,7 +320,7 @@ class Parser
                $unfurl->logPendingUnfurl($url);
            }
 
-           $markup = '[URL' . $attr . ' media="' . $m[1] . ':' . $m[2] . '"]' . $url . '[/URL]';
+           $markup = '[URL' . $attr . ' media="' . $m[1] . ':' . $m[2] . '"]' . $url . '[/URL]' . $m[3];
        }
 
        return $markup;

yeah. the only issue i see with this optional setting is that if you migrate to some other forum software in future, getting the embeds to work would require too much work. regular embed codes might work out of the box for some of the services.
Yeah, convertors would need to be aware of it, although I guess that applies to anything from this add-on. The [URL] tags can be converted back to [MEDIA] with a fairly simple regexp though, so hopefully it won't be an issue for those who want to move away from XenForo. [Edit: while we're on the subject, if someone wants to convert from or to XenForo and has questions related to this add-on, you can just send me a direct message and I'll give you a hand if possible.]

@JoshyPHP I've had reports that the youtube embeds have started autoplaying on scrolling past them despite the disable autoplay option being set.
That should be a coincidence because I can't imagine how one could cause the other but if you can send me a link to a page where that happens I will look into it.
 
welcome

Can this site be added to the plugin?
So that the videos appear without the need to include the code
 
@JoshyPHP bug with the s9e_MediaSites_Markup option and unfurl which fails;

Code:
TypeError: s9e\MediaSites\Parser::convertMediaTag(): Argument #2 ($markup) must be of type string, null given, called in /var/www/html/src/addons/s9e/MediaSites/XF/BbCode/ProcessorAction/AutoLink.php on line 33 src/addons/s9e/MediaSites/Parser.php:318

#0 src/addons/s9e/MediaSites/XF/BbCode/ProcessorAction/AutoLink.php(33): s9e\MediaSites\Parser::convertMediaTag('http://forum.sp...', NULL, Object(SV\AdvancedBbCodesPack\XF\Repository\Unfurl))
#1 src/XF/BbCode/ProcessorAction/AutoLink.php(116): s9e\MediaSites\XF\BbCode\ProcessorAction\AutoLink->autoLinkUrl('http://forum.sp...')
#2 src/XF/BbCode/Processor.php(273): XF\BbCode\ProcessorAction\AutoLink->filterUrlTag(Array, Array, Object(XF\BbCode\Processor))
#3 src/XF/BbCode/Processor.php(307): XF\BbCode\Processor->XF\BbCode\{closure}(Array)
#4 src/XF/BbCode/Processor.php(264): XF\BbCode\Processor->filterTag(Array, Array)
#5 src/XF/BbCode/Traverser.php(63): XF\BbCode\Processor->renderTag(Array, Array)
#6 src/XF/BbCode/Processor.php(336): XF\BbCode\Traverser->renderSubTree(Array, Array)
#7 src/XF/BbCode/Processor.php(315): XF\BbCode\Processor->renderValidTag(Array, Array)
#8 src/XF/BbCode/Processor.php(264): XF\BbCode\Processor->filterTag(Array, Array)
#9 src/XF/BbCode/Traverser.php(63): XF\BbCode\Processor->renderTag(Array, Array)
...

PHP:
        public function autoLinkUrl($url)
        {
                $markup = parent::autoLinkUrl($url);
                if ($this->app->options()->s9e_MediaSites_Markup === 'url')
                {
                        $unfurl = (!empty($this->urlToRichPreview)) ? $this->app->repository('XF:Unfurl') : null;
                        $markup = Parser::convertMediaTag($url, $markup, $unfurl);
                }

                return $markup;
        }
autoLinkUrl can return null but Parser::convertMediaTag requires both $url and $markup to be non-null

I think a simple $markup !== null && $url !== null && added to the if statement would be enough.
 
Out of an abundance of caution I'd like to reproduce locally and make sure it's fixed for real, do you have the URL that triggered that error?
The error was from editing an old long post with a large number of links, finding which URL failed with be a pain.
 
As far as I can tell, it's specific to this video because Instagram's API thinks the post should be 1024px tall for some reason. I tried other URLs and they were dimensioned correctly.
Code:
https://instagram.com/p/gbGaIXBQbn/
https://www.instagram.com/tv/BkQjCfsBIzi/
 
Back
Top Bottom