nodebb-plugin-facebook-post 1.0.11 → 1.0.13
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/library.js +1 -0
- package/package.json +1 -1
- package/static/lib/composer.js +8 -6
package/library.js
CHANGED
|
@@ -333,6 +333,7 @@ Plugin.init = async function (params) {
|
|
|
333
333
|
router.get('/api/admin/plugins/facebook-post', render);
|
|
334
334
|
|
|
335
335
|
router.get('/api/facebook-post/can-post', middleware.ensureLoggedIn, async (req, res) => {
|
|
336
|
+
res.set('Cache-Control', 'no-store');
|
|
336
337
|
try {
|
|
337
338
|
await loadSettings();
|
|
338
339
|
if (!settings.enabled) return res.json({ allowed: false, reason: 'disabled' });
|
package/package.json
CHANGED
package/static/lib/composer.js
CHANGED
|
@@ -4,7 +4,10 @@
|
|
|
4
4
|
(function () {
|
|
5
5
|
async function canPost() {
|
|
6
6
|
try {
|
|
7
|
-
const res = await fetch('/api/facebook-post/can-post', {
|
|
7
|
+
const res = await fetch('/api/facebook-post/can-post?_=' + Date.now(), {
|
|
8
|
+
credentials: 'same-origin',
|
|
9
|
+
cache: 'no-store',
|
|
10
|
+
});
|
|
8
11
|
if (!res.ok) return { allowed: false };
|
|
9
12
|
return await res.json();
|
|
10
13
|
} catch {
|
|
@@ -19,7 +22,7 @@
|
|
|
19
22
|
<div class="mb-2" data-fbpost-wrap>
|
|
20
23
|
<div class="form-check mb-2">
|
|
21
24
|
<input type="checkbox" class="form-check-input" id="fbPostEnabled" data-fbpost-enabled>
|
|
22
|
-
<label class="form-check-label" for="fbPostEnabled">Publier ce nouveau topic sur Facebook</label>
|
|
25
|
+
<label class="form-check-label" for="fbPostEnabled">Publier ce nouveau topic sur Facebook (et Insta si activé)</label>
|
|
23
26
|
</div>
|
|
24
27
|
|
|
25
28
|
<div class="mb-2" data-fbpost-place-wrap style="display:none;">
|
|
@@ -28,7 +31,7 @@
|
|
|
28
31
|
</label>
|
|
29
32
|
<input type="text" class="form-control" data-fbpost-place-id placeholder="ex: 123456789012345">
|
|
30
33
|
<div class="form-text" style="font-size: 11px;">
|
|
31
|
-
|
|
34
|
+
Utilisé comme <code>place</code> sur Facebook et <code>location_id</code> sur Instagram.
|
|
32
35
|
</div>
|
|
33
36
|
</div>
|
|
34
37
|
</div>
|
|
@@ -45,7 +48,6 @@
|
|
|
45
48
|
$placeWrap.toggle($enabled.is(':checked'));
|
|
46
49
|
});
|
|
47
50
|
|
|
48
|
-
// Inject custom data at submit time
|
|
49
51
|
$(window).off('filter:composer.submit.fbpost')
|
|
50
52
|
.on('filter:composer.submit.fbpost', function (ev2, submitData) {
|
|
51
53
|
const enabled = $enabled.is(':checked');
|
|
@@ -62,14 +64,14 @@
|
|
|
62
64
|
|
|
63
65
|
$(window).on('action:composer.loaded', async function (ev, data) {
|
|
64
66
|
try {
|
|
65
|
-
const $composer = data && data.composer ? data.composer : $('.composer');
|
|
67
|
+
const $composer = data && data.composer ? $(data.composer) : $('.composer');
|
|
66
68
|
if (!$composer || !$composer.length) return;
|
|
67
69
|
|
|
68
70
|
const perm = await canPost();
|
|
69
71
|
if (!perm.allowed) return;
|
|
70
72
|
|
|
71
73
|
injectUI($composer);
|
|
72
|
-
} catch
|
|
74
|
+
} catch {
|
|
73
75
|
// ignore
|
|
74
76
|
}
|
|
75
77
|
});
|