nodebb-plugin-discord-onekite 1.1.14 → 1.1.15
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 +7 -6
- package/library.js +1 -2
- package/package.json +1 -1
- package/static/lib/admin.js +11 -31
- package/templates/admin/plugins/discord-onekite.tpl +4 -10
package/README.md
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
# nodebb-plugin-discord-onekite v1.1.4.
|
|
1
|
+
# nodebb-plugin-discord-onekite v1.1.4.7
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
-
|
|
6
|
-
-
|
|
7
|
-
-
|
|
3
|
+
Discord output cleanup:
|
|
4
|
+
- Removes the extra content line under the title.
|
|
5
|
+
- Sends an embed where:
|
|
6
|
+
- title is clickable (embed.url)
|
|
7
|
+
- embed description contains the message excerpt
|
|
8
|
+
- `content` is only used as a fallback if Discord rejects embeds.
|
package/library.js
CHANGED
|
@@ -129,8 +129,7 @@ async function getPostExcerpt(pid) {
|
|
|
129
129
|
}
|
|
130
130
|
|
|
131
131
|
async function buildPayload({ tid, pid, isReply }) {
|
|
132
|
-
|
|
133
|
-
if (!baseUrl) { baseUrl = 'https://www.onekite.com'; }
|
|
132
|
+
const baseUrl = normalizeBaseUrl(meta.config.url);
|
|
134
133
|
|
|
135
134
|
const topicData = await topics.getTopicFields(tid, ['tid', 'uid', 'cid', 'title', 'slug', 'mainPid']);
|
|
136
135
|
if (!topicData) return null;
|
package/package.json
CHANGED
package/static/lib/admin.js
CHANGED
|
@@ -1,42 +1,22 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
/* global $, app */
|
|
3
3
|
|
|
4
|
-
define('admin/plugins/discord-onekite', ['
|
|
4
|
+
define('admin/plugins/discord-onekite', ['settings'], function (settings) {
|
|
5
5
|
const ACP = {};
|
|
6
6
|
|
|
7
|
-
function getMultiSelectValues(selector) {
|
|
8
|
-
const el = document.querySelector(selector);
|
|
9
|
-
if (!el) return [];
|
|
10
|
-
return Array.from(el.selectedOptions || []).map(o => o.value);
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
function doSave() {
|
|
14
|
-
const payload = {
|
|
15
|
-
webhookUrl: String($('#webhookUrl').val() || '').trim(),
|
|
16
|
-
notifyReplies: $('#notifyReplies').is(':checked'),
|
|
17
|
-
cids: getMultiSelectValues('#cids'),
|
|
18
|
-
};
|
|
19
|
-
|
|
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
7
|
ACP.init = function () {
|
|
35
|
-
|
|
8
|
+
const $form = $('.discord-onekite-settings');
|
|
9
|
+
if (!$form.length) return;
|
|
10
|
+
|
|
11
|
+
settings.sync('discord-onekite', $form);
|
|
36
12
|
|
|
37
|
-
$(
|
|
13
|
+
$('#save').off('click.discordOnekite').on('click.discordOnekite', function (e) {
|
|
38
14
|
e.preventDefault();
|
|
39
|
-
|
|
15
|
+
settings.persist('discord-onekite', $form, function () {
|
|
16
|
+
if (window.app && typeof app.alertSuccess === 'function') {
|
|
17
|
+
app.alertSuccess('Paramètres enregistrés !');
|
|
18
|
+
}
|
|
19
|
+
});
|
|
40
20
|
});
|
|
41
21
|
};
|
|
42
22
|
|
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
<div class="acp-page-container">
|
|
2
|
-
<
|
|
3
|
-
|
|
4
|
-
<h4 class="mb-1">Discord Onekite</h4>
|
|
5
|
-
<p class="text-muted mb-0">Notifications Discord via webhook.</p>
|
|
6
|
-
</div>
|
|
7
|
-
</div>
|
|
2
|
+
<h4>Discord Onekite</h4>
|
|
3
|
+
<p class="text-muted">Notifications Discord via webhook.</p>
|
|
8
4
|
|
|
9
5
|
<form role="form" class="discord-onekite-settings">
|
|
10
6
|
<div class="mb-3">
|
|
@@ -30,9 +26,7 @@
|
|
|
30
26
|
Si aucune catégorie n’est sélectionnée : <strong>toutes les catégories</strong> seront notifiées.
|
|
31
27
|
</p>
|
|
32
28
|
</div>
|
|
33
|
-
</form>
|
|
34
29
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
</button>
|
|
30
|
+
<button id="save" type="button" class="btn btn-primary">Enregistrer les paramètres</button>
|
|
31
|
+
</form>
|
|
38
32
|
</div>
|