[Plugins] Allow plugins to still load if they fail to update (#85)

* [Plugins] allow plugins to load if they fail to update
On poor quality networks, plugins can fail to update. This shouldn't mean that they aren't loaded, however.

* [Plugins] Log fetch error to Debug Logs not console

---------

Co-authored-by: Beef <beefers@riseup.net>
This commit is contained in:
Cain Atkinson 2023-05-14 23:09:37 +01:00 committed by GitHub
parent 24d6faa818
commit bc03464da3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -131,7 +131,7 @@ export async function initPlugins() {
if (!settings.safeMode?.enabled) {
// Loop over any plugin that is enabled, update it if allowed, then start it.
await Promise.allSettled(allIds.filter(pl => plugins[pl].enabled).map(async (pl) => (plugins[pl].update && await fetchPlugin(pl), await startPlugin(pl))));
await Promise.allSettled(allIds.filter(pl => plugins[pl].enabled).map(async (pl) => (plugins[pl].update && await fetchPlugin(pl).catch((e: Error) => logger.error(e.message)), await startPlugin(pl))));
// Wait for the above to finish, then update all disabled plugins that are allowed to.
allIds.filter(pl => !plugins[pl].enabled && plugins[pl].update).forEach(pl => fetchPlugin(pl));
};