summaryrefslogtreecommitdiffstats
path: root/web
diff options
context:
space:
mode:
authornickago <ngonella@calpoly.edu>2015-07-14 11:55:49 -0700
committernickago <ngonella@calpoly.edu>2015-07-14 11:55:49 -0700
commit9f816e25545b7487d3078813ffd0e120a3a100cd (patch)
treef96246b509fb9189405cda0b9b5727b31bd078b0 /web
parentb31327f072aa575d5ff97cc5e0786e50510ab456 (diff)
downloadchat-9f816e25545b7487d3078813ffd0e120a3a100cd.tar.gz
chat-9f816e25545b7487d3078813ffd0e120a3a100cd.tar.bz2
chat-9f816e25545b7487d3078813ffd0e120a3a100cd.zip
Need you GDev key for youtube stuff
Diffstat (limited to 'web')
-rw-r--r--web/react/utils/utils.jsx23
-rw-r--r--web/static/config/config.js4
2 files changed, 19 insertions, 8 deletions
diff --git a/web/react/utils/utils.jsx b/web/react/utils/utils.jsx
index 5ded0e76f..f3fe3a992 100644
--- a/web/react/utils/utils.jsx
+++ b/web/react/utils/utils.jsx
@@ -303,18 +303,25 @@ var getYoutubeEmbed = function(link) {
};
var success = function(data) {
- $('.video-uploader.'+youtubeId).html(data.data.uploader);
- $('.video-title.'+youtubeId).find('a').html(data.data.title);
+ if(!data.items.length || !data.items[0].snippet) {
+ return;
+ }
+ metadata = data.items[0].snippet;
+ $('.video-uploader.'+youtubeId).html(metadata.channelTitle);
+ $('.video-title.'+youtubeId).find('a').html(metadata.title);
$(".post-list-holder-by-time").scrollTop($(".post-list-holder-by-time")[0].scrollHeight);
$(".post-list-holder-by-time").perfectScrollbar('update');
};
- $.ajax({
- async: true,
- url: 'https://gdata.youtube.com/feeds/api/videos/'+youtubeId+'?v=2&alt=jsonc',
- type: 'GET',
- success: success
- });
+ if(config.GoogleDeveloperKey) {
+ $.ajax({
+ async: true,
+ url: "https://www.googleapis.com/youtube/v3/videos",
+ type: 'GET',
+ data: {part:"snippet", id:youtubeId, key:config.GoogleDeveloperKey},
+ success: success
+ });
+ }
return (
<div className="post-comment">
diff --git a/web/static/config/config.js b/web/static/config/config.js
index 45c713da2..0d564b77e 100644
--- a/web/static/config/config.js
+++ b/web/static/config/config.js
@@ -16,6 +16,10 @@ var config = {
RequireInviteNames: false,
AllowSignupDomainsWizard: false,
+ // Google Developer Key (for Youtube API links)
+ // Leave blank to disable
+ GoogleDeveloperKey: "",
+
// Privacy switches
ShowEmail: true,