nodebb-plugin-ezoic-infinite 1.8.66 → 1.8.68

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
@@ -87,11 +87,8 @@ async function isUserExcluded(uid, excludedGroups) {
87
87
  const value = (userGroups[0] || []).some(g => excludedSet.has(g.name));
88
88
 
89
89
  _excludeCache.set(key, { value, at: Date.now() });
90
-
91
- // Limit cache size to prevent unbounded growth
92
90
  if (_excludeCache.size > 1000) {
93
- const oldest = _excludeCache.keys().next().value;
94
- _excludeCache.delete(oldest);
91
+ _excludeCache.delete(_excludeCache.keys().next().value);
95
92
  }
96
93
 
97
94
  return value;
@@ -124,7 +121,7 @@ function buildClientConfig(settings, excluded) {
124
121
  }
125
122
 
126
123
  function serializeInlineConfig(cfg) {
127
- return `<script>window.__nbbEzoicCfg=${JSON.stringify(cfg).replace(/</g, '\\u003c')};</script>`;
124
+ return `<script data-cfasync="false">window.__nbbEzoicCfg=${JSON.stringify(cfg).replace(/</g, '\\u003c')};</script>`;
128
125
  }
129
126
 
130
127
  // ── Head injection ───────────────────────────────────────────────────────────
@@ -147,7 +144,6 @@ const EZOIC_SCRIPTS = [
147
144
  'ezstandalone.cmd = ezstandalone.cmd || [];',
148
145
  '</script>',
149
146
  '<script async src="//www.ezojs.com/ezoic/sa.min.js"></script>',
150
- '<script src="//ezoicanalytics.com/analytics.js"></script>',
151
147
  ].join('\n');
152
148
 
153
149
  // ── Hooks ────────────────────────────────────────────────────────────────────
@@ -166,10 +162,6 @@ plugin.addAdminNavigation = async (header) => {
166
162
  return header;
167
163
  };
168
164
 
169
- /**
170
- * Inject Ezoic scripts into <head> via templateData.customHTML.
171
- * NodeBB v4/Harmony: header.tpl has {{customHTML}} in <head>.
172
- */
173
165
  plugin.injectEzoicHead = async (data) => {
174
166
  try {
175
167
  const settings = await getSettings();
@@ -177,17 +169,14 @@ plugin.injectEzoicHead = async (data) => {
177
169
  const excluded = await isUserExcluded(uid, settings.excludedGroups);
178
170
 
179
171
  if (excluded) {
180
- // Even for excluded users, inject a minimal stub so that any script
181
- // referencing ezstandalone doesn't throw a ReferenceError, plus
182
- // the config with excluded=true so client.js bails early.
183
172
  const cfg = buildClientConfig(settings, true);
184
- const stub = [
185
- '<script>',
186
- 'window._ezaq = window._ezaq || {};',
187
- 'window.ezstandalone = window.ezstandalone || {};',
188
- 'ezstandalone.cmd = ezstandalone.cmd || [];',
189
- '</script>',
190
- ].join('\n');
173
+ // Minimal stub for excluded users — prevents ReferenceError if other
174
+ // scripts reference _ezaq or ezstandalone
175
+ const stub = '<script>'
176
+ + 'window._ezaq=window._ezaq||{};'
177
+ + 'window.ezstandalone=window.ezstandalone||{};'
178
+ + 'window.ezstandalone.cmd=window.ezstandalone.cmd||[];'
179
+ + '</script>';
191
180
  data.templateData.customHTML =
192
181
  stub + '\n' +
193
182
  serializeInlineConfig(cfg) +
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nodebb-plugin-ezoic-infinite",
3
- "version": "1.8.66",
3
+ "version": "1.8.68",
4
4
  "description": "Production-ready Ezoic infinite ads integration for NodeBB 4.x",
5
5
  "main": "library.js",
6
6
  "license": "MIT",