Skip to content

Commit

Permalink
Merge pull request #804 from anxdpanic/pr
Browse files Browse the repository at this point in the history
strip api_keys.json values
  • Loading branch information
anxdpanic authored Apr 25, 2020
2 parents 44c71d8 + 33eee10 commit 4dfd499
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions addon.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
[fix] fix Premiere's exiting after 5 seconds |contrib: jpfox156|
[fix] playlists over json-rpc |contrib: JasperE84|
[lang] de_de strings |contrib: tweimer|
[lang] el_gr strings |contrib: twilight0|
[lang] es_es strings |contrib: roliverosc|
[lang] pt_pt strings |contrib: daniel3x|
</news>
Expand Down
1 change: 1 addition & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
[fix] fix Premiere's exiting after 5 seconds |contrib: jpfox156|
[fix] playlists over json-rpc |contrib: JasperE84|
[lang] de_de strings |contrib: tweimer|
[lang] el_gr strings |contrib: twilight0|
[lang] es_es strings |contrib: roliverosc|
[lang] pt_pt strings |contrib: daniel3x|

Expand Down
9 changes: 9 additions & 0 deletions resources/lib/youtube_plugin/youtube/client/__config__.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,15 @@ def _on_init(self):
j_id = self._json_api['keys']['personal'].get('client_id', '')
j_secret = self._json_api['keys']['personal'].get('client_secret', '')

if j_key and j_id and j_secret:
# users are now pasting keys into api_keys.json
# try stripping whitespace and .apps.googleusercontent.com from keys and saving the result if they differ
stripped_key, stripped_id, stripped_secret = self._strip_api_keys(j_key, j_id, j_secret)
if stripped_key and stripped_id and stripped_secret:
if (j_key != stripped_key) or (j_id != stripped_id) or (j_secret != stripped_secret):
self._json_api['keys']['personal'] = {'api_key': stripped_key, 'client_id': stripped_id, 'client_secret': stripped_secret}
self._api_jstore.save(self._json_api)

original_key = self._settings.get_string('youtube.api.key')
original_id = self._settings.get_string('youtube.api.id')
original_secret = self._settings.get_string('youtube.api.secret')
Expand Down

0 comments on commit 4dfd499

Please sign in to comment.