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.
|
* Shows a menu to handle SyncPlay groups.
|
||||||
* @param {HTMLElement} button - Element where to place the menu.
|
* @param {HTMLElement} button - Element where to place the menu.
|
||||||
*/
|
*/
|
||||||
export default function show (button) {
|
export function show (button) {
|
||||||
loading.show();
|
loading.show();
|
||||||
|
|
||||||
// TODO: should feature be disabled if playback permission is missing?
|
// 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"
|
"https://repo.jellyfin.org/releases/other/jellyfin-noto/css/SC.css"
|
||||||
],
|
],
|
||||||
"plugins": [
|
"plugins": [
|
||||||
"plugins/playAccessValidation/plugin",
|
"playAccessValidation/plugin",
|
||||||
"plugins/experimentalWarnings/plugin",
|
"experimentalWarnings/plugin",
|
||||||
"plugins/htmlAudioPlayer/plugin",
|
"htmlAudioPlayer/plugin",
|
||||||
"plugins/htmlVideoPlayer/plugin",
|
"htmlVideoPlayer/plugin",
|
||||||
"plugins/photoPlayer/plugin",
|
"photoPlayer/plugin",
|
||||||
"plugins/comicsPlayer/plugin",
|
"comicsPlayer/plugin",
|
||||||
"plugins/bookPlayer/plugin",
|
"bookPlayer/plugin",
|
||||||
"plugins/youtubePlayer/plugin",
|
"youtubePlayer/plugin",
|
||||||
"plugins/backdropScreensaver/plugin",
|
"backdropScreensaver/plugin",
|
||||||
"plugins/pdfPlayer/plugin",
|
"pdfPlayer/plugin",
|
||||||
"plugins/logoScreensaver/plugin",
|
"logoScreensaver/plugin",
|
||||||
"plugins/sessionPlayer/plugin",
|
"sessionPlayer/plugin",
|
||||||
"plugins/chromecastPlayer/plugin"
|
"chromecastPlayer/plugin"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -1856,10 +1856,14 @@ function onTrackSelectionsSubmit(e) {
|
||||||
window.ItemDetailPage = new itemDetailPage();
|
window.ItemDetailPage = new itemDetailPage();
|
||||||
|
|
||||||
export default function (view, params) {
|
export default function (view, params) {
|
||||||
|
function getApiClient() {
|
||||||
|
return params.serverId ? ServerConnections.getApiClient(params.serverId) : ApiClient;
|
||||||
|
}
|
||||||
|
|
||||||
function reload(instance, page, params) {
|
function reload(instance, page, params) {
|
||||||
loading.show();
|
loading.show();
|
||||||
|
|
||||||
const apiClient = params.serverId ? ServerConnections.getApiClient(params.serverId) : ApiClient;
|
const apiClient = getApiClient();
|
||||||
|
|
||||||
Promise.all([getPromise(apiClient, params), apiClient.getCurrentUser()]).then(([item, user]) => {
|
Promise.all([getPromise(apiClient, params), apiClient.getCurrentUser()]).then(([item, user]) => {
|
||||||
currentItem = item;
|
currentItem = item;
|
||||||
|
@ -1955,7 +1959,7 @@ export default function (view, params) {
|
||||||
|
|
||||||
function onDownloadClick() {
|
function onDownloadClick() {
|
||||||
import('../../scripts/fileDownloader').then(({ default: fileDownloader }) => {
|
import('../../scripts/fileDownloader').then(({ default: fileDownloader }) => {
|
||||||
const downloadHref = apiClient.getItemDownloadUrl(currentItem.Id);
|
const downloadHref = getApiClient().getItemDownloadUrl(currentItem.Id);
|
||||||
fileDownloader.download([{
|
fileDownloader.download([{
|
||||||
url: downloadHref,
|
url: downloadHref,
|
||||||
itemId: currentItem.Id,
|
itemId: currentItem.Id,
|
||||||
|
@ -1968,6 +1972,8 @@ export default function (view, params) {
|
||||||
const button = this;
|
const button = this;
|
||||||
let selectedItem = view.querySelector('.selectSource').value || currentItem.Id;
|
let selectedItem = view.querySelector('.selectSource').value || currentItem.Id;
|
||||||
|
|
||||||
|
const apiClient = getApiClient();
|
||||||
|
|
||||||
apiClient.getItem(apiClient.getCurrentUserId(), selectedItem).then(function (item) {
|
apiClient.getItem(apiClient.getCurrentUserId(), selectedItem).then(function (item) {
|
||||||
selectedItem = item;
|
selectedItem = item;
|
||||||
|
|
||||||
|
@ -2007,7 +2013,7 @@ export default function (view, params) {
|
||||||
|
|
||||||
let currentItem;
|
let currentItem;
|
||||||
const self = this;
|
const self = this;
|
||||||
const apiClient = params.serverId ? ServerConnections.getApiClient(params.serverId) : ApiClient;
|
const apiClient = getApiClient();
|
||||||
|
|
||||||
const btnResume = view.querySelector('.mainDetailButtons .btnResume');
|
const btnResume = view.querySelector('.mainDetailButtons .btnResume');
|
||||||
const btnPlay = view.querySelector('.mainDetailButtons .btnPlay');
|
const btnPlay = view.querySelector('.mainDetailButtons .btnPlay');
|
||||||
|
|
|
@ -1335,9 +1335,7 @@ import { appRouter } from '../../../components/appRouter';
|
||||||
passive: true
|
passive: true
|
||||||
});
|
});
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
import('../../../components/appRouter').then(({default: appRouter}) => {
|
appRouter.goHome();
|
||||||
appRouter.goHome();
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
view.addEventListener('viewbeforehide', function () {
|
view.addEventListener('viewbeforehide', function () {
|
||||||
|
|
|
@ -126,14 +126,12 @@ export function alert(options) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function capabilities(appHost) {
|
export function capabilities(appHost) {
|
||||||
let capabilities = {
|
return Object.assign({
|
||||||
PlayableMediaTypes: ['Audio', 'Video'],
|
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'],
|
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',
|
SupportsPersistentIdentifier: window.appMode === 'cordova' || window.appMode === 'android',
|
||||||
SupportsMediaControl: true
|
SupportsMediaControl: true
|
||||||
};
|
}, appHost.getPushTokenInfo());
|
||||||
appHost.getPushTokenInfo();
|
|
||||||
return capabilities = Object.assign(capabilities, appHost.getPushTokenInfo());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export function selectServer() {
|
export function selectServer() {
|
||||||
|
|
|
@ -7,7 +7,7 @@ import { appRouter } from '../components/appRouter';
|
||||||
import { appHost } from '../components/apphost';
|
import { appHost } from '../components/apphost';
|
||||||
import { playbackManager } from '../components/playback/playbackmanager';
|
import { playbackManager } from '../components/playback/playbackmanager';
|
||||||
import syncPlayManager from '../components/syncPlay/syncPlayManager';
|
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 browser from './browser';
|
||||||
import globalize from './globalize';
|
import globalize from './globalize';
|
||||||
import imageHelper from './imagehelper';
|
import imageHelper from './imagehelper';
|
||||||
|
@ -229,7 +229,7 @@ import ServerConnections from '../components/ServerConnections';
|
||||||
|
|
||||||
function onSyncButtonClicked() {
|
function onSyncButtonClicked() {
|
||||||
const btn = this;
|
const btn = this;
|
||||||
groupSelectionMenu.show(btn);
|
groupSelectionMenuShow(btn);
|
||||||
}
|
}
|
||||||
|
|
||||||
function onSyncPlayEnabled(event, enabled) {
|
function onSyncPlayEnabled(event, enabled) {
|
||||||
|
@ -814,9 +814,9 @@ import ServerConnections from '../components/ServerConnections';
|
||||||
if (user) {
|
if (user) {
|
||||||
Promise.resolve(user);
|
Promise.resolve(user);
|
||||||
} else {
|
} else {
|
||||||
ServerConnections.user(getCurrentApiClient()).then(function (user) {
|
ServerConnections.user(getCurrentApiClient()).then(function (userResult) {
|
||||||
refreshLibraryInfoInDrawer(user);
|
refreshLibraryInfoInDrawer(userResult);
|
||||||
updateLibraryMenu(user.localUser);
|
updateLibraryMenu(userResult.localUser);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -990,9 +990,9 @@ import ServerConnections from '../components/ServerConnections';
|
||||||
|
|
||||||
loadNavDrawer();
|
loadNavDrawer();
|
||||||
|
|
||||||
ServerConnections.user(currentApiClient).then(function (user) {
|
ServerConnections.user(currentApiClient).then(function (userResult) {
|
||||||
currentUser = user;
|
currentUser = userResult;
|
||||||
updateUserInHeader(user);
|
updateUserInHeader(userResult);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -112,7 +112,7 @@ function init() {
|
||||||
function onGlobalizeInit() {
|
function onGlobalizeInit() {
|
||||||
if (window.appMode === 'android') {
|
if (window.appMode === 'android') {
|
||||||
if (window.location.href.toString().toLowerCase().indexOf('start=backgroundsync') !== -1) {
|
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');
|
import('../assets/css/librarybrowser.css');
|
||||||
|
|
||||||
loadPlugins(appHost, browser).then(function () {
|
loadPlugins().then(function () {
|
||||||
onAppReady(browser);
|
onAppReady();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function loadPlugins(appHost, browser, shell) {
|
function loadPlugins() {
|
||||||
console.groupCollapsed('loading installed plugins');
|
console.groupCollapsed('loading installed plugins');
|
||||||
console.dir(pluginManager);
|
console.dir(pluginManager);
|
||||||
return getPlugins().then(function (list) {
|
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('begin onAppReady');
|
||||||
|
|
||||||
console.debug('onAppReady: loading dependencies');
|
console.debug('onAppReady: loading dependencies');
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue