nodebb-plugin-ezoic-infinite 1.8.51 → 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.
- package/library.js +8 -21
- package/package.json +1 -1
- package/public/client.js +296 -564
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
|
-
|
|
94
|
-
_excludeCache.delete(oldest);
|
|
91
|
+
_excludeCache.delete(_excludeCache.keys().next().value);
|
|
95
92
|
}
|
|
96
93
|
|
|
97
94
|
return value;
|
|
@@ -139,14 +136,15 @@ const HEAD_PRECONNECTS = [
|
|
|
139
136
|
].join('\n');
|
|
140
137
|
|
|
141
138
|
const EZOIC_SCRIPTS = [
|
|
142
|
-
'<script data-cfasync="false" src="https://cmp.gatekeeperconsent.com/min.js"></script>',
|
|
143
139
|
'<script data-cfasync="false" src="https://the.gatekeeperconsent.com/cmp.min.js"></script>',
|
|
144
140
|
'<script async src="//www.ezojs.com/ezoic/sa.min.js"></script>',
|
|
145
141
|
'<script>',
|
|
146
|
-
'
|
|
147
|
-
'
|
|
142
|
+
'window._ezaq = window._ezaq || {};',
|
|
143
|
+
'window.ezstandalone = window.ezstandalone || {};',
|
|
148
144
|
'ezstandalone.cmd = ezstandalone.cmd || [];',
|
|
149
145
|
'</script>',
|
|
146
|
+
'<script src="//ezoicanalytics.com/analytics.js"></script>',
|
|
147
|
+
|
|
150
148
|
].join('\n');
|
|
151
149
|
|
|
152
150
|
// ── Hooks ────────────────────────────────────────────────────────────────────
|
|
@@ -165,27 +163,16 @@ plugin.addAdminNavigation = async (header) => {
|
|
|
165
163
|
return header;
|
|
166
164
|
};
|
|
167
165
|
|
|
168
|
-
/**
|
|
169
|
-
* Inject Ezoic scripts into <head> via templateData.customHTML.
|
|
170
|
-
* NodeBB v4/Harmony: header.tpl has {{customHTML}} in <head>.
|
|
171
|
-
*/
|
|
172
166
|
plugin.injectEzoicHead = async (data) => {
|
|
173
167
|
try {
|
|
174
168
|
const settings = await getSettings();
|
|
175
169
|
const uid = data.req?.uid ?? 0;
|
|
176
170
|
const excluded = await isUserExcluded(uid, settings.excludedGroups);
|
|
177
171
|
if (!excluded) {
|
|
178
|
-
|
|
179
|
-
data.templateData.customHTML =
|
|
180
|
-
HEAD_PRECONNECTS + '\n' +
|
|
181
|
-
EZOIC_SCRIPTS + '\n' +
|
|
182
|
-
serializeInlineConfig(cfg) +
|
|
183
|
-
(data.templateData.customHTML || '');
|
|
172
|
+
// Préfixer : nos scripts d'abord, puis le customHTML existant de l'admin
|
|
173
|
+
data.templateData.customHTML = EZOIC_SCRIPTS + (data.templateData.customHTML || '');
|
|
184
174
|
}
|
|
185
|
-
} catch (
|
|
186
|
-
// Log but don't break rendering
|
|
187
|
-
console.error('[ezoic-infinite] injectEzoicHead error:', err.message);
|
|
188
|
-
}
|
|
175
|
+
} catch (_) {}
|
|
189
176
|
return data;
|
|
190
177
|
};
|
|
191
178
|
|