mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-02-01 03:12:42 +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');
|
await hooks.aCallAll('restartServer');
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const headers = {
|
||||||
|
'User-Agent': 'Etherpad/' + settings.getEpVersion(),
|
||||||
|
}
|
||||||
|
|
||||||
let tasks = 0;
|
let tasks = 0;
|
||||||
|
|
||||||
const wrapTaskCb = (cb) => {
|
const wrapTaskCb = (cb) => {
|
||||||
|
@ -77,12 +81,15 @@ exports.getAvailablePlugins = (maxCacheAge) => {
|
||||||
return resolve(exports.availablePlugins);
|
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 => {
|
.then(pluginsLoaded => {
|
||||||
exports.availablePlugins = pluginsLoaded.data;
|
exports.availablePlugins = pluginsLoaded.data;
|
||||||
cacheTimestamp = nowTimestamp;
|
cacheTimestamp = nowTimestamp;
|
||||||
resolve(exports.availablePlugins);
|
resolve(exports.availablePlugins);
|
||||||
})
|
})
|
||||||
|
.catch(async err => {
|
||||||
|
return reject(err);
|
||||||
|
});
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue