Removed google api key from github

Prod-349
This commit is contained in:
adeelehsan
2019-07-10 20:23:27 +05:00
parent 04c8290197
commit 3136b3ecd3
7 changed files with 82 additions and 36 deletions

View File

@@ -726,23 +726,17 @@ function(VideoPlayer, i18n, moment, _) {
if (!(_.isString(url))) {
url = this.videos['1.0'] || '';
}
// Will hit the API URL iF YT key is defined in settings.
if (this.config.ytKey) {
return $.ajax({
url: [this.config.ytMetadataUrl, '?id=', url, '&part=contentDetails&key=', this.config.ytKey].join(''),
timeout: this.config.ytTestTimeout,
success: _.isFunction(callback) ? callback : null,
error: function() {
console.warn(
'YouTube API request failed - usually this means the YouTube API key is invalid. ' +
'Some video metadata may be unavailable.'
);
},
notifyOnError: false
});
} else {
return $.Deferred().reject().promise();
}
// Will hit the API URL to get the youtube video metadata.
return $.ajax({
url: [this.config.lmsRootURL, '/courses/yt_video_metadata', '?id=', url].join(''),
success: _.isFunction(callback) ? callback : null,
error: function() {
console.warn(
'Unable to get youtube video metadata. Some video metadata may be unavailable.'
);
},
notifyOnError: false
});
}
function youtubeId(speed) {

View File

@@ -344,12 +344,6 @@ class VideoBlock(
settings_service = self.runtime.service(self, 'settings')
yt_api_key = None
if settings_service:
xblock_settings = settings_service.get_settings_bucket(self)
if xblock_settings and 'YOUTUBE_API_KEY' in xblock_settings:
yt_api_key = xblock_settings['YOUTUBE_API_KEY']
poster = None
if edxval_api and self.edx_video_id:
poster = edxval_api.get_course_video_image_url(
@@ -401,8 +395,7 @@ class VideoBlock(
'transcriptLanguages': sorted_languages,
'ytTestTimeout': settings.YOUTUBE['TEST_TIMEOUT'],
'ytApiUrl': settings.YOUTUBE['API'],
'ytMetadataUrl': settings.YOUTUBE['METADATA_URL'],
'ytKey': yt_api_key,
'lmsRootURL': settings.LMS_ROOT_URL,
'transcriptTranslationUrl': self.runtime.handler_url(
self, 'transcript', 'translation/__lang__'