spicywebau / craft-embedded-assets

Manage YouTube videos, Instagram photos, Twitter posts and more as first class assets in Craft CMS
MIT License
171 stars 34 forks source link

Wistia embed support? #237

Closed litzinger closed 11 months ago

litzinger commented 11 months ago

What would you like to see added to or changed in Embedded Assets, and why?

Hello, I'm using your plugin for the first time and wondering if you have plans to add support for Wistia embeds?

ttempleton commented 11 months ago

I'll look at adding proper support with getIframeCode(), getVideoId() embedded asset methods for Wistia when I get a chance - but for now, you can allow Wistia embeds by setting the following in your project's config/embeddedassets.php file:

<?php

return [
    'extraWhitelist' => [
        'wistia.com',
        'wistia.net',
    ],
];
litzinger commented 11 months ago

Thanks for sharing that. Are you suggesting that adding the config should bring a basic level of support for Wistia without any additional code changes or you have to add additional changes to fully support it? Currently with that config added I still get the following error:

Screenshot 2023-07-17 at 8 04 06 AM
ttempleton commented 11 months ago

Yes, that should give you basic Wistia support - and it's working for me: Screenshot 2023-07-19 at 18-00-28 Homepage - Craft 4

Do the Craft logs show any related error information? Does it still occur in another environment or a different Craft project running on a different server?

litzinger commented 11 months ago

I don't see anything in the logs. When I open the URL of the ajax request it's making I do see the following render in a new browser tab:

Screenshot 2023-07-19 at 8 03 41 AM

I stood up a test Craft 4 environment and this is what I'm seeing, which is progress, but it still doesn't load the preview like in your screenshot.

Screenshot 2023-07-19 at 8 32 09 AM

And then when I hit Save it adds this to the test field:

Screenshot 2023-07-19 at 8 32 51 AM
litzinger commented 11 months ago

I just saw this in my console :/

Refused to load https://site.com/index.php?p=admin%2Factions%2Fembeddedassets%2Factions%2Fpreview&site=US_en&showContent=1&callback=embeddedassetsgeq56bb913h6&url=https%3A%2F%2Ffast.wistia.net%2Fembed%2Fiframe%2Fe4a27b9710 because it does not appear in the frame-ancestors directive of the Content Security Policy.

litzinger commented 11 months ago

I figured it out, it is a local environment issue with the CSP.

ttempleton commented 11 months ago

Just released 3.1.6, which adds wistia.com and wistia.net to the default plugin whitelist, and adds support for Wistia to embedded assets' getVideoId(), getIframeSrc(), and getIframeCode() methods.