From d12119d3beb7635506b92ae00f85af54c1be2c0d Mon Sep 17 00:00:00 2001 From: Stefan Date: Sun, 17 Dec 2023 11:05:32 +0000 Subject: [PATCH] Handle exception during loading of plugins (#6074) --- src/static/js/pluginfw/installer.js | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/src/static/js/pluginfw/installer.js b/src/static/js/pluginfw/installer.js index 6c5784b00..d0e9dab6c 100644 --- a/src/static/js/pluginfw/installer.js +++ b/src/static/js/pluginfw/installer.js @@ -15,6 +15,10 @@ const onAllTasksFinished = async () => { await hooks.aCallAll('restartServer'); }; +const headers = { + 'User-Agent': 'Etherpad/' + settings.getEpVersion(), +} + let tasks = 0; const wrapTaskCb = (cb) => { @@ -77,12 +81,15 @@ exports.getAvailablePlugins = (maxCacheAge) => { return resolve(exports.availablePlugins); } - await axios.get('https://static.etherpad.org/plugins.json') - .then(pluginsLoaded => { - exports.availablePlugins = pluginsLoaded.data; - cacheTimestamp = nowTimestamp; - resolve(exports.availablePlugins); - }) + await axios.get('https://static.etherpad.org/plugins.json', {headers: headers}) + .then(pluginsLoaded => { + exports.availablePlugins = pluginsLoaded.data; + cacheTimestamp = nowTimestamp; + resolve(exports.availablePlugins); + }) + .catch(async err => { + return reject(err); + }); }) }