From 182a7ea07cb975811e1008bf9fd57cc38a1fa76c Mon Sep 17 00:00:00 2001 From: arsereg Date: Fri, 5 Aug 2022 07:13:27 -0400 Subject: [PATCH] =?UTF-8?q?=F0=9F=92=A1=20Upgraded=20Tenor=20API=20to=20v2?= =?UTF-8?q?=20(#15087)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit closes: https://github.com/TryGhost/Ghost/issues/14980 refs: https://github.com/TryGhost/Ghost/commit/cc276486f0360eb3017e1d55f0d3dd9b2d3a2228 - Tenor is now operated by Google, and the old v1 Tenor API has been decommissioned - At present anyone with a pre-configured tenor integration will get intermittent errors, whilst it is impossible to setup a new tenor API integration - Sadly old keys do not work with the new API, and new keys do not work with the old API, so there is no happy path forward. - After this lands, everyone will need to go and get a new Google API Key for Tenor, update their config, and then the integration will work properly again. - This particular change renames the API key from `publicReadOnlyApiKey` to `googleApiKey` to reflect that the key itself changes in type and behaviour Co-authored-by: Hannah Wolfe --- ghost/admin/app/services/tenor.js | 3 +-- ghost/admin/lib/koenig-editor/addon/options/cards.js | 2 +- ghost/core/core/shared/config/defaults.json | 2 +- ghost/core/test/e2e-api/admin/config.test.js | 4 ++-- 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/ghost/admin/app/services/tenor.js b/ghost/admin/app/services/tenor.js index c7bb25325f..186d0e7b6b 100644 --- a/ghost/admin/app/services/tenor.js +++ b/ghost/admin/app/services/tenor.js @@ -25,8 +25,7 @@ export default class TenorService extends Service { _nextPos = null; get apiKey() { - // @TODO confirm this! - return this.config.get('tenor.apiKey'); + return this.config.get('tenor.googleApiKey'); } get contentfilter() { diff --git a/ghost/admin/lib/koenig-editor/addon/options/cards.js b/ghost/admin/lib/koenig-editor/addon/options/cards.js index 63c99a4db1..c42c927ab2 100644 --- a/ghost/admin/lib/koenig-editor/addon/options/cards.js +++ b/ghost/admin/lib/koenig-editor/addon/options/cards.js @@ -195,7 +195,7 @@ export const CARD_MENU = [ payload: { imageSelector: 'tenor' }, - isAvailable: 'config.tenor.publicReadOnlyApiKey' + isAvailable: 'config.tenor.googleApiKey' }, { label: 'Toggle', diff --git a/ghost/core/core/shared/config/defaults.json b/ghost/core/core/shared/config/defaults.json index c0ddeedbc1..492fa74618 100644 --- a/ghost/core/core/shared/config/defaults.json +++ b/ghost/core/core/shared/config/defaults.json @@ -153,7 +153,7 @@ "url": "https://unpkg.com/@tryghost/koenig-react/dist/umd/koenig-react.min.js" }, "tenor": { - "publicReadOnlyApiKey": null, + "googleApiKey": null, "contentFilter": "off" }, "opensea": { diff --git a/ghost/core/test/e2e-api/admin/config.test.js b/ghost/core/test/e2e-api/admin/config.test.js index d0f5ae24c3..4e2ad93bc4 100644 --- a/ghost/core/test/e2e-api/admin/config.test.js +++ b/ghost/core/test/e2e-api/admin/config.test.js @@ -15,12 +15,12 @@ describe('Config API', function () { }); afterEach(function () { - configUtils.set('tenor:publicReadOnlyApiKey', undefined); + configUtils.set('tenor:googleApiKey', undefined); }); it('can retrieve config and all expected properties', async function () { // set any non-default keys so we can be sure they're exposed - configUtils.set('tenor:publicReadOnlyApiKey', 'TENOR_KEY'); + configUtils.set('tenor:googleApiKey', 'TENOR_KEY'); const res = await request .get(localUtils.API.getApiQuery('config/'))