diff --git a/apps/api-server/src/util/react-check.js b/apps/api-server/src/util/react-check.js index 4177856c3..7144705ec 100644 --- a/apps/api-server/src/util/react-check.js +++ b/apps/api-server/src/util/react-check.js @@ -18,8 +18,9 @@ module.exports = ` function checkReactDom() { if (!hasReactDom && !window.OpenStadReactDOMLoaded) { - + console.log ('!hasReactDom && !window.OpenStadReactDOMLoaded'); if (window.OpenStadReactDOMIsLoading) { + console.log ('window.OpenStadReactDOMIsLoading'); document.addEventListener('OpenStadReactDomLoaded', renderWidget); return; } @@ -35,6 +36,7 @@ module.exports = ` // Get same version of react-dom as react, ensuring we have a xx.x.x format if (!/18\.\d{1,2}\.\d{1,2}/.test(reactVersion) === false) { + console.log('react version is not 18'); throw new Error('React version 18 is required'); } @@ -48,6 +50,7 @@ module.exports = ` } document.addEventListener('OpenStadReactDomLoaded', renderWidget); triggerEvent('OpenStadReactDomLoaded'); + console.log ('react dom on load'); } document.body.appendChild(script); window.OpenStadReactDOMLoaded = true; @@ -55,13 +58,17 @@ module.exports = ` typeof ReactDOM !== 'undefined' && ReactDOM.version.substr(0, 2) !== '18' ) { + console.log ('react dom not version 18'); throw new Error('ReactDOM version 18 is required'); } else { + console.log ('react dom check else'); window.OpenStadReactDOMLoaded = true; if (typeof window.OpenStadReactDomLoadedEventHasFired === 'undefined' || !window.OpenStadReactDomLoadedEventHasFired) { + console.log ('typeof window.OpenStadReactDomLoadedEventHasFired === undefined || !window.OpenStadReactDomLoadedEventHasFired'); document.addEventListener('OpenStadReactDomLoaded', renderWidget); } else { + console.log ('else van typeof window.OpenStadReactDomLoadedEventHasFired === undefined || !window.OpenStadReactDomLoadedEventHasFired'); renderWidget(); } } @@ -71,6 +78,7 @@ module.exports = ` const hasReactWithScheduler = hasReact && typeof React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED !== 'undefined' && typeof React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Scheduler !== 'undefined' && typeof React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Scheduler.unstable_scheduleCallback !== 'undefined'; const hasReactDom = typeof ReactDOM !== 'undefined'; + if ( hasReact && hasReactWithScheduler && hasReactDom ) { renderWidget(); } else if (!hasReact && !window.OpenStadReactLoaded) { @@ -84,22 +92,30 @@ module.exports = ` document.body.appendChild(script); window.OpenStadReactLoaded = true; } else if (hasReact && React.version.substr(0, 2) < '18') { + console.log ('react version is not 18'); throw new Error('React version 18 is required'); } else if (hasReact && !hasReactWithScheduler && !window.OpenStadReactLoaded) { + console.log ('hasReact && !hasReactWithScheduler && !window.OpenStadReactLoaded'); + console.log ('Loading React 18.3.1 UMD version -- current version is without Scheduler which means React DOM won\\'t load correctly.'); + const script = document.createElement('script'); script.src = '${reactJs}'; script.onload = (e) => { + console.log ('react js onload'); checkReactDom(); } document.body.appendChild(script); window.OpenStadReactLoaded = true; } else { + console.log ('react check else'); if (typeof window.OpenStadReactDomLoadedEventHasFired === 'undefined' || !window.OpenStadReactDomLoadedEventHasFired) { + console.log ('typeof window.OpenStadReactDomLoadedEventHasFired === undefined || !window.OpenStadReactDomLoadedEventHasFired'); // React has been loaded by a previous component on the page, render the widget when ReactDOM is loaded checkReactDom(); } else { + console.log ('else van typeof window.OpenStadReactDomLoadedEventHasFired === undefined || !window.OpenStadReactDomLoadedEventHasFired'); renderWidget(); } } -`; +`; \ No newline at end of file diff --git a/apps/image-server/server.js b/apps/image-server/server.js index 80eeba29d..dac0173f1 100644 --- a/apps/image-server/server.js +++ b/apps/image-server/server.js @@ -19,6 +19,9 @@ const imageMulterConfig = { } cb(null, true); + }, + limits: { + fileSize: 20 * 1024 * 1024, // 20MB max file size } } @@ -47,6 +50,11 @@ const imageSteamConfig = { "cacheArtifacts": process.env.CACHE_ARTIFACTS || true }, }, + "imageLimits": { + "maxInputPixels": 100000000, + "maxWidth": 10000, + "maxHeight": 10000 + }, "throttle": { "ccProcessors": process.env.THROTTLE_CC_PROCESSORS || 4, "ccPrefetchers": process.env.THROTTLE_CC_PREFETCHER || 20, @@ -55,18 +63,27 @@ const imageSteamConfig = { log: { errors: true }, - router: { - originalSteps: { - metadata: { - enabled: 'false', - }, + "router": { + "originalSteps": { + "resize": { + "width": "10000", + "height": "10000", + "max": "true", + "canGrow": "true" + } }, - hqOriginalSteps: { - metadata: { - enabled: 'false', - }, + "hqOriginalSteps": { + "resize": { + "width": "10000", + "height": "10000", + "max": "true", + "canGrow": "true" + } }, }, + processor: { + maxSize: { width: 10000, height: 10000 }, + } }; imageMulterConfig.dest = process.env.IMAGES_DIR || 'images/';