nodebb-plugin-ezoic-infinite 1.8.42 → 1.8.44
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 +20 -3
- package/package.json +1 -1
- package/public/client.js +356 -509
package/library.js
CHANGED
|
@@ -141,11 +141,12 @@ const HEAD_PRECONNECTS = [
|
|
|
141
141
|
const EZOIC_SCRIPTS = [
|
|
142
142
|
'<script data-cfasync="false" src="https://cmp.gatekeeperconsent.com/min.js"></script>',
|
|
143
143
|
'<script data-cfasync="false" src="https://the.gatekeeperconsent.com/cmp.min.js"></script>',
|
|
144
|
-
'<script async src="//www.ezojs.com/ezoic/sa.min.js"></script>',
|
|
145
144
|
'<script>',
|
|
145
|
+
'window._ezaq = window._ezaq || {};',
|
|
146
146
|
'window.ezstandalone = window.ezstandalone || {};',
|
|
147
147
|
'ezstandalone.cmd = ezstandalone.cmd || [];',
|
|
148
148
|
'</script>',
|
|
149
|
+
'<script async src="//www.ezojs.com/ezoic/sa.min.js"></script>',
|
|
149
150
|
].join('\n');
|
|
150
151
|
|
|
151
152
|
// ── Hooks ────────────────────────────────────────────────────────────────────
|
|
@@ -173,7 +174,24 @@ plugin.injectEzoicHead = async (data) => {
|
|
|
173
174
|
const settings = await getSettings();
|
|
174
175
|
const uid = data.req?.uid ?? 0;
|
|
175
176
|
const excluded = await isUserExcluded(uid, settings.excludedGroups);
|
|
176
|
-
|
|
177
|
+
|
|
178
|
+
if (excluded) {
|
|
179
|
+
// Even for excluded users, inject a minimal stub so that any script
|
|
180
|
+
// referencing ezstandalone doesn't throw a ReferenceError, plus
|
|
181
|
+
// the config with excluded=true so client.js bails early.
|
|
182
|
+
const cfg = buildClientConfig(settings, true);
|
|
183
|
+
const stub = [
|
|
184
|
+
'<script>',
|
|
185
|
+
'window._ezaq = window._ezaq || {};',
|
|
186
|
+
'window.ezstandalone = window.ezstandalone || {};',
|
|
187
|
+
'ezstandalone.cmd = ezstandalone.cmd || [];',
|
|
188
|
+
'</script>',
|
|
189
|
+
].join('\n');
|
|
190
|
+
data.templateData.customHTML =
|
|
191
|
+
stub + '\n' +
|
|
192
|
+
serializeInlineConfig(cfg) +
|
|
193
|
+
(data.templateData.customHTML || '');
|
|
194
|
+
} else {
|
|
177
195
|
const cfg = buildClientConfig(settings, false);
|
|
178
196
|
data.templateData.customHTML =
|
|
179
197
|
HEAD_PRECONNECTS + '\n' +
|
|
@@ -182,7 +200,6 @@ plugin.injectEzoicHead = async (data) => {
|
|
|
182
200
|
(data.templateData.customHTML || '');
|
|
183
201
|
}
|
|
184
202
|
} catch (err) {
|
|
185
|
-
// Log but don't break rendering
|
|
186
203
|
console.error('[ezoic-infinite] injectEzoicHead error:', err.message);
|
|
187
204
|
}
|
|
188
205
|
return data;
|