Add option to use your own Youtube API key. #2327
This commit is contained in:
parent
7760b6d5a6
commit
c7ce6187f2
@ -59,6 +59,12 @@
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
<fieldset>
|
||||
<legend>Youtube API Key</legend>
|
||||
<div>API key used to fetch Youtube link titles. You can obtain your own key <a href="https://console.cloud.google.com/marketplace/details/google/youtube.googleapis.com" target="_blank">here</a> to make the feature work when the default key exceeds its quota.</div>
|
||||
<div><input name="youtubeAPIKey" class="field" spellcheck="false"></div>
|
||||
</fieldset>
|
||||
|
||||
<fieldset>
|
||||
<legend>Custom Board Navigation</legend>
|
||||
<div><textarea hidden name="boardnav" class="field" spellcheck="false"></textarea></div>
|
||||
|
||||
@ -542,7 +542,7 @@ Embedding =
|
||||
ignore403: true
|
||||
api: (uids) ->
|
||||
ids = encodeURIComponent uids.join(',')
|
||||
key = '<%= meta.youtubeAPIKey %>'
|
||||
key = Conf['youtubeAPIKey']
|
||||
"https://www.googleapis.com/youtube/v3/videos?part=snippet&id=#{ids}&fields=items%28id%2Csnippet%28title%29%29&key=#{key}"
|
||||
text: (data, uid) ->
|
||||
for item in data.items when item.id is uid
|
||||
|
||||
@ -1185,3 +1185,5 @@ Config =
|
||||
passMessageClosed: false
|
||||
|
||||
'Prerequest Captcha': false
|
||||
|
||||
youtubeAPIKey: '<%= meta.youtubeAPIKey %>'
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user