From e525a46068cc586f81d4af5a4e3b331c629f5b17 Mon Sep 17 00:00:00 2001 From: vitorsemeano Date: Sat, 17 Oct 2020 20:04:52 +0100 Subject: [PATCH] bug fixed plugins load bug fixed with import browserDeviceProfile --- src/components/apphost.js | 21 ++++++++++----------- src/components/pluginManager.js | 3 +-- src/scripts/browserDeviceProfile.js | 2 +- 3 files changed, 12 insertions(+), 14 deletions(-) diff --git a/src/components/apphost.js b/src/components/apphost.js index 08bb68ae5..e90b5a787 100644 --- a/src/components/apphost.js +++ b/src/components/apphost.js @@ -5,6 +5,7 @@ import { Events } from 'jellyfin-apiclient'; import * as htmlMediaHelper from '../components/htmlMediaHelper'; import * as webSettings from '../scripts/settings/webSettings'; import globalize from '../scripts/globalize'; +import profileBuilder from '../scripts/browserDeviceProfile'; function getBaseProfileOptions(item) { const disableHlsVideoAudioCodecs = []; @@ -27,19 +28,17 @@ function getBaseProfileOptions(item) { function getDeviceProfile(item, options = {}) { return new Promise(function (resolve) { - import('../scripts/browserDeviceProfile').then((profileBuilder) => { - let profile; + let profile; - if (window.NativeShell) { - profile = window.NativeShell.AppHost.getDeviceProfile(profileBuilder); - } else { - const builderOpts = getBaseProfileOptions(item); - builderOpts.enableSsaRender = (item && !options.isRetry && appSettings.get('subtitleburnin') !== 'allcomplexformats'); - profile = profileBuilder(builderOpts); - } + if (window.NativeShell) { + profile = window.NativeShell.AppHost.getDeviceProfile(profileBuilder); + } else { + const builderOpts = getBaseProfileOptions(item); + builderOpts.enableSsaRender = (item && !options.isRetry && appSettings.get('subtitleburnin') !== 'allcomplexformats'); + profile = profileBuilder(builderOpts); + } - resolve(profile); - }); + resolve(profile); }); } diff --git a/src/components/pluginManager.js b/src/components/pluginManager.js index 0e3fa842c..9be985dd8 100644 --- a/src/components/pluginManager.js +++ b/src/components/pluginManager.js @@ -81,8 +81,7 @@ import globalize from '../scripts/globalize'; }); } else if (pluginSpec.then) { return pluginSpec.then(({ default: pluginBuilder }) => { - return pluginBuilder(); - }).then((plugin) => { + const plugin = new pluginBuilder; console.debug(`Plugin loaded: ${plugin.id}`); return this.#registerPlugin(plugin); }); diff --git a/src/scripts/browserDeviceProfile.js b/src/scripts/browserDeviceProfile.js index 035186f4f..3988a87dd 100644 --- a/src/scripts/browserDeviceProfile.js +++ b/src/scripts/browserDeviceProfile.js @@ -858,5 +858,5 @@ import browser from './browser'; }); return profile; - }; + } /* eslint-enable indent */