Handle exception during loading of plugins (#6074)

This commit is contained in:
Stefan 2023-12-17 11:05:32 +00:00 committed by GitHub
parent bfa55e6523
commit d12119d3be
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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')
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);
});
})
}