nodebb-plugin-discord-onekite 1.1.12 → 1.1.14
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 +6 -3
- package/library.js +2 -1
- package/package.json +1 -1
- package/static/lib/admin.js +25 -20
- package/templates/admin/plugins/discord-onekite.tpl +10 -6
package/README.md
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
# nodebb-plugin-discord-onekite v1.1.4.
|
|
1
|
+
# nodebb-plugin-discord-onekite v1.1.4.5
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
Fixes ACP save (API route) + floating save button + toast.
|
|
4
|
+
|
|
5
|
+
- Adds API route via `routeHelpers.setupApiRoute` so `api.post('/admin/...')` works.
|
|
6
|
+
- Adds floating save button bottom-right.
|
|
7
|
+
- Shows NodeBB toast on success.
|
package/library.js
CHANGED
|
@@ -129,7 +129,8 @@ async function getPostExcerpt(pid) {
|
|
|
129
129
|
}
|
|
130
130
|
|
|
131
131
|
async function buildPayload({ tid, pid, isReply }) {
|
|
132
|
-
|
|
132
|
+
let baseUrl = normalizeBaseUrl(meta.config.url || meta.config['url']);
|
|
133
|
+
if (!baseUrl) { baseUrl = 'https://www.onekite.com'; }
|
|
133
134
|
|
|
134
135
|
const topicData = await topics.getTopicFields(tid, ['tid', 'uid', 'cid', 'title', 'slug', 'mainPid']);
|
|
135
136
|
if (!topicData) return null;
|
package/package.json
CHANGED
package/static/lib/admin.js
CHANGED
|
@@ -10,28 +10,33 @@ define('admin/plugins/discord-onekite', ['api'], function (api) {
|
|
|
10
10
|
return Array.from(el.selectedOptions || []).map(o => o.value);
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
const
|
|
15
|
-
|
|
13
|
+
function doSave() {
|
|
14
|
+
const payload = {
|
|
15
|
+
webhookUrl: String($('#webhookUrl').val() || '').trim(),
|
|
16
|
+
notifyReplies: $('#notifyReplies').is(':checked'),
|
|
17
|
+
cids: getMultiSelectValues('#cids'),
|
|
18
|
+
};
|
|
16
19
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
// `api.post('/admin/...')` -> `/api/admin/...`
|
|
21
|
+
return api.post('/admin/plugins/discord-onekite/save', payload).then(function () {
|
|
22
|
+
if (window.app && typeof app.alertSuccess === 'function') {
|
|
23
|
+
app.alertSuccess('Paramètres enregistrés !');
|
|
24
|
+
}
|
|
25
|
+
}).catch(function (err) {
|
|
26
|
+
// eslint-disable-next-line no-console
|
|
27
|
+
console.error(err);
|
|
28
|
+
if (window.app && typeof app.alertError === 'function') {
|
|
29
|
+
app.alertError('Erreur lors de l’enregistrement');
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
ACP.init = function () {
|
|
35
|
+
if (!$('.discord-onekite-settings').length) return;
|
|
23
36
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
}
|
|
28
|
-
}).catch(function (err) {
|
|
29
|
-
// eslint-disable-next-line no-console
|
|
30
|
-
console.error(err);
|
|
31
|
-
if (window.app && typeof app.alertError === 'function') {
|
|
32
|
-
app.alertError('Erreur lors de l’enregistrement');
|
|
33
|
-
}
|
|
34
|
-
});
|
|
37
|
+
$(document).off('click.discordOnekite', '#save').on('click.discordOnekite', '#save', function (e) {
|
|
38
|
+
e.preventDefault();
|
|
39
|
+
doSave();
|
|
35
40
|
});
|
|
36
41
|
};
|
|
37
42
|
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
<div class="acp-page-container">
|
|
2
|
-
<
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
<div class="d-flex justify-content-between align-items-start mb-3">
|
|
3
|
+
<div>
|
|
4
|
+
<h4 class="mb-1">Discord Onekite</h4>
|
|
5
|
+
<p class="text-muted mb-0">Notifications Discord via webhook.</p>
|
|
6
|
+
</div>
|
|
7
|
+
</div>
|
|
6
8
|
|
|
7
9
|
<form role="form" class="discord-onekite-settings">
|
|
8
10
|
<div class="mb-3">
|
|
@@ -28,7 +30,9 @@
|
|
|
28
30
|
Si aucune catégorie n’est sélectionnée : <strong>toutes les catégories</strong> seront notifiées.
|
|
29
31
|
</p>
|
|
30
32
|
</div>
|
|
31
|
-
|
|
32
|
-
<!-- IMPORT admin/partials/save_button.tpl -->
|
|
33
33
|
</form>
|
|
34
|
+
|
|
35
|
+
<button id="save" class="btn btn-primary" style="position: fixed; right: 2rem; bottom: 2rem; z-index: 1030;">
|
|
36
|
+
<i class="fa fa-save"></i>
|
|
37
|
+
</button>
|
|
34
38
|
</div>
|