From 62e56dbbdf532b05245151cc48bddd895a7ec6ad Mon Sep 17 00:00:00 2001 From: orfelorfel23 Date: Sat, 8 Aug 2026 15:14:46 +0200 Subject: [PATCH] fix: export VIZ_PRESETS to window and add safe preset fallbacks so event listeners and upload work reliably --- public/app.js | 5 +++-- public/presets.js | 10 ++++++++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/public/app.js b/public/app.js index a2a1870..0c427a0 100644 --- a/public/app.js +++ b/public/app.js @@ -44,7 +44,7 @@ exportAbortController: null, // Active Settings - config: Object.assign({}, window.VIZ_PRESETS.trap_nation) + config: Object.assign({}, (typeof window !== 'undefined' && window.VIZ_PRESETS && window.VIZ_PRESETS.trap_nation) || (typeof VIZ_PRESETS !== 'undefined' && VIZ_PRESETS.trap_nation) || {}) }; // DOM Elements @@ -1106,7 +1106,8 @@ } function applyPreset(presetKeyOrObj) { - let p = typeof presetKeyOrObj === 'string' ? window.VIZ_PRESETS[presetKeyOrObj] : presetKeyOrObj; + const presetsObj = (typeof window !== 'undefined' && window.VIZ_PRESETS) || (typeof VIZ_PRESETS !== 'undefined' ? VIZ_PRESETS : {}); + let p = typeof presetKeyOrObj === 'string' ? presetsObj[presetKeyOrObj] : presetKeyOrObj; if (!p) return; Object.assign(state.config, p); diff --git a/public/presets.js b/public/presets.js index 7ced463..7f8d258 100644 --- a/public/presets.js +++ b/public/presets.js @@ -507,3 +507,13 @@ const VIZ_PRESETS = { showProgressBar: false } }; + +if (typeof window !== 'undefined') { + window.VIZ_PRESETS = VIZ_PRESETS; +} +if (typeof globalThis !== 'undefined') { + globalThis.VIZ_PRESETS = VIZ_PRESETS; +} +if (typeof module !== 'undefined' && module.exports) { + module.exports = VIZ_PRESETS; +}