nodebb-plugin-facebook-post 1.0.25 → 1.0.26

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 CHANGED
@@ -295,6 +295,7 @@ Plugin.init = async function (params) {
295
295
  });
296
296
 
297
297
  router.get('/api/facebook-post/search-place', middleware.ensureLoggedIn, async (req, res) => {
298
+ const winston = require.main.require('winston');
298
299
  res.set('Cache-Control', 'no-store');
299
300
  try {
300
301
  await loadSettings();
@@ -316,13 +317,16 @@ Plugin.init = async function (params) {
316
317
  }
317
318
  );
318
319
  const data = (resp.data && resp.data.data) || [];
320
+ winston.info(`[facebook-post] search-place: q="${q}" → ${data.length} résultat(s)`);
319
321
  const results = data.map(p => ({
320
322
  id: p.id,
321
323
  name: p.name,
322
324
  city: (p.location && (p.location.city || p.location.country)) || '',
323
325
  }));
324
326
  return res.json({ results });
325
- } catch {
327
+ } catch (e) {
328
+ const detail = e?.response?.data ? JSON.stringify(e.response.data) : e?.message;
329
+ winston.warn(`[facebook-post] search-place erreur: ${detail}`);
326
330
  return res.json({ results: [] });
327
331
  }
328
332
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nodebb-plugin-facebook-post",
3
- "version": "1.0.25",
3
+ "version": "1.0.26",
4
4
  "description": "Auto-post new NodeBB topics to a fixed Facebook Page (text + NodeBB uploads + place id).",
5
5
  "main": "library.js",
6
6
  "dependencies": {
@@ -115,12 +115,12 @@
115
115
  $(window).off('filter:composer.submit.fbpost')
116
116
  .on('filter:composer.submit.fbpost', function (ev2, submitData) {
117
117
  const enabled = $enabled.is(':checked');
118
- submitData.postData = submitData.postData || {};
119
- submitData.postData.fbPostEnabled = enabled;
118
+ // Inject directly into the post-data object that NodeBB sends to the socket
119
+ submitData.fbPostEnabled = enabled;
120
120
 
121
121
  if (enabled) {
122
122
  const placeId = $composer.find('[data-fbpost-place-id]').val();
123
- if (placeId) submitData.postData.fbPlaceId = placeId;
123
+ if (placeId) submitData.fbPlaceId = placeId;
124
124
  }
125
125
  return submitData;
126
126
  });