nodebb-plugin-tenor-gif 3.1.10 → 4.1.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.
@@ -0,0 +1,9 @@
1
+ 'use strict';
2
+
3
+ import serverConfig from 'eslint-config-nodebb';
4
+ import publicConfig from 'eslint-config-nodebb/public';
5
+
6
+ export default [
7
+ ...publicConfig,
8
+ ...serverConfig,
9
+ ];
@@ -1,11 +1,10 @@
1
1
  'use strict';
2
2
 
3
- var Controllers = {};
3
+ const Controllers = module.exports;
4
4
 
5
- Controllers.renderAdminPage = function (req, res, next) {
5
+ Controllers.renderAdminPage = function (req, res) {
6
6
  res.render('admin/plugins/tenor-gif', {
7
- title: 'Tenor GIF',
7
+ title: 'KLIPY (Tenor GIF)',
8
8
  });
9
9
  };
10
10
 
11
- module.exports = Controllers;
package/library.js CHANGED
@@ -1,14 +1,14 @@
1
1
  'use strict';
2
2
 
3
- const request = require('request-promise-native');
3
+ const request = nodebb.require('./src/request');
4
4
 
5
5
  const controllers = require('./lib/controllers');
6
6
  const websockets = require('./websockets');
7
7
 
8
- const nconf = require.main.require('nconf');
9
- const meta = require.main.require('./src/meta');
10
- const slugify = require.main.require('./src/slugify');
11
- const ttlCache = require.main.require('./src/cache/ttl');
8
+ const nconf = nodebb.require('nconf');
9
+ const meta = nodebb.require('./src/meta');
10
+ const slugify = nodebb.require('./src/slugify');
11
+ const ttlCache = nodebb.require('./src/cache/ttl');
12
12
 
13
13
  const plugin = module.exports;
14
14
 
@@ -32,7 +32,7 @@ plugin.addAdminNavigation = function (header, callback) {
32
32
  header.plugins.push({
33
33
  route: '/plugins/tenor-gif',
34
34
  icon: 'fa-tint',
35
- name: 'Tenor GIF',
35
+ name: 'KLIPY (Tenor GIF)',
36
36
  });
37
37
 
38
38
  callback(null, header);
@@ -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]]');