nodebb-plugin-facebook-post 1.0.39 → 1.0.41
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 +8 -3
- package/package.json +1 -1
- package/static/lib/composer.js +2 -2
package/library.js
CHANGED
|
@@ -102,16 +102,21 @@ function decodeHtmlEntities(str) {
|
|
|
102
102
|
.replace(/&#(\d+);/g, (_, dec) => String.fromCharCode(Number(dec)));
|
|
103
103
|
}
|
|
104
104
|
|
|
105
|
+
function stripImageQueryString(url) {
|
|
106
|
+
// Remove query string and fragment after image extension
|
|
107
|
+
return url.replace(/(\.(?:png|jpe?g|gif|webp))[\?#].*/i, '$1');
|
|
108
|
+
}
|
|
109
|
+
|
|
105
110
|
function extractImageUrlsFromContent(rawContent) {
|
|
106
111
|
const urls = new Set();
|
|
107
112
|
if (!rawContent) return [];
|
|
108
113
|
|
|
109
114
|
const mdImg = /!\[[^\]]*]\(([^)\s]+)(?:\s+"[^"]*")?\)/g;
|
|
110
115
|
let m;
|
|
111
|
-
while ((m = mdImg.exec(rawContent)) !== null) urls.add(m[1]);
|
|
116
|
+
while ((m = mdImg.exec(rawContent)) !== null) urls.add(stripImageQueryString(m[1]));
|
|
112
117
|
|
|
113
118
|
const htmlImg = /<img[^>]+src=["']([^"']+)["'][^>]*>/gi;
|
|
114
|
-
while ((m = htmlImg.exec(rawContent)) !== null) urls.add(m[1]);
|
|
119
|
+
while ((m = htmlImg.exec(rawContent)) !== null) urls.add(stripImageQueryString(m[1]));
|
|
115
120
|
|
|
116
121
|
// Fallback: bare image URLs
|
|
117
122
|
const bare = /(https?:\/\/[^\s<>"']+\.(?:png|jpe?g|gif|webp))(?:\?[^\s<>"']*)?/gi;
|
|
@@ -350,7 +355,7 @@ async function postToInstagram(ctx) {
|
|
|
350
355
|
const form = new URLSearchParams();
|
|
351
356
|
form.append('media_type', 'CAROUSEL');
|
|
352
357
|
form.append('caption', caption);
|
|
353
|
-
form.append('children',
|
|
358
|
+
form.append('children', childIds.join(','));
|
|
354
359
|
form.append('access_token', token);
|
|
355
360
|
|
|
356
361
|
const carouselResp = await axios.post(`${baseUrl}/media`, form, {
|
package/package.json
CHANGED
package/static/lib/composer.js
CHANGED
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
const $li = $(`
|
|
22
22
|
<li aria-label="Publier sur Facebook" data-bs-original-title="Publier sur Facebook" data-fbpost-btn>
|
|
23
23
|
<button type="button" class="btn btn-sm btn-link text-reset"
|
|
24
|
-
aria-label="Publier sur Facebook" style="
|
|
24
|
+
aria-label="Publier sur Facebook" style="color:#c0392b;">
|
|
25
25
|
<i class="fab fa-facebook-f"></i>
|
|
26
26
|
</button>
|
|
27
27
|
</li>
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
$btn.on('click', function () {
|
|
32
32
|
const active = !$(this).data('fbpost-active');
|
|
33
33
|
$(this).data('fbpost-active', active);
|
|
34
|
-
$(this).css({ color: active ? '#
|
|
34
|
+
$(this).css({ color: active ? '#27ae60' : '#c0392b' });
|
|
35
35
|
});
|
|
36
36
|
|
|
37
37
|
const $toolbar = $composer.find('ul.formatting-group').first();
|