mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
fixed some code smells
fix config.json plugins path
This commit is contained in:
parent
327462321c
commit
6638c13e85
8 changed files with 41 additions and 39 deletions
|
@ -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;
|
||||
|
|
|
@ -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?
|
||||
|
|
|
@ -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"
|
||||
]
|
||||
}
|
||||
|
|
|
@ -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');
|
||||
|
|
|
@ -1335,9 +1335,7 @@ import { appRouter } from '../../../components/appRouter';
|
|||
passive: true
|
||||
});
|
||||
} catch (e) {
|
||||
import('../../../components/appRouter').then(({default: appRouter}) => {
|
||||
appRouter.goHome();
|
||||
});
|
||||
}
|
||||
});
|
||||
view.addEventListener('viewbeforehide', function () {
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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);
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -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');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue