diff --git a/src/components/confirm/confirm.js b/src/components/confirm/confirm.js index 71d8b5b803..1978324e7c 100644 --- a/src/components/confirm/confirm.js +++ b/src/components/confirm/confirm.js @@ -60,6 +60,6 @@ function customConfirm(text, title) { }); } -const baseConfirm = browser.tv && window.confirm ? nativeConfirm : customConfirm; +const confirm = browser.tv && window.confirm ? nativeConfirm : customConfirm; -export default baseConfirm; +export default confirm; diff --git a/src/components/syncPlay/groupSelectionMenu.js b/src/components/syncPlay/groupSelectionMenu.js index 41c56dbc0f..5168558bb2 100644 --- a/src/components/syncPlay/groupSelectionMenu.js +++ b/src/components/syncPlay/groupSelectionMenu.js @@ -159,7 +159,7 @@ Events.on(syncPlayManager, 'enabled', function (e, enabled) { * Shows a menu to handle SyncPlay groups. * @param {HTMLElement} button - Element where to place the menu. */ -export default function show (button) { +export function show (button) { loading.show(); // TODO: should feature be disabled if playback permission is missing? diff --git a/src/config.json b/src/config.json index 5de5b03674..1be3bb7692 100644 --- a/src/config.json +++ b/src/config.json @@ -29,18 +29,18 @@ "https://repo.jellyfin.org/releases/other/jellyfin-noto/css/SC.css" ], "plugins": [ - "plugins/playAccessValidation/plugin", - "plugins/experimentalWarnings/plugin", - "plugins/htmlAudioPlayer/plugin", - "plugins/htmlVideoPlayer/plugin", - "plugins/photoPlayer/plugin", - "plugins/comicsPlayer/plugin", - "plugins/bookPlayer/plugin", - "plugins/youtubePlayer/plugin", - "plugins/backdropScreensaver/plugin", - "plugins/pdfPlayer/plugin", - "plugins/logoScreensaver/plugin", - "plugins/sessionPlayer/plugin", - "plugins/chromecastPlayer/plugin" + "playAccessValidation/plugin", + "experimentalWarnings/plugin", + "htmlAudioPlayer/plugin", + "htmlVideoPlayer/plugin", + "photoPlayer/plugin", + "comicsPlayer/plugin", + "bookPlayer/plugin", + "youtubePlayer/plugin", + "backdropScreensaver/plugin", + "pdfPlayer/plugin", + "logoScreensaver/plugin", + "sessionPlayer/plugin", + "chromecastPlayer/plugin" ] } diff --git a/src/controllers/itemDetails/index.js b/src/controllers/itemDetails/index.js index 48447a7b4a..18d03166d3 100644 --- a/src/controllers/itemDetails/index.js +++ b/src/controllers/itemDetails/index.js @@ -1856,10 +1856,14 @@ function onTrackSelectionsSubmit(e) { window.ItemDetailPage = new itemDetailPage(); export default function (view, params) { + function getApiClient() { + return params.serverId ? ServerConnections.getApiClient(params.serverId) : ApiClient; + } + function reload(instance, page, params) { loading.show(); - const apiClient = params.serverId ? ServerConnections.getApiClient(params.serverId) : ApiClient; + const apiClient = getApiClient(); Promise.all([getPromise(apiClient, params), apiClient.getCurrentUser()]).then(([item, user]) => { currentItem = item; @@ -1955,7 +1959,7 @@ export default function (view, params) { function onDownloadClick() { import('../../scripts/fileDownloader').then(({ default: fileDownloader }) => { - const downloadHref = apiClient.getItemDownloadUrl(currentItem.Id); + const downloadHref = getApiClient().getItemDownloadUrl(currentItem.Id); fileDownloader.download([{ url: downloadHref, itemId: currentItem.Id, @@ -1968,6 +1972,8 @@ export default function (view, params) { const button = this; let selectedItem = view.querySelector('.selectSource').value || currentItem.Id; + const apiClient = getApiClient(); + apiClient.getItem(apiClient.getCurrentUserId(), selectedItem).then(function (item) { selectedItem = item; @@ -2007,7 +2013,7 @@ export default function (view, params) { let currentItem; const self = this; - const apiClient = params.serverId ? ServerConnections.getApiClient(params.serverId) : ApiClient; + const apiClient = getApiClient(); const btnResume = view.querySelector('.mainDetailButtons .btnResume'); const btnPlay = view.querySelector('.mainDetailButtons .btnPlay'); diff --git a/src/controllers/playback/video/index.js b/src/controllers/playback/video/index.js index ca58676135..62c4769646 100644 --- a/src/controllers/playback/video/index.js +++ b/src/controllers/playback/video/index.js @@ -1335,9 +1335,7 @@ import { appRouter } from '../../../components/appRouter'; passive: true }); } catch (e) { - import('../../../components/appRouter').then(({default: appRouter}) => { - appRouter.goHome(); - }); + appRouter.goHome(); } }); view.addEventListener('viewbeforehide', function () { diff --git a/src/scripts/clientUtils.js b/src/scripts/clientUtils.js index 9706943925..0587f6e4cd 100644 --- a/src/scripts/clientUtils.js +++ b/src/scripts/clientUtils.js @@ -126,14 +126,12 @@ export function alert(options) { } export function capabilities(appHost) { - let capabilities = { + return Object.assign({ PlayableMediaTypes: ['Audio', 'Video'], SupportedCommands: ['MoveUp', 'MoveDown', 'MoveLeft', 'MoveRight', 'PageUp', 'PageDown', 'PreviousLetter', 'NextLetter', 'ToggleOsd', 'ToggleContextMenu', 'Select', 'Back', 'SendKey', 'SendString', 'GoHome', 'GoToSettings', 'VolumeUp', 'VolumeDown', 'Mute', 'Unmute', 'ToggleMute', 'SetVolume', 'SetAudioStreamIndex', 'SetSubtitleStreamIndex', 'DisplayContent', 'GoToSearch', 'DisplayMessage', 'SetRepeatMode', 'SetShuffleQueue', 'ChannelUp', 'ChannelDown', 'PlayMediaSource', 'PlayTrailers'], SupportsPersistentIdentifier: window.appMode === 'cordova' || window.appMode === 'android', SupportsMediaControl: true - }; - appHost.getPushTokenInfo(); - return capabilities = Object.assign(capabilities, appHost.getPushTokenInfo()); + }, appHost.getPushTokenInfo()); } export function selectServer() { diff --git a/src/scripts/libraryMenu.js b/src/scripts/libraryMenu.js index 59deece9f4..5cca1d09e4 100644 --- a/src/scripts/libraryMenu.js +++ b/src/scripts/libraryMenu.js @@ -7,7 +7,7 @@ import { appRouter } from '../components/appRouter'; import { appHost } from '../components/apphost'; import { playbackManager } from '../components/playback/playbackmanager'; import syncPlayManager from '../components/syncPlay/syncPlayManager'; -import groupSelectionMenu from '../components/syncPlay/groupSelectionMenu'; +import { show as groupSelectionMenuShow } from '../components/syncPlay/groupSelectionMenu'; import browser from './browser'; import globalize from './globalize'; import imageHelper from './imagehelper'; @@ -229,7 +229,7 @@ import ServerConnections from '../components/ServerConnections'; function onSyncButtonClicked() { const btn = this; - groupSelectionMenu.show(btn); + groupSelectionMenuShow(btn); } function onSyncPlayEnabled(event, enabled) { @@ -814,9 +814,9 @@ import ServerConnections from '../components/ServerConnections'; if (user) { Promise.resolve(user); } else { - ServerConnections.user(getCurrentApiClient()).then(function (user) { - refreshLibraryInfoInDrawer(user); - updateLibraryMenu(user.localUser); + ServerConnections.user(getCurrentApiClient()).then(function (userResult) { + refreshLibraryInfoInDrawer(userResult); + updateLibraryMenu(userResult.localUser); }); } } @@ -990,9 +990,9 @@ import ServerConnections from '../components/ServerConnections'; loadNavDrawer(); - ServerConnections.user(currentApiClient).then(function (user) { - currentUser = user; - updateUserInHeader(user); + ServerConnections.user(currentApiClient).then(function (userResult) { + currentUser = userResult; + updateUserInHeader(userResult); }); }); diff --git a/src/scripts/site.js b/src/scripts/site.js index 8f42ca60e0..3143c96546 100644 --- a/src/scripts/site.js +++ b/src/scripts/site.js @@ -112,7 +112,7 @@ function init() { function onGlobalizeInit() { if (window.appMode === 'android') { if (window.location.href.toString().toLowerCase().indexOf('start=backgroundsync') !== -1) { - return onAppReady(browser); + return onAppReady(); } } @@ -128,12 +128,12 @@ function onGlobalizeInit() { import('../assets/css/librarybrowser.css'); - loadPlugins(appHost, browser).then(function () { - onAppReady(browser); + loadPlugins().then(function () { + onAppReady(); }); } -function loadPlugins(appHost, browser, shell) { +function loadPlugins() { console.groupCollapsed('loading installed plugins'); console.dir(pluginManager); return getPlugins().then(function (list) { @@ -167,7 +167,7 @@ function loadPlugins(appHost, browser, shell) { }); } -function onAppReady(browser) { +function onAppReady() { console.debug('begin onAppReady'); console.debug('onAppReady: loading dependencies');