Updated tenor API config keys and added contentfilter support

refs https://github.com/TryGhost/Team/issues/1217

- tenor API config is now an object that lives at `config.tenor`
- updated gifs card gating to use the new config object
- added passthrough of `contentfilter` param from config when making Tenor API requests
This commit is contained in:
Kevin Ansfield 2021-11-16 17:44:31 +00:00
parent 8f6b1aa61a
commit 45fec25930
2 changed files with 8 additions and 3 deletions

View File

@ -26,7 +26,11 @@ export default class TenorService extends Service {
_nextPos = null;
get apiKey() {
return this.config.get('tenorApiKey');
return this.config.get('tenor.apiKey');
}
get contentfilter() {
return this.config.get('tenor.contentFilter') || 'off';
}
get isLoading() {
@ -131,7 +135,8 @@ export default class TenorService extends Service {
const url = new URL(versionedPath, API_URL);
const params = new URLSearchParams(options.params);
params.append('key', this.apiKey);
params.set('key', this.apiKey);
params.set('contentfilter', this.contentfilter);
url.search = params.toString();

View File

@ -224,7 +224,7 @@ export const CARD_MENU = [
payload: {
imageSelector: 'tenor'
},
isAvailable: ['feature.gifsCard', 'config.tenorApiKey']
isAvailable: ['feature.gifsCard', 'config.tenor.apiKey']
},
{
label: 'Vimeo',