Embed code autoreplacement - SOLVED

 

When posted in Discussions&Blog embed code from, let's say this one  from Soundcloud,

iframe width="100%" height="166" scrolling="no" frameborder="no" src="https://w.soundcloud.com/player/?url=https%3A//api.soundcloud.com/tracks/34019569&color=%23ff5500&auto_play=false&hide_related=false&show_comments=true&show_user=true&show_reposts=false">

 through TinyMCE "Tools/Source Code" only Admin can do it with success. 

Standard user can write post, can see the embed content right during the post composing, but after Sending the Embed Content replaced by dumb Youtube embed code, leading to nowhere. Like this one.

 

 

  • 2011
  • More
Replies (32)
    • Youtube embed videos are supported - just checked, but any other embeds like Soundcloud will not work, special filter is needed to make it work.

      • Actually, I made a plugin in Dolphin that uses a whitelist where you can easily plug in extra sources with just a few edits following the examples. 

        • is it good for una?

          • I don't know, the principal should work if UNA is using htmlpurifier.  How important is it for you?  You can hire me if you don't know how to do it yourself.

            • Thanx:) I'll try by myself first:))

                • The problem strikes again.

                  1. before 9.6 upgrade edited utils.inc.php was replaced by original one

                  2. after 9.6 upgrade the updated  file (i can see it in size)  utils.inc.php was edited as described in GG explanation here (which was very OK and works well in 9.4 )

                  3. site crashes. but after putting back the original, upgraded 9.6 utils.inc.php - works well. site crashes also after trying to put in the 9.4 edited utils.inc.php.

                  Conclusion: this was good for 9.4 and kinda not for 9.6. Why? And how to add embed-smthng beyond Youtube now?

                    • I've just tested embed in previous post and it works for youtube videos, however there is no control to insert embed, so I have to use browser inspector to do this, also standard members can't post links.

                      In the future we'll make more buttons into toolbar for comments in forum, so it will be possible to do it via toolbar.

                      • Thanx for the answer. I'm talking about htmlpurifier filter, as described abowe.

                        • I have similar problem to vavilon with error in the htmlpurifier.

                          When user other than admin posts a link to youtube video with the insert video button in TinyMCE or iframe code with the source code editor in TinyMCE in article and click post, he will get an error from the htmlpurifier. Then if he reloads the website the article is there with a frame for the video, but the video doesn't work.

                          Is there a setting to allow users to post video embeds and iframes that I need to enable, or I need to change something in the purifier file?

                          Thanks for the help

                          • @George Sp, it was discussed here during Sep, 2017. There was the solution - custom htmlpurifyer filter, as described here.

                            The actual problem is : after 9.6-upgrade that stops work.

                            • Thank you vavilon, I already read that, but thought as it was for custom filters maybe it didn't pertain. Right now subscribed users have the embed Youtube button in Tinymce, but doesnt work, so I thought it might be some permissions I needed to setup in UNA. Can you tell me if this is the case, or I need to apply the htmlpurifier change for Youtube videos as well?

                              • Thank you for the report, it has been fixed:

                                https://github.com/unaio/una/issues/1158

                                • Hi Alex, not sure if that was for me; should I wait for the .7 update or have to follow the custom htmlpurifyer modifications, or there are settings for that in Una?

                                  Thanks

                                  • I got it, thank you Alex, I saw the changes to the htmlpurifier on  github and made the change in my file. Now it works.

                                    • AlexT, it's very nice that we can solve by the way YouTube embedding, and I'm glad for George success  from the bottom of my heart,

                                      but

                                      let me be the nerd: my problem is

                                      1. before 9.6 upgrade edited utils.inc.php was replaced by original one

                                      2. after 9.6 upgrade the updated  file (i can see it in size)  utils.inc.php was edited as described in GG explanation here (which was very OK and works well in 9.4 )

                                      3. site crashes. but after putting back the original, upgraded 9.6 utils.inc.php - works well. site crashes also after trying to put in the 9.4_edited_utils.inc.php.

                                      Conclusion: this was good for 9.4 and kinda not for 9.6. Why? And how to add embed-smthng beyond Youtube now?

                                       

                                        • There were no changes which affect this in inc/utils.inc.php file, it was broken because of different behaviour in TinyMCE.

                                          • Which means - what I need to do now?

                                            • Wait for the next version update, or apply fix from this ticket:
                                              https://github.com/unaio/una/issues/1158

                                              • Hi Alex

                                                Sorry, but your suggestion doesn't work for me:((

                                                1. Update fix from https://github.com/unaio/una/issues/1158 applayed

                                                2. File MyIframe from GG explanation here was added

                                                3. In working inc/utils.inc.php file  at 525 line added a fix (here in BOLD)

                                                $oConfig->set('Filter.Custom', array (new HTMLPurifier_Filter_MyIframe(), new HTMLPurifier_Filter_LocalMovie(), (new HTMLPurifier_Filter_YouTube(), new HTMLPurifier_Filter_YoutubeIframe(), new HTMLPurifier_Filter_AddBxLinksClass()));

                                                4. New inc/utils.inc.php file crashes the site. when I put the old inc/utils.inc.php - all working fine. Which means, imho, that inc/utils.inc.php can't stand this change. 

                                                5. It do works before 9.6 update, so somewhere is some change, there is no other explanation. The point is - what change and how to get custom filter work again?

                                                Thanx in advance

                                                • Magic:

                                                  aftre deleting LocalMovie filter from 525 line on utils.inc.php file

                                                  $oConfig->set('Filter.Custom', array (new HTMLPurifier_Filter_MyIframe(), new HTMLPurifier_Filter_LocalMovie(), (new HTMLPurifier_Filter_YouTube(), new HTMLPurifier_Filter_YoutubeIframe(), new HTMLPurifier_Filter_AddBxLinksClass()));

                                                  suddenly it starts work

                                                  All services in MyIframe are working good now...  what was that??? and how HTMLPurifier_Filter_LocalMovie() deletion can affect the site?

                                                  • To embed youTube video - can this be done using main the "Add Video" link? To avoid confusion could there be a youTube link icon??? (in TinyMCE or whatever it is now called).

                                                    The most natural and intuitive thing a user would want would be to add a youTube video under the heading of ADD VIDEO. This is because local video processing is a total nightmare unless you have a dedicated server or a RARE hosting service which can help.

                                                    And by the way, unless you have useable and intuitive video upload capability on a social site - YOU HAVE PRECIOUS LITTLE. Videos in the discussions, comments, or timeline is all but useless because they will be spooled off and/or forgotten about as time goes by.

                                                    Why not have all videos in the Video section for starters?

                                                    Thank you!

                                                    • In the upcoming update we've integrated Froala editor (instead of TinyMCE) which has Embedly integration which simplify inserting embeds.

                                                      •  which has Embedly integration... toll free ?

                                                         

                                                        • This is a replacement or you leave the choice between the two editor?

                                                          • I bet on replacement :)

                                                            • Yes, as I understand it, but then I bet on the free :-)

                                                              • Embedly is free, but it displays link back to their website, paid embedly subscription doesn't have such link.

                                                                • OK, so - I go back to the HTMLPurifyer :)))

                                                                  • Interesting. Is Embedly a part of the updated Video module, too? I'm afraid to upgrade so soon. Does Embedlycreate all the necessary video formats when a video is uploaded? Does it support remote storage? Does it act also as remote video processing?

                                                                    Login or Join to comment.