Widgets: Forcibly limit Video widget to only accept oEmbed URLs from YouTube and Vimeo (for now).

Merges [40939] onto 4.8 branch.
Amends [40640].
Props timmydcrawford.
See #34115, #39994.
Fixes #40935 for 4.8.1.

Built from https://develop.svn.wordpress.org/branches/4.8@41056


git-svn-id: http://core.svn.wordpress.org/branches/4.8@40906 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Weston Ruter 2017-07-14 17:41:32 +00:00
parent dbdd48e05e
commit d32185545b
2 changed files with 7 additions and 1 deletions

View File

@ -184,6 +184,12 @@ wp.mediaWidgets = ( function( $ ) {
return;
}
// If video, test for Vimeo and YouTube, otherwise, renderFail(). This should be removed once #34115 is resolved.
if ( 'video' === this.controller.options.mimeType && ! /vimeo|youtu\.?be/.test( urlParser.host ) ) {
embedLinkView.renderFail();
return;
}
embedLinkView.dfd = $.ajax({
url: wp.media.view.settings.oEmbedProxyUrl,
data: {

File diff suppressed because one or more lines are too long