nodebb-plugin-facebook-post 1.0.22 → 1.0.23

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.
Files changed (2) hide show
  1. package/library.js +13 -14
  2. package/package.json +1 -1
package/library.js CHANGED
@@ -342,13 +342,13 @@ Plugin.onPostCreate = async function (hookData) {
342
342
  const winston = require.main.require('winston');
343
343
  try {
344
344
  if (!hookData?.post || !hookData?.data) {
345
- winston.verbose('[facebook-post] onPostCreate: hookData manquant (post ou data absent)');
345
+ winston.info('[facebook-post] onPostCreate: hookData manquant (post ou data absent)');
346
346
  return hookData;
347
347
  }
348
348
  hookData.post.fbPostEnabled = bool(hookData.data.fbPostEnabled);
349
349
  const fbPlaceId = trimStr(hookData.data.fbPlaceId);
350
350
  if (fbPlaceId) hookData.post.fbPlaceId = fbPlaceId;
351
- winston.verbose(`[facebook-post] onPostCreate: pid=${hookData.post.pid} fbPostEnabled=${hookData.post.fbPostEnabled} fbPlaceId=${hookData.post.fbPlaceId || '(none)'}`);
351
+ winston.info(`[facebook-post] onPostCreate: pid=${hookData.post.pid} fbPostEnabled=${hookData.post.fbPostEnabled} fbPlaceId=${hookData.post.fbPlaceId || '(none)'}`);
352
352
  } catch (e) {
353
353
  winston.error(`[facebook-post] onPostCreate erreur: ${e?.message || e}`);
354
354
  }
@@ -357,57 +357,56 @@ Plugin.onPostCreate = async function (hookData) {
357
357
 
358
358
  Plugin.onPostSave = async function (hookData) {
359
359
  const winston = require.main.require('winston');
360
- winston.verbose('[facebook-post] onPostSave: hook déclenché');
360
+ winston.info('[facebook-post] onPostSave: hook déclenché');
361
361
  try {
362
362
  await loadSettings();
363
- winston.verbose(`[facebook-post] onPostSave: settings.enabled=${settings.enabled} fbPageId=${settings.fbPageId ? 'défini' : 'MANQUANT'} fbPageAccessToken=${settings.fbPageAccessToken ? 'défini' : 'MANQUANT'}`);
363
+ winston.info(`[facebook-post] onPostSave: settings.enabled=${settings.enabled} fbPageId=${settings.fbPageId ? 'défini' : 'MANQUANT'} fbPageAccessToken=${settings.fbPageAccessToken ? 'défini' : 'MANQUANT'}`);
364
364
 
365
365
  if (!settings.enabled) {
366
- winston.verbose('[facebook-post] onPostSave: abandon — plugin désactivé dans les paramètres');
366
+ winston.info('[facebook-post] onPostSave: abandon — plugin désactivé dans les paramètres');
367
367
  return;
368
368
  }
369
369
 
370
370
  const rawPost = hookData && hookData.post ? hookData.post : hookData;
371
- winston.verbose(`[facebook-post] onPostSave: données brutes reçues — pid=${rawPost?.pid} fbPostEnabled=${rawPost?.fbPostEnabled}`);
371
+ winston.info(`[facebook-post] onPostSave: données brutes reçues — pid=${rawPost?.pid} fbPostEnabled=${rawPost?.fbPostEnabled}`);
372
372
 
373
373
  const ctx = await getPostContext(rawPost);
374
374
  if (!ctx) {
375
375
  winston.warn('[facebook-post] onPostSave: abandon — impossible de récupérer le contexte du post (pid invalide ?)');
376
376
  return;
377
377
  }
378
- winston.verbose(`[facebook-post] onPostSave: contexte récupéré — pid=${ctx.post.pid} tid=${ctx.topic.tid} cid=${ctx.topic.cid} uid=${ctx.user.uid} isMainPost=${ctx.post.isMainPost} index=${ctx.post.index} reputation=${ctx.user.reputation}`);
378
+ winston.info(`[facebook-post] onPostSave: contexte récupéré — pid=${ctx.post.pid} tid=${ctx.topic.tid} cid=${ctx.topic.cid} uid=${ctx.user.uid} isMainPost=${ctx.post.isMainPost} index=${ctx.post.index} reputation=${ctx.user.reputation}`);
379
379
 
380
380
  const allowed = await userIsAllowed(ctx.post.uid);
381
381
  if (!allowed) {
382
382
  const groups = parseAllowedGroupsList();
383
- winston.verbose(`[facebook-post] onPostSave: abandon — uid=${ctx.post.uid} n'est pas dans les groupes autorisés: [${groups.join(', ')}]`);
383
+ winston.info(`[facebook-post] onPostSave: abandon — uid=${ctx.post.uid} n'est pas dans les groupes autorisés: [${groups.join(', ')}]`);
384
384
  return;
385
385
  }
386
- winston.verbose(`[facebook-post] onPostSave: uid=${ctx.post.uid} autorisé par les groupes`);
386
+ winston.info(`[facebook-post] onPostSave: uid=${ctx.post.uid} autorisé par les groupes`);
387
387
 
388
388
  const process = shouldProcessPost(ctx);
389
389
  if (!process) {
390
- // Log détaillé de la raison du refus
391
390
  const isFirstPost = (ctx.post.isMainPost === true) || (ctx.post.index === 0);
392
391
  const fbEnabled = bool(ctx.post.fbPostEnabled);
393
392
  const repOk = (ctx.user.reputation || 0) >= settings.minimumReputation;
394
393
  const whitelist = parseCsvInts(settings.categoriesWhitelist);
395
394
  const catOk = whitelist.length === 0 || whitelist.includes(parseInt(ctx.topic.cid, 10));
396
- winston.verbose(`[facebook-post] onPostSave: abandon — shouldProcessPost=false. Détail: isFirstPost=${isFirstPost} fbPostEnabled=${fbEnabled} reputationOk=${repOk}(${ctx.user.reputation}>=${settings.minimumReputation}) categoryOk=${catOk}(cid=${ctx.topic.cid} whitelist=[${whitelist}])`);
395
+ winston.info(`[facebook-post] onPostSave: abandon — shouldProcessPost=false. Détail: isFirstPost=${isFirstPost} fbPostEnabled=${fbEnabled} reputationOk=${repOk}(${ctx.user.reputation}>=${settings.minimumReputation}) categoryOk=${catOk}(cid=${ctx.topic.cid} whitelist=[${whitelist}])`);
397
396
  return;
398
397
  }
399
- winston.verbose('[facebook-post] onPostSave: shouldProcessPost=true, publication en cours…');
398
+ winston.info('[facebook-post] onPostSave: shouldProcessPost=true, publication en cours…');
400
399
 
401
400
  const Posts = require.main.require('./src/posts');
402
401
 
403
402
  const already = await Posts.getPostField(ctx.post.pid, 'fbPostedId');
404
403
  if (already) {
405
- winston.verbose(`[facebook-post] onPostSave: abandon — déjà publié (fbPostedId=${already})`);
404
+ winston.info(`[facebook-post] onPostSave: abandon — déjà publié (fbPostedId=${already})`);
406
405
  return;
407
406
  }
408
407
 
409
408
  const imageUrls = extractImageUrlsFromContent(ctx.post.content || '').filter(isForumHosted);
410
- winston.verbose(`[facebook-post] onPostSave: images hébergées sur le forum trouvées: ${imageUrls.length} [${imageUrls.join(', ')}]`);
409
+ winston.info(`[facebook-post] onPostSave: images hébergées sur le forum trouvées: ${imageUrls.length} [${imageUrls.join(', ')}]`);
411
410
 
412
411
  const fbId = await postToFacebook(ctx);
413
412
  if (fbId) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nodebb-plugin-facebook-post",
3
- "version": "1.0.22",
3
+ "version": "1.0.23",
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": {