KB : video embed support via slash command#24268
Conversation
AdrienClairembault
left a comment
There was a problem hiding this comment.
Seems to work fine, I didn't check the code in details as there is almost 2k lines.
|
Asked for review @cedric-anne today |
cedric-anne
left a comment
There was a problem hiding this comment.
This represent a huge amount of code to just support youtube/vimeo/dailymotion providers.
I cannot tell how many people will want to use this feature, and I cannot tell either how many people will want to add their own self-hosted videos using just a https://example.org/myvideo.mp4 URL, but, IMHO, handling only video files URLs and render them in a <video> tag would probably cover more use cases.
Ping @orthagh
| '<div class="video-embed-wrapper">' | ||
| . '<iframe src="%s" title="%s" loading="lazy" allowfullscreen' | ||
| . ' referrerpolicy="strict-origin-when-cross-origin"' | ||
| . ' sandbox="allow-scripts allow-same-origin allow-presentation allow-popups"' |
There was a problem hiding this comment.
Is allow-same-origin necessary? As far as I understand, it will allow the iframe to access the GLPI page DOM.
Is allow-popups necessary?
| . ' sandbox="allow-scripts allow-same-origin allow-presentation allow-popups"' | |
| . ' sandbox="allow-scripts allow-presentation"' |
There was a problem hiding this comment.
Is allow-same-origin necessary?
Yes : I tested removing it and the players won't load: without it the iframe gets an opaque origin and can't read its own cookies/localStorage.
As far as I understand, it will allow the iframe to access the GLPI page DOM.
It won't : cross-origin DOM access is blocked by the Same-Origin Policy regardless of the sandbox. The allow-scripts + allow-same-origin escape only applies when the frame is same-origin with the page, and src is always a hard-coded provider host (youtube-nocookie.com / player.vimeo.com / dailymotion.com).
Is allow-popups necessary?
No, removed it (only used by the players' "watch on …" buttons). Also dropped referrerpolicy (already the browser default). Final set: allow-scripts allow-same-origin allow-presentation.
|
@cedric-anne i processed your concerns (partially for Waiting for @orthagh decision : drop external provider, add |
Description
YT/ Vimeo / Dailymotion only. Slash Command integration only.
Possible followup :
Give and admin the possibility to add custom providers.
Screenshot :