nodebb-plugin-facebook-post 1.0.32 → 1.0.33
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 +10 -3
- package/package.json +1 -1
- package/static/lib/composer.js +3 -3
package/library.js
CHANGED
|
@@ -310,14 +310,17 @@ Plugin.init = async function (params) {
|
|
|
310
310
|
});
|
|
311
311
|
|
|
312
312
|
router.get('/api/facebook-post/search-place', middleware.ensureLoggedIn, async (req, res) => {
|
|
313
|
+
const winston = require.main.require('winston');
|
|
313
314
|
res.set('Cache-Control', 'no-store');
|
|
314
315
|
try {
|
|
315
316
|
await loadSettings();
|
|
316
317
|
if (!settings.enabled || !settings.enablePlaceTagging || !settings.fbPageAccessToken) {
|
|
318
|
+
winston.info(`[facebook-post] search-place: abandon — enabled=${settings.enabled} enablePlaceTagging=${settings.enablePlaceTagging} token=${!!settings.fbPageAccessToken}`);
|
|
317
319
|
return res.json({ results: [] });
|
|
318
320
|
}
|
|
319
321
|
const q = trimStr(req.query.q);
|
|
320
322
|
if (q.length < 2) return res.json({ results: [] });
|
|
323
|
+
winston.info(`[facebook-post] search-place: requête q="${q}"`);
|
|
321
324
|
const resp = await axios.get(`https://graph.facebook.com/${settings.fbGraphVersion}/search`, {
|
|
322
325
|
params: {
|
|
323
326
|
type: 'place',
|
|
@@ -328,9 +331,13 @@ Plugin.init = async function (params) {
|
|
|
328
331
|
},
|
|
329
332
|
timeout: 8000,
|
|
330
333
|
});
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
return res.json({ results
|
|
334
|
+
const results = (resp.data && resp.data.data) || [];
|
|
335
|
+
winston.info(`[facebook-post] search-place: ${results.length} résultat(s) pour "${q}"`);
|
|
336
|
+
return res.json({ results });
|
|
337
|
+
} catch (e) {
|
|
338
|
+
const detail = e?.response ? JSON.stringify(e.response.data) : (e?.message || e);
|
|
339
|
+
winston.error(`[facebook-post] search-place: ERREUR: ${detail}`);
|
|
340
|
+
return res.json({ results: [], error: detail });
|
|
334
341
|
}
|
|
335
342
|
});
|
|
336
343
|
|
package/package.json
CHANGED
package/static/lib/composer.js
CHANGED
|
@@ -58,12 +58,12 @@
|
|
|
58
58
|
const $placePanel = $(`
|
|
59
59
|
<div class="fb-place-panel d-none align-items-center gap-2 px-2 py-1"
|
|
60
60
|
style="font-size:0.85em; border-top:1px solid rgba(128,128,128,.2);">
|
|
61
|
-
<i class="fab fa-facebook-f" style="color:#1877F2; flex-shrink:0;"></i>
|
|
62
61
|
<span class="text-muted">Publier sur Facebook</span>
|
|
63
62
|
${showPlace ? `
|
|
64
|
-
<div class="position-relative flex-grow-1 ms-2">
|
|
63
|
+
<div class="position-relative d-flex align-items-center gap-1 flex-grow-1 ms-2">
|
|
64
|
+
<span class="text-muted text-nowrap">Lieu (facultatif)</span>
|
|
65
65
|
<input type="text" class="form-control form-control-sm fb-place-search"
|
|
66
|
-
placeholder="
|
|
66
|
+
placeholder="Rechercher…" autocomplete="off">
|
|
67
67
|
<ul class="fb-place-results dropdown-menu p-1"
|
|
68
68
|
style="display:none; position:absolute; z-index:9999; top:100%; left:0;
|
|
69
69
|
min-width:220px; max-height:200px; overflow-y:auto;"></ul>
|