nodebb-plugin-ezoic-infinite 1.5.10 → 1.5.12

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
@@ -66,11 +66,18 @@ async function getSettings() {
66
66
  }
67
67
 
68
68
  async function isUserExcluded(uid, excludedGroups) {
69
- if (!uid || !excludedGroups.length) return false;
69
+ // Note: uid can be 0 for guests; treat 0 as a valid user id here.
70
+ if (uid === undefined || uid === null || !excludedGroups.length) return false;
71
+
72
+ const excludedSet = new Set(excludedGroups.map(g => String(g).toLowerCase()));
70
73
  const userGroups = await groups.getUserGroups([uid]);
71
- return (userGroups[0] || []).some(g => excludedGroups.includes((g && g.name) ? g.name : g));
74
+ return (userGroups[0] || []).some(g => {
75
+ const name = (g && g.name) ? g.name : g;
76
+ return excludedSet.has(String(name).toLowerCase());
77
+ });
72
78
  }
73
79
 
80
+
74
81
  plugin.onSettingsSet = function (data) {
75
82
  // Invalider le cache dès que les settings de ce plugin sont sauvegardés via l'ACP
76
83
  if (data && data.hash === SETTINGS_KEY) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nodebb-plugin-ezoic-infinite",
3
- "version": "1.5.10",
3
+ "version": "1.5.12",
4
4
  "description": "Production-ready Ezoic infinite ads integration for NodeBB 4.x",
5
5
  "main": "library.js",
6
6
  "license": "MIT",
package/public/client.js CHANGED
@@ -560,8 +560,11 @@
560
560
  ensurePreloadObserver();
561
561
  ensureDomObserver();
562
562
 
563
- // Ultra-fast above-the-fold first
564
- insertHeroAdEarly().catch(() => {});
563
+ // Ultra-fast above-the-fold first (respect excluded groups)
564
+ fetchConfigOnce().then((cfg) => {
565
+ if (!cfg || cfg.excluded) return;
566
+ insertHeroAdEarly().catch(() => {});
567
+ }).catch(() => {});
565
568
 
566
569
  // Then normal insertion
567
570
  scheduleRun();
@@ -597,8 +600,11 @@
597
600
  bindNodeBB();
598
601
  bindScroll();
599
602
 
600
- // First paint: try hero + run
603
+ // First paint: try hero + run (respect excluded groups)
601
604
  EZOIC_BLOCKED = false;
602
- insertHeroAdEarly().catch(() => {});
605
+ fetchConfigOnce().then((cfg) => {
606
+ if (!cfg || cfg.excluded) return;
607
+ insertHeroAdEarly().catch(() => {});
608
+ }).catch(() => {});
603
609
  scheduleRun();
604
610
  })();