Allowing peertube video oneboxes via the allowed iframes setting

AI-generated summary

Allowing PeerTube Video Oneboxes via Allowed Iframes Setting

The discussion revolves around enabling PeerTube video oneboxes on a Discourse instance. hellekin initially encounters an error when adding a PeerTube instance to allowed_onebox_iframes. david explains that only pre-defined domains can be used in allowed_onebox_iframes, and for other domains, allowed_iframes should be used.

hellekin shares their issue with a PeerTube video not oneboxing despite having the correct allowed_iframes entry. david suggests adding the PeerTube instance to the allowed_iframes setting, which resolves the issue in his test site.

The solution lies in adding the correct value to allowed_iframes. hellekin initially adds https://peertube.public.cat/videos/watch/, but david advises removing the /watch part, as the iframe URLs use the /embed case. Adding https://peertube.public.cat/videos to allowed_iframes solves the issue, as confirmed by hellekin.

Continuing the discussion from Peertube embedding?:

Trying to add a PeerTube instance to the allowed_onebox_iframes I get the following error: invalid choice. Hmm, what? How to solve this?

Tip / Caveat for embedding Peertube videos

Use https://peertube.instance.example/videos in the allowed_iframes site setting to support both cases of /videos/watch/<uuid> and /videos/embed/<uuid>, the latter being used by the peertube onebox when you paste the former!

In the “allowed onebox iframes” list, you can only pick from pre-defined domains which are provided by the onebox gem.

If you want to allow iframes from other domains, use the “allowed iframes” setting

Ack, thank you.

I was trying to onebox a video from Peertube. It used to work just by pasting the link, and I do have the correct allowed_iframes entry. I’m a bit lost with recent changes with CSP that seem to break on new instances but not old ones.

Like, this link https://peertube.public.cat/videos/watch/392c393e-1fde-4356-bb25-8a92e7ce2057 used to show a video…

https://peertube.public.cat/videos/watch/392c393e-1fde-4356-bb25-8a92e7ce2057

It works on my test site once I add it to the allowed iframes setting:

What value are you adding to allowed_iframes?

https://peertube.public.cat/videos/watch/

Ah, remove the /watch from the end and it should work. The iframe URLs look like

https://peertube.public.cat/videos/embed/392c393e-1fde-4356-bb25-8a92e7ce2057

I added this value to my settings:

https://peertube.public.cat/videos

You rock! I did not think about the embed case.