nodebb-plugin-ezoic-infinite 1.8.41 → 1.8.43
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 +21 -5
- package/package.json +1 -1
- package/public/client.js +300 -630
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>',
|
|
145
144
|
'<script>',
|
|
145
|
+
'window._ezaq = window._ezaq || {};',
|
|
146
146
|
'window.ezstandalone = window.ezstandalone || {};',
|
|
147
|
-
|
|
148
|
-
'window.ezstandalone.cmd = window.ezstandalone.cmd || [];',
|
|
147
|
+
'ezstandalone.cmd = ezstandalone.cmd || [];',
|
|
149
148
|
'</script>',
|
|
149
|
+
'<script async src="//www.ezojs.com/ezoic/sa.min.js"></script>',
|
|
150
150
|
].join('\n');
|
|
151
151
|
|
|
152
152
|
// ── Hooks ────────────────────────────────────────────────────────────────────
|
|
@@ -174,7 +174,24 @@ 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
|
-
|
|
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 {
|
|
178
195
|
const cfg = buildClientConfig(settings, false);
|
|
179
196
|
data.templateData.customHTML =
|
|
180
197
|
HEAD_PRECONNECTS + '\n' +
|
|
@@ -183,7 +200,6 @@ plugin.injectEzoicHead = async (data) => {
|
|
|
183
200
|
(data.templateData.customHTML || '');
|
|
184
201
|
}
|
|
185
202
|
} catch (err) {
|
|
186
|
-
// Log but don't break rendering
|
|
187
203
|
console.error('[ezoic-infinite] injectEzoicHead error:', err.message);
|
|
188
204
|
}
|
|
189
205
|
return data;
|