diff --git a/apps/common/main/lib/util/utils.js b/apps/common/main/lib/util/utils.js index dd8d04051..b6bcf8b26 100644 --- a/apps/common/main/lib/util/utils.js +++ b/apps/common/main/lib/util/utils.js @@ -738,6 +738,19 @@ Common.Utils.getConfigJson = function (url) { return null; } +Common.Utils.loadConfig = function(url, callback) { + "use strict"; + + fetch(url) + .then(function(response){ + if ( response.ok ) + return response.json(); + else return 'error'; + }).then(function(json){ + callback(json); + }); +}; + Common.Utils.asyncCall = function (callback, scope, args) { (new Promise(function (resolve, reject) { resolve(); diff --git a/apps/documenteditor/main/app/controller/Main.js b/apps/documenteditor/main/app/controller/Main.js index 999f4001b..e8f758466 100644 --- a/apps/documenteditor/main/app/controller/Main.js +++ b/apps/documenteditor/main/app/controller/Main.js @@ -2054,12 +2054,18 @@ define([ if (!pluginsPath) return; var config_plugins = (this.plugins && this.plugins.pluginsData && this.plugins.pluginsData.length>0) ? this.updatePlugins(this.plugins, false) : null, // return plugins object - request_plugins = this.updatePlugins( Common.Utils.getConfigJson(pluginsPath), false ); + request_plugins /*= this.updatePlugins( Common.Utils.getConfigJson(pluginsPath), false )*/; - this.updatePluginsList({ - autostart: (config_plugins&&config_plugins.autostart ? config_plugins.autostart : []).concat(request_plugins&&request_plugins.autostart ? request_plugins.autostart : []), - pluginsData: (config_plugins ? config_plugins.pluginsData : []).concat(request_plugins ? request_plugins.pluginsData : []) - }, false); + var me = this; + Common.Utils.loadConfig(pluginsPath, function(json) { + if (json != 'error') { + request_plugins = me.updatePlugins(json); + me.updatePluginsList({ + autostart: (config_plugins&&config_plugins.autostart ? config_plugins.autostart : []).concat(request_plugins&&request_plugins.autostart ? request_plugins.autostart : []), + pluginsData: (config_plugins ? config_plugins.pluginsData : []).concat(request_plugins ? request_plugins.pluginsData : []) + }, false); + } + }); }, updatePlugins: function(plugins, uiCustomize) { // plugins from config