nodebb-plugin-ezoic-infinite 1.8.45 → 1.8.46
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 +5 -21
- package/package.json +1 -1
- package/public/client.js +631 -337
package/library.js
CHANGED
|
@@ -141,12 +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>',
|
|
144
145
|
'<script>',
|
|
145
|
-
'window._ezaq = window._ezaq || {};',
|
|
146
146
|
'window.ezstandalone = window.ezstandalone || {};',
|
|
147
|
-
|
|
147
|
+
// Always reference through window to avoid ReferenceError in stricter contexts
|
|
148
|
+
'window.ezstandalone.cmd = window.ezstandalone.cmd || [];',
|
|
148
149
|
'</script>',
|
|
149
|
-
'<script async src="//www.ezojs.com/ezoic/sa.min.js"></script>',
|
|
150
150
|
].join('\n');
|
|
151
151
|
|
|
152
152
|
// ── Hooks ────────────────────────────────────────────────────────────────────
|
|
@@ -174,24 +174,7 @@ plugin.injectEzoicHead = async (data) => {
|
|
|
174
174
|
const settings = await getSettings();
|
|
175
175
|
const uid = data.req?.uid ?? 0;
|
|
176
176
|
const excluded = await isUserExcluded(uid, settings.excludedGroups);
|
|
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
|
+
if (!excluded) {
|
|
195
178
|
const cfg = buildClientConfig(settings, false);
|
|
196
179
|
data.templateData.customHTML =
|
|
197
180
|
HEAD_PRECONNECTS + '\n' +
|
|
@@ -200,6 +183,7 @@ plugin.injectEzoicHead = async (data) => {
|
|
|
200
183
|
(data.templateData.customHTML || '');
|
|
201
184
|
}
|
|
202
185
|
} catch (err) {
|
|
186
|
+
// Log but don't break rendering
|
|
203
187
|
console.error('[ezoic-infinite] injectEzoicHead error:', err.message);
|
|
204
188
|
}
|
|
205
189
|
return data;
|