From 79029f0ff9f64afa1eb18bec056a8ba203091e34 Mon Sep 17 00:00:00 2001 From: Debdut Chakraborty Date: Sat, 9 Dec 2023 04:52:10 +0530 Subject: [PATCH] fix: initial stuck client if root_url is wrong (#30913) --- apps/meteor/server/startup/initialData.js | 30 +++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/apps/meteor/server/startup/initialData.js b/apps/meteor/server/startup/initialData.js index 61fbdf9f3328..58fc3bf91577 100644 --- a/apps/meteor/server/startup/initialData.js +++ b/apps/meteor/server/startup/initialData.js @@ -13,6 +13,36 @@ import { validateEmail } from '../../lib/emailValidator'; import { addUserRolesAsync } from '../lib/roles/addUserRoles'; Meteor.startup(async () => { + const dynamicImport = { + 'dynamic-import': { + useLocationOrigin: true, + }, + }; + + if (!Meteor.settings) { + Meteor.settings = { + public: { + packages: { + 'dynamic-import': dynamicImport, + }, + }, + }; + } + + if (!Meteor.settings.public) { + Meteor.settings.public = { + packages: { + 'dynamic-import': dynamicImport, + }, + }; + } + + if (!Meteor.settings.public.packages) { + Meteor.settings.public.packages = dynamicImport; + } + + Meteor.settings.public.packages['dynamic-import'] = dynamicImport['dynamic-import']; + if (!settings.get('Initial_Channel_Created')) { const exists = await Rooms.findOneById('GENERAL', { projection: { _id: 1 } }); if (!exists) {