nodebb-plugin-ezoic-infinite 1.8.52 → 1.8.53

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 +9 -30
  2. package/package.json +1 -1
package/library.js CHANGED
@@ -135,21 +135,16 @@ const HEAD_PRECONNECTS = [
135
135
  '<link rel="dns-prefetch" href="https://securepubads.g.doubleclick.net">',
136
136
  ].join('\n');
137
137
 
138
- // CRITICAL: The global stubs MUST be the very first <script> block, before
139
- // any Ezoic script (CMP, sa.min.js). sa.min.js is async and can execute as
140
- // soon as it downloads — if it runs before the stub, _ezaq is undefined.
141
- const EZOIC_GLOBALS = [
138
+ const EZOIC_SCRIPTS = [
139
+ '<script data-cfasync="false" src="https://the.gatekeeperconsent.com/cmp.min.js"></script>',
140
+ '<script async src="//www.ezojs.com/ezoic/sa.min.js"></script>',
142
141
  '<script>',
143
142
  'window._ezaq = window._ezaq || {};',
144
143
  'window.ezstandalone = window.ezstandalone || {};',
145
- 'window.ezstandalone.cmd = window.ezstandalone.cmd || [];',
144
+ 'ezstandalone.cmd = ezstandalone.cmd || [];',
146
145
  '</script>',
147
- ].join('\n');
146
+ '<script src="//ezoicanalytics.com/analytics.js"></script>',
148
147
 
149
- const EZOIC_SCRIPTS = [
150
- '<script data-cfasync="false" src="https://cmp.gatekeeperconsent.com/min.js"></script>',
151
- '<script data-cfasync="false" src="https://the.gatekeeperconsent.com/cmp.min.js"></script>',
152
- '<script async src="//www.ezojs.com/ezoic/sa.min.js"></script>',
153
148
  ].join('\n');
154
149
 
155
150
  // ── Hooks ────────────────────────────────────────────────────────────────────
@@ -173,27 +168,11 @@ plugin.injectEzoicHead = async (data) => {
173
168
  const settings = await getSettings();
174
169
  const uid = data.req?.uid ?? 0;
175
170
  const excluded = await isUserExcluded(uid, settings.excludedGroups);
176
-
177
- if (excluded) {
178
- const cfg = buildClientConfig(settings, true);
179
- // Minimal stub only — no Ezoic scripts loaded for excluded users
180
- data.templateData.customHTML =
181
- EZOIC_GLOBALS + '\n' +
182
- serializeInlineConfig(cfg) +
183
- (data.templateData.customHTML || '');
184
- } else {
185
- const cfg = buildClientConfig(settings, false);
186
- // Order: preconnects → global stubs → CMP scripts → sa.min.js → inline config
187
- data.templateData.customHTML =
188
- HEAD_PRECONNECTS + '\n' +
189
- EZOIC_GLOBALS + '\n' +
190
- EZOIC_SCRIPTS + '\n' +
191
- serializeInlineConfig(cfg) +
192
- (data.templateData.customHTML || '');
171
+ if (!excluded) {
172
+ // Préfixer : nos scripts d'abord, puis le customHTML existant de l'admin
173
+ data.templateData.customHTML = EZOIC_SCRIPTS + (data.templateData.customHTML || '');
193
174
  }
194
- } catch (err) {
195
- console.error('[ezoic-infinite] injectEzoicHead error:', err.message);
196
- }
175
+ } catch (_) {}
197
176
  return data;
198
177
  };
199
178
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nodebb-plugin-ezoic-infinite",
3
- "version": "1.8.52",
3
+ "version": "1.8.53",
4
4
  "description": "Production-ready Ezoic infinite ads integration for NodeBB 4.x",
5
5
  "main": "library.js",
6
6
  "license": "MIT",