Skip to content

Commit 033a30a

Browse files
committed
MC-40510: [2.3] Vimeo simple API stop working as expected
1 parent fd2eb48 commit 033a30a

File tree

3 files changed

+20
-10
lines changed

3 files changed

+20
-10
lines changed

app/code/Magento/ProductVideo/etc/csp_whitelist.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,18 @@
1414
<value id="google_video" type="host">www.googleapis.com</value>
1515
<value id="vimeo" type="host">vimeo.com</value>
1616
<value id="www_vimeo" type="host">www.vimeo.com</value>
17+
<value id="vimeo_cdn" type="host">*.vimeocdn.com</value>
1718
</values>
1819
</policy>
1920
<policy id="img-src">
2021
<values>
2122
<value id="vimeo_cdn" type="host">*.vimeocdn.com</value>
2223
</values>
2324
</policy>
25+
<policy id="frame-src">
26+
<values>
27+
<value id="player_vimeo" type="host">player.vimeo.com</value>
28+
</values>
29+
</policy>
2430
</policies>
2531
</csp_whitelist>

app/code/Magento/ProductVideo/view/adminhtml/web/js/get-video-information.js

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -492,20 +492,20 @@ define([
492492
var tmp,
493493
respData;
494494

495-
if (data.length < 1) {
495+
if (!data) {
496496
this._onRequestError($.mage.__('Video not found'));
497497

498498
return null;
499499
}
500-
tmp = data[0];
500+
tmp = data;
501501
respData = {
502502
duration: this._formatVimeoDuration(tmp.duration),
503-
channel: tmp['user_name'],
504-
channelId: tmp['user_url'],
503+
channel: tmp['author_name'],
504+
channelId: tmp['author_url'],
505505
uploaded: tmp['upload_date'],
506506
title: tmp.title,
507507
description: tmp.description.replace(/(&nbsp;|<([^>]+)>)/ig, ''),
508-
thumbnail: tmp['thumbnail_large'],
508+
thumbnail: tmp['thumbnail_url'],
509509
videoId: videoInfo.id,
510510
videoProvider: videoInfo.type
511511
};
@@ -534,10 +534,11 @@ define([
534534
);
535535
} else if (type === 'vimeo') {
536536
$.ajax({
537-
url: 'https://www.vimeo.com/api/v2/video/' + id + '.json',
537+
url: 'https://vimeo.com/api/oembed.json',
538538
dataType: 'jsonp',
539539
data: {
540-
format: 'json'
540+
format: 'json',
541+
url: 'https://vimeo.com/' + id
541542
},
542543
timeout: 5000,
543544
success: $.proxy(_onVimeoLoaded, self),

lib/web/fotorama/fotorama.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -858,13 +858,16 @@ fotoramaVersion = '4.6.4';
858858
dataFrame.thumbsReady = true;
859859
} else if (video.type === 'vimeo') {
860860
$.ajax({
861-
url: getProtocol() + 'vimeo.com/api/v2/video/' + video.id + '.json',
861+
url: getProtocol() + 'vimeo.com/api/oembed.json',
862+
data: {
863+
url: 'https://vimeo.com/' + video.id
864+
},
862865
dataType: 'jsonp',
863866
success: function (json) {
864867
dataFrame.thumbsReady = true;
865868
updateData(data, {
866-
img: json[0].thumbnail_large,
867-
thumb: json[0].thumbnail_small
869+
img: json[0].thumbnail_url,
870+
thumb: json[0].thumbnail_url
868871
}, dataFrame.i, fotorama);
869872
}
870873
});

0 commit comments

Comments
 (0)