mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-01-31 19:02:59 +01:00
Handle exception during loading of plugins (#6074)
This commit is contained in:
parent
bfa55e6523
commit
d12119d3be
1 changed files with 13 additions and 6 deletions
|
@ -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);
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue