nodebb-plugin-tenor-gif 1.2.8 → 2.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 +8 -3
- package/library.js +3 -3
- package/package.json +2 -2
- package/plugin.json +4 -4
- package/static/templates/admin/plugins/tenor-gif.tpl +4 -1
package/README.md
CHANGED
|
@@ -2,8 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|

|
|
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 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 [Tenor GIF service](https://tenor.com). Kudos to Tenor/Alphabet for providing a simple and easy-to-use API! ❤️
|
|
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
|
|
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).
|
|
8
8
|
|
|
9
|
-
Then insert said API, save the config, and reload/restart NodeBB.
|
|
9
|
+
Then insert said API, save the config, and reload/restart NodeBB.
|
|
10
|
+
|
|
11
|
+
# Migrating from v1 to v2
|
|
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.
|
package/library.js
CHANGED
|
@@ -56,7 +56,7 @@ plugin.registerFormatting = function (payload, callback) {
|
|
|
56
56
|
|
|
57
57
|
plugin.query = function (query, callback) {
|
|
58
58
|
request({
|
|
59
|
-
url: 'https://
|
|
59
|
+
url: 'https://tenor.googleapis.com/v2/search?q=' + query + '&key=' + plugin._settings.key,
|
|
60
60
|
method: 'get',
|
|
61
61
|
json: true,
|
|
62
62
|
}, function (err, res, body) {
|
|
@@ -76,8 +76,8 @@ plugin.query = function (query, callback) {
|
|
|
76
76
|
// Collapse results down to array of images
|
|
77
77
|
var gifs = body.results.reduce(function (memo, cur) {
|
|
78
78
|
memo.push({
|
|
79
|
-
url: cur.
|
|
80
|
-
thumb: cur.
|
|
79
|
+
url: cur.media_formats.gif.url,
|
|
80
|
+
thumb: cur.media_formats.tinygif.url,
|
|
81
81
|
});
|
|
82
82
|
|
|
83
83
|
return memo;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nodebb-plugin-tenor-gif",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "library.js",
|
|
6
6
|
"repository": {
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
},
|
|
22
22
|
"readmeFilename": "README.md",
|
|
23
23
|
"nbbpm": {
|
|
24
|
-
"compatibility": "^1.6.0"
|
|
24
|
+
"compatibility": "^1.6.0 || ^2.0.0"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"@commitlint/cli": "^9.1.2",
|
package/plugin.json
CHANGED
|
@@ -10,11 +10,11 @@
|
|
|
10
10
|
"scripts": [
|
|
11
11
|
"static/lib/main.js"
|
|
12
12
|
],
|
|
13
|
-
"
|
|
14
|
-
"static/lib/admin.js"
|
|
15
|
-
|
|
13
|
+
"modules": {
|
|
14
|
+
"../admin/plugins/tenor-gif.js": "static/lib/admin.js"
|
|
15
|
+
},
|
|
16
16
|
"less": [
|
|
17
17
|
"static/less/modal.less"
|
|
18
18
|
],
|
|
19
19
|
"templates": "static/templates"
|
|
20
|
-
}
|
|
20
|
+
}
|
|
@@ -3,7 +3,10 @@
|
|
|
3
3
|
<div class="col-sm-2 col-xs-12 settings-header">General</div>
|
|
4
4
|
<div class="col-sm-10 col-xs-12">
|
|
5
5
|
<p class="lead">
|
|
6
|
-
Sign up for your Tenor GIF API Key
|
|
6
|
+
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.
|
|
7
|
+
</p>
|
|
8
|
+
<p>
|
|
9
|
+
<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.
|
|
7
10
|
</p>
|
|
8
11
|
<div class="form-group">
|
|
9
12
|
<label for="key">API Key</label>
|