nodebb-plugin-tenor-gif 3.1.10 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,14 +1,13 @@
1
- # Tenor GIF Integration for NodeBB
1
+ # Klipy GIF Integration for NodeBB
2
2
 
3
3
  ![Searching 'pizza' in the via modal window](/screenshot.png)
4
4
 
5
- This plugin adds a "GIF" button to the default composer and allows you to search and insert GIFs. It is powered by the [Tenor GIF service](https://tenor.com). Kudos to Tenor/Alphabet for providing a simple and easy-to-use API! ❤️
5
+ This plugin adds a "GIF" button to the default composer and allows you to search and insert GIFs. It is powered by the [Klipy GIF service](https://klipy.com).
6
6
 
7
- Install the plugin via the admin dashboard, or `npm i nodebb-plugin-tenor-gif`. You'll need to register for a Tenor GIF API key from the [Google Cloud Console](https://console.cloud.google.com/apis/credentials).
7
+ Install the plugin via the admin dashboard, or `npm i nodebb-plugin-tenor-gif`. You'll need to register for a Klipy API key from the [Klipy Partner Portal](https://partner.klipy.com/).
8
8
 
9
- Then insert said API, save the config, and reload/restart NodeBB.
9
+ Then insert said API key, save the config, and reload/restart NodeBB.
10
10
 
11
- # Migrating from v1 to v2
11
+ ## Migration from Tenor
12
12
 
13
- We are now using v2 of the Tenor GIF API.
14
- Register for a new v2 API key from the [Google Cloud Console](https://console.cloud.google.com/apis/credentials) and replace the existing key.
13
+ Google has sunset the Tenor GIF API. This plugin now uses Klipy as its GIF provider. The Klipy API is fully compatible with the previous Tenor API — simply replace your old Tenor API key with a Klipy API key from the [Klipy Partner Portal](https://partner.klipy.com/) and everything continues to work.
package/library.js CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- const request = require('request-promise-native');
3
+ const request = require.main.require('./src/request');
4
4
 
5
5
  const controllers = require('./lib/controllers');
6
6
  const websockets = require('./websockets');
@@ -68,9 +68,9 @@ plugin.query = async (query) => {
68
68
 
69
69
  query = String(query).trim();
70
70
  const commonArgs = `&limit=${limit}&contentfilter=${contentFilter || 'medium'}&key=${key}&client_key=nodebb-${slugify(nconf.get('url'))}`;
71
- let url = `https://tenor.googleapis.com/v2/featured?type=featured${commonArgs}`;
71
+ let url = `https://api.klipy.com/v2/featured?type=featured${commonArgs}`;
72
72
  if (query) {
73
- url = `https://tenor.googleapis.com/v2/search?q=${query}${commonArgs}`;
73
+ url = `https://api.klipy.com/v2/search?q=${query}${commonArgs}`;
74
74
  }
75
75
 
76
76
  let gifs = plugin._cache.get(query);
@@ -78,11 +78,7 @@ plugin.query = async (query) => {
78
78
  return gifs;
79
79
  }
80
80
 
81
- const body = await request({
82
- url,
83
- method: 'get',
84
- json: true,
85
- });
81
+ const { body } = await request.get(url);
86
82
 
87
83
  if (!key || (body && body.hasOwnProperty('error'))) {
88
84
  throw new Error('[[error:invalid-login-credentials]]');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nodebb-plugin-tenor-gif",
3
- "version": "3.1.10",
3
+ "version": "4.0.0",
4
4
  "description": "",
5
5
  "main": "library.js",
6
6
  "repository": {
@@ -26,9 +26,7 @@
26
26
  "dependencies": {
27
27
  "@commitlint/cli": "^9.1.2",
28
28
  "eslint": "8.x",
29
- "lint-staged": "^13.0.3",
30
- "request": "^2.88.2",
31
- "request-promise-native": "^1.0.9"
29
+ "lint-staged": "^13.0.3"
32
30
  },
33
31
  "devDependencies": {
34
32
  "@commitlint/cli": "^9.1.2",
@@ -8,10 +8,7 @@
8
8
  <div class="col-sm-2 col-12 settings-header">General</div>
9
9
  <div class="col-sm-10 col-12">
10
10
  <p class="lead">
11
- Sign up for your Tenor GIF API Key from the <a href="https://console.cloud.google.com/apis/credentials">Google Cloud Console</a>, then enter it below and reload your NodeBB.
12
- </p>
13
- <p>
14
- <strong>Be careful</strong>: If you use the <i class="fa fa-copy"></i> button to copy the API key, it'll add spaces to the beginning and end. You'll need to remove those.
11
+ Sign up for your Klipy API Key at the <a href="https://partner.klipy.com/">Klipy Partner Portal</a>, then enter it below and reload your NodeBB.
15
12
  </p>
16
13
  <div class="mb-3">
17
14
  <label for="key">API Key</label>