Widgets: Utilize WP REST API oEmbed proxy endpoint in media widgets.

Props timmydcrawford.
See #32417, #40450.


git-svn-id: https://develop.svn.wordpress.org/trunk@40641 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Weston Ruter 2017-05-11 21:23:50 +00:00
parent da32c2f630
commit 42487a5b23
2 changed files with 12 additions and 8 deletions

View File

@ -111,15 +111,17 @@
}
control.fetchEmbedDfd = jQuery.ajax({
url: 'https://noembed.com/embed',
url: wp.media.view.settings.oEmbedProxyUrl,
data: {
url: control.model.get( 'url' ),
maxwidth: control.model.get( 'width' ),
maxheight: control.model.get( 'height' )
maxheight: control.model.get( 'height' ),
_wpnonce: wp.media.view.settings.nonce.wpRestApi,
discover: false
},
type: 'GET',
crossDomain: true,
dataType: 'json'
dataType: 'json',
context: control
});
control.fetchEmbedDfd.done( function( response ) {

View File

@ -182,15 +182,17 @@ wp.mediaWidgets = ( function( $ ) {
}
embedLinkView.dfd = $.ajax({
url: 'https://noembed.com/embed', // @todo Replace with core proxy endpoint once committed.
url: wp.media.view.settings.oEmbedProxyUrl,
data: {
url: embedLinkView.model.get( 'url' ),
maxwidth: embedLinkView.model.get( 'width' ),
maxheight: embedLinkView.model.get( 'height' )
maxheight: embedLinkView.model.get( 'height' ),
_wpnonce: wp.media.view.settings.nonce.wpRestApi,
discover: false
},
type: 'GET',
crossDomain: true,
dataType: 'json'
dataType: 'json',
context: embedLinkView
});
embedLinkView.dfd.done( function( response ) {