1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

Use async for loadPlugins

This commit is contained in:
Bill Thornton 2024-08-14 16:22:40 -04:00
parent 741c612920
commit ab0fa6cfe6

View file

@ -120,33 +120,34 @@ function loadFonts() {
} }
} }
function loadPlugins() { async function loadPlugins() {
console.groupCollapsed('loading installed plugins'); console.groupCollapsed('loading installed plugins');
console.dir(pluginManager); console.dir(pluginManager);
return getPlugins().then(function (list) {
if (!appHost.supports('remotecontrol')) {
// Disable remote player plugins if not supported
list = list.filter(plugin => !plugin.startsWith('sessionPlayer')
&& !plugin.startsWith('chromecastPlayer'));
} else if (!browser.chrome && !browser.edgeChromium && !browser.opera) {
// Disable chromecast player in unsupported browsers
list = list.filter(plugin => !plugin.startsWith('chromecastPlayer'));
}
// add any native plugins let list = await getPlugins();
if (window.NativeShell) { if (!appHost.supports('remotecontrol')) {
list = list.concat(window.NativeShell.getPlugins()); // Disable remote player plugins if not supported
} list = list.filter(plugin => !plugin.startsWith('sessionPlayer')
&& !plugin.startsWith('chromecastPlayer'));
} else if (!browser.chrome && !browser.edgeChromium && !browser.opera) {
// Disable chromecast player in unsupported browsers
list = list.filter(plugin => !plugin.startsWith('chromecastPlayer'));
}
Promise.all(list.map(plugin => pluginManager.loadPlugin(plugin))) // add any native plugins
.then(() => console.debug('finished loading plugins')) if (window.NativeShell) {
.catch(e => console.warn('failed loading plugins', e)) list = list.concat(window.NativeShell.getPlugins());
.finally(() => { }
console.groupEnd('loading installed plugins');
packageManager.init(); try {
}) await Promise.all(list.map(plugin => pluginManager.loadPlugin(plugin)));
; console.debug('finished loading plugins');
}); } catch (e) {
console.warn('failed loading plugins', e);
}
console.groupEnd('loading installed plugins');
packageManager.init();
} }
function loadPlatformFeatures() { function loadPlatformFeatures() {