1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00
This commit is contained in:
MrTimscampi 2020-08-16 20:24:45 +02:00 committed by vitorsemeano
parent 96eccd2ecd
commit 7d9208e951
143 changed files with 1000 additions and 1008 deletions

View file

@ -1,14 +1,13 @@
import * as userSettings from './settings/userSettings';
import * as webSettings from './settings/webSettings';
import skinManager from './themeManager';
import connectionManager from 'jellyfin-apiclient';
import events from 'jellyfin-apiclient';
import { ConnectionManager, events } from 'jellyfin-apiclient';
// set the default theme when loading
skinManager.setTheme(userSettings.theme());
// set the saved theme once a user authenticates
events.on(window.connectionManager, 'localusersignedin', function (e, user) {
events.on(ConnectionManager, 'localusersignedin', function (e, user) {
skinManager.setTheme(userSettings.theme());
});

View file

@ -1,7 +1,5 @@
define(['browser'], function (browser) {
'use strict';
browser = browser.default || browser;
import browser from './browser';
/* eslint-disable indent */
function canPlayH264(videoTestElement) {
return !!(videoTestElement.canPlayType && videoTestElement.canPlayType('video/mp4; codecs="avc1.42E01E, mp4a.40.2"').replace(/no/, ''));
@ -294,7 +292,7 @@ define(['browser'], function (browser) {
(browser.tizen && isTizenFhd ? 20000000 : null)));
}
return function (options) {
export default function (options) {
options = options || {};
const physicalAudioChannels = options.audioChannels || (browser.tv || browser.ps4 || browser.xboxOne ? 6 : 2);
@ -861,4 +859,4 @@ define(['browser'], function (browser) {
return profile;
};
});
/* eslint-enable indent */

View file

@ -77,7 +77,7 @@ export function navigate(url, preserveQueryString) {
}
return new Promise(function (resolve, reject) {
import('../components/appRouter').then((appRouter) => {
import('../components/appRouter').then(({ appRouter }) => {
return appRouter.show(url).then(resolve, reject);
});
});

View file

@ -1,7 +1,7 @@
import connectionManager from 'jellyfin-apiclient';
import { ConnectionManager } from 'jellyfin-apiclient';
import confirm from '../components/confirm/confirm';
import appRouter from '../components/appRouter';
import { appRouter } from '../components/appRouter';
import globalize from './globalize';
function alertText(options) {
@ -16,7 +16,7 @@ export function deleteItem(options) {
const item = options.item;
const parentId = item.SeasonId || item.SeriesId || item.ParentId;
const apiClient = window.connectionManager.getApiClient(item.ServerId);
const apiClient = ConnectionManager.getApiClient(item.ServerId);
return confirm({

View file

@ -20,7 +20,7 @@
// # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// # THE SOFTWARE.
import appHost from 'apphost';
import { appHost } from '../components/apphost';
const _GAMEPAD_A_BUTTON_INDEX = 0;
const _GAMEPAD_B_BUTTON_INDEX = 1;

View file

@ -1,5 +1,5 @@
import * as userSettings from './settings/userSettings';
import events from 'jellyfin-apiclient';
import { events } from 'jellyfin-apiclient';
/* eslint-disable indent */
@ -156,6 +156,7 @@ import events from 'jellyfin-apiclient';
});
}
//import('../strings/')
return new Promise(function (resolve, reject) {
if (!filtered.length) {
resolve();
@ -164,24 +165,11 @@ import events from 'jellyfin-apiclient';
let url = filtered[0].path;
url += url.indexOf('?') === -1 ? '?' : '&';
url += 'v=' + cacheParam;
const xhr = new XMLHttpRequest();
xhr.open('GET', url, true);
xhr.onload = function (e) {
if (this.status < 400) {
resolve(JSON.parse(this.response));
} else {
resolve({});
}
};
xhr.onerror = function () {
import(`../strings/${url}`).then((fileContent) => {
resolve(fileContent);
}).catch(() => {
resolve({});
};
xhr.send();
});
});
}
@ -221,6 +209,8 @@ import events from 'jellyfin-apiclient';
}
export function translateHtml(html, module) {
html = html.default || html;
if (!module) {
module = defaultModule();
}

View file

@ -1,8 +1,8 @@
import playbackManager from '../components/playback/playbackmanager';
import { playbackManager } from '../components/playback/playbackmanager';
import focusManager from '../components/focusManager';
import appRouter from '../components/appRouter';
import { appRouter } from '../components/appRouter';
import dom from './dom';
import appHost from '../components/apphost';
import { appHost } from '../components/apphost';
/* eslint-disable indent */

View file

@ -1,4 +1,4 @@
import connectionManager from 'jellyfin-apiclient';
import { ConnectionManager } from 'jellyfin-apiclient';
import listView from '../components/listview/listview';
import cardBuilder from '../components/cardbuilder/cardBuilder';
import imageLoader from '../components/images/imageLoader';
@ -358,7 +358,7 @@ function getItemsFunction(options, item) {
query.Fields += ',' + fields;
}
const apiClient = window.connectionManager.getApiClient(item.ServerId);
const apiClient = ConnectionManager.getApiClient(item.ServerId);
if (query.IncludeItemTypes === 'MusicArtist') {
query.IncludeItemTypes = null;

View file

@ -1,12 +1,11 @@
import dom from './dom';
import layoutManager from '../components/layoutManager';
import inputManager from './inputManager';
import connectionManager from 'jellyfin-apiclient';
import events from 'jellyfin-apiclient';
import { events } from 'jellyfin-apiclient';
import viewManager from '../components/viewManager/viewManager';
import appRouter from '../components/appRouter';
import appHost from '../components/apphost';
import playbackManager from '../components/playback/playbackmanager';
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 browser from './browser';
@ -61,10 +60,10 @@ import '../assets/css/flexstyles.css';
function getCurrentApiClient() {
if (currentUser && currentUser.localUser) {
return window.connectionManager.getApiClient(currentUser.localUser.ServerId);
return window.ConnectionManager.getApiClient(currentUser.localUser.ServerId);
}
return window.connectionManager.currentApiClient();
return window.ConnectionManager.currentApiClient();
}
function lazyLoadViewMenuBarImages() {
@ -775,7 +774,7 @@ import '../assets/css/flexstyles.css';
}
if (requiresUserRefresh) {
window.connectionManager.user(getCurrentApiClient()).then(updateUserInHeader);
window.ConnectionManager.user(getCurrentApiClient()).then(updateUserInHeader);
}
}
@ -813,7 +812,7 @@ import '../assets/css/flexstyles.css';
if (user) {
Promise.resolve(user);
} else {
window.connectionManager.user(getCurrentApiClient()).then(function (user) {
window.ConnectionManager.user(getCurrentApiClient()).then(function (user) {
refreshLibraryInfoInDrawer(user);
updateLibraryMenu(user.localUser);
});
@ -840,8 +839,8 @@ import '../assets/css/flexstyles.css';
navDrawerScrollContainer = navDrawerElement.querySelector('.scrollContainer');
navDrawerScrollContainer.addEventListener('click', onMainDrawerClick);
return new Promise(function (resolve, reject) {
import('../libraries/navdrawer/navdrawer').then((navdrawer) => {
navDrawerInstance = new navdrawer(getNavDrawerOptions());
import('../libraries/navdrawer/navdrawer').then(({ NavigationDrawer }) => {
navDrawerInstance = new NavigationDrawer(getNavDrawerOptions());
if (!layoutManager.tv) {
navDrawerElement.classList.remove('hide');
@ -977,8 +976,10 @@ import '../assets/css/flexstyles.css';
updateLibraryNavLinks(page);
});
events.on(window.connectionManager, 'localusersignedin', function (e, user) {
const currentApiClient = window.connectionManager.getApiClient(user.ServerId);
renderHeader();
events.on(window.ConnectionManager, 'localusersignedin', function (e, user) {
const currentApiClient = window.ConnectionManager.getApiClient(user.ServerId);
currentDrawerType = null;
currentUser = {
@ -987,13 +988,13 @@ import '../assets/css/flexstyles.css';
loadNavDrawer();
window.connectionManager.user(currentApiClient).then(function (user) {
window.ConnectionManager.user(currentApiClient).then(function (user) {
currentUser = user;
updateUserInHeader(user);
});
});
events.on(window.connectionManager, 'localusersignedout', function () {
events.on(window.ConnectionManager, 'localusersignedout', function () {
currentUser = {};
updateUserInHeader();
});

View file

@ -1,8 +1,9 @@
import inputManager from './inputManager';
import focusManager from '../components/focusManager';
import browser from '../scripts/browser';
import layoutManager from '../components/layoutManager';
import events from 'jellyfin-apiclient';
import { events } from 'jellyfin-apiclient';
import dom from '../scripts/dom';
/* eslint-disable indent */

View file

@ -25,7 +25,7 @@ import '../assets/css/detailtable.css';
defineRoute({
alias: '/addserver.html',
path: '/controllers/session/addServer/index.html',
path: 'session/addServer/index.html',
autoFocus: false,
anonymous: true,
startup: true,
@ -34,7 +34,7 @@ import '../assets/css/detailtable.css';
defineRoute({
alias: '/selectserver.html',
path: '/controllers/session/selectServer/index.html',
path: 'session/selectServer/index.html',
autoFocus: false,
anonymous: true,
startup: true,
@ -44,7 +44,7 @@ import '../assets/css/detailtable.css';
defineRoute({
alias: '/login.html',
path: '/controllers/session/login/index.html',
path: 'session/login/index.html',
autoFocus: false,
anonymous: true,
startup: true,
@ -54,7 +54,7 @@ import '../assets/css/detailtable.css';
defineRoute({
alias: '/forgotpassword.html',
path: '/controllers/session/forgotPassword/index.html',
path: 'session/forgotPassword/index.html',
anonymous: true,
startup: true,
controller: 'session/forgotPassword/index'
@ -71,28 +71,28 @@ import '../assets/css/detailtable.css';
defineRoute({
alias: '/mypreferencesmenu.html',
path: '/controllers/user/menu/index.html',
path: 'user/menu/index.html',
autoFocus: false,
controller: 'user/menu/index'
});
defineRoute({
alias: '/myprofile.html',
path: '/controllers/user/profile/index.html',
path: 'user/profile/index.html',
autoFocus: false,
controller: 'user/profile/index'
});
defineRoute({
alias: '/mypreferencesdisplay.html',
path: '/controllers/user/display/index.html',
path: 'user/display/index.html',
autoFocus: false,
controller: 'user/display/index'
});
defineRoute({
alias: '/mypreferenceshome.html',
path: '/controllers/user/home/index.html',
path: 'user/home/index.html',
autoFocus: false,
controller: 'user/home/index'
});
@ -106,21 +106,21 @@ import '../assets/css/detailtable.css';
});
defineRoute({
alias: '/mypreferencesplayback.html',
path: '/controllers/user/playback/index.html',
path: 'user/playback/index.html',
autoFocus: false,
controller: 'user/playback/index'
});
defineRoute({
alias: '/mypreferencessubtitles.html',
path: '/controllers/user/subtitles/index.html',
path: 'user/subtitles/index.html',
autoFocus: false,
controller: 'user/subtitles/index'
});
defineRoute({
alias: '/dashboard.html',
path: '/controllers/dashboard/dashboard.html',
path: 'dashboard/dashboard.html',
autoFocus: false,
roles: 'admin',
controller: 'dashboard/dashboard'
@ -128,7 +128,7 @@ import '../assets/css/detailtable.css';
defineRoute({
alias: '/dashboardgeneral.html',
path: '/controllers/dashboard/general.html',
path: 'dashboard/general.html',
controller: 'dashboard/general',
autoFocus: false,
roles: 'admin'
@ -136,7 +136,7 @@ import '../assets/css/detailtable.css';
defineRoute({
alias: '/networking.html',
path: '/controllers/dashboard/networking.html',
path: 'dashboard/networking.html',
autoFocus: false,
roles: 'admin',
controller: 'dashboard/networking'
@ -144,7 +144,7 @@ import '../assets/css/detailtable.css';
defineRoute({
alias: '/devices.html',
path: '/controllers/dashboard/devices/devices.html',
path: 'dashboard/devices/devices.html',
autoFocus: false,
roles: 'admin',
controller: 'dashboard/devices/devices'
@ -152,7 +152,7 @@ import '../assets/css/detailtable.css';
defineRoute({
alias: '/device.html',
path: '/controllers/dashboard/devices/device.html',
path: 'dashboard/devices/device.html',
autoFocus: false,
roles: 'admin',
controller: 'dashboard/devices/device'
@ -168,7 +168,7 @@ import '../assets/css/detailtable.css';
defineRoute({
alias: '/dlnaprofile.html',
path: '/controllers/dashboard/dlna/profile.html',
path: 'dashboard/dlna/profile.html',
autoFocus: false,
roles: 'admin',
controller: 'dashboard/dlna/profile'
@ -176,7 +176,7 @@ import '../assets/css/detailtable.css';
defineRoute({
alias: '/dlnaprofiles.html',
path: '/controllers/dashboard/dlna/profiles.html',
path: 'dashboard/dlna/profiles.html',
autoFocus: false,
roles: 'admin',
controller: 'dashboard/dlna/profiles'
@ -184,7 +184,7 @@ import '../assets/css/detailtable.css';
defineRoute({
alias: '/dlnasettings.html',
path: '/controllers/dashboard/dlna/settings.html',
path: 'dashboard/dlna/settings.html',
autoFocus: false,
roles: 'admin',
controller: 'dashboard/dlna/settings'
@ -192,7 +192,7 @@ import '../assets/css/detailtable.css';
defineRoute({
alias: '/addplugin.html',
path: '/controllers/dashboard/plugins/add/index.html',
path: 'dashboard/plugins/add/index.html',
autoFocus: false,
roles: 'admin',
controller: 'dashboard/plugins/add/index'
@ -200,7 +200,7 @@ import '../assets/css/detailtable.css';
defineRoute({
alias: '/library.html',
path: '/controllers/dashboard/library.html',
path: 'dashboard/library.html',
autoFocus: false,
roles: 'admin',
controller: 'dashboard/library'
@ -208,7 +208,7 @@ import '../assets/css/detailtable.css';
defineRoute({
alias: '/librarydisplay.html',
path: '/controllers/dashboard/librarydisplay.html',
path: 'dashboard/librarydisplay.html',
autoFocus: false,
roles: 'admin',
controller: 'dashboard/librarydisplay'
@ -216,14 +216,14 @@ import '../assets/css/detailtable.css';
defineRoute({
alias: '/edititemmetadata.html',
path: '/controllers/edititemmetadata.html',
path: 'edititemmetadata.html',
controller: 'edititemmetadata',
autoFocus: false
});
defineRoute({
alias: '/encodingsettings.html',
path: '/controllers/dashboard/encodingsettings.html',
path: 'dashboard/encodingsettings.html',
autoFocus: false,
roles: 'admin',
controller: 'dashboard/encodingsettings'
@ -231,14 +231,14 @@ import '../assets/css/detailtable.css';
defineRoute({
alias: '/log.html',
path: '/controllers/dashboard/logs.html',
path: 'dashboard/logs.html',
roles: 'admin',
controller: 'dashboard/logs'
});
defineRoute({
alias: '/metadataimages.html',
path: '/controllers/dashboard/metadataimages.html',
path: 'dashboard/metadataimages.html',
autoFocus: false,
roles: 'admin',
controller: 'dashboard/metadataImages'
@ -246,7 +246,7 @@ import '../assets/css/detailtable.css';
defineRoute({
alias: '/metadatanfo.html',
path: '/controllers/dashboard/metadatanfo.html',
path: 'dashboard/metadatanfo.html',
autoFocus: false,
roles: 'admin',
controller: 'dashboard/metadatanfo'
@ -254,7 +254,7 @@ import '../assets/css/detailtable.css';
defineRoute({
alias: '/notificationsetting.html',
path: '/controllers/dashboard/notifications/notification/index.html',
path: 'dashboard/notifications/notification/index.html',
autoFocus: false,
roles: 'admin',
controller: 'dashboard/notifications/notification/index'
@ -262,7 +262,7 @@ import '../assets/css/detailtable.css';
defineRoute({
alias: '/notificationsettings.html',
path: '/controllers/dashboard/notifications/notifications/index.html',
path: 'dashboard/notifications/notifications/index.html',
controller: 'dashboard/notifications/notifications/index',
autoFocus: false,
roles: 'admin'
@ -270,7 +270,7 @@ import '../assets/css/detailtable.css';
defineRoute({
alias: '/playbackconfiguration.html',
path: '/controllers/dashboard/playback.html',
path: 'dashboard/playback.html',
autoFocus: false,
roles: 'admin',
controller: 'dashboard/playback'
@ -278,7 +278,7 @@ import '../assets/css/detailtable.css';
defineRoute({
alias: '/availableplugins.html',
path: '/controllers/dashboard/plugins/available/index.html',
path: 'dashboard/plugins/available/index.html',
autoFocus: false,
roles: 'admin',
controller: 'dashboard/plugins/available/index'
@ -286,7 +286,7 @@ import '../assets/css/detailtable.css';
defineRoute({
alias: '/repositories.html',
path: '/controllers/dashboard/plugins/repositories/index.html',
path: 'dashboard/plugins/repositories/index.html',
autoFocus: false,
roles: 'admin',
controller: 'dashboard/plugins/repositories/index'
@ -294,7 +294,7 @@ import '../assets/css/detailtable.css';
defineRoute({
alias: '/home.html',
path: '/controllers/home.html',
path: 'home.html',
autoFocus: false,
controller: 'home',
type: 'home'
@ -302,34 +302,34 @@ import '../assets/css/detailtable.css';
defineRoute({
alias: '/search.html',
path: '/controllers/search.html',
path: 'search.html',
controller: 'searchpage'
});
defineRoute({
alias: '/list.html',
path: '/controllers/list.html',
path: 'list.html',
autoFocus: false,
controller: 'list'
});
defineRoute({
alias: '/details',
path: '/controllers/itemDetails/index.html',
path: 'itemDetails/index.html',
controller: 'itemDetails/index',
autoFocus: false
});
defineRoute({
alias: '/livetv.html',
path: '/controllers/livetv.html',
path: 'livetv.html',
controller: 'livetv/livetvsuggested',
autoFocus: false
});
defineRoute({
alias: '/livetvguideprovider.html',
path: '/controllers/livetvguideprovider.html',
path: 'livetvguideprovider.html',
autoFocus: false,
roles: 'admin',
controller: 'livetvguideprovider'
@ -337,14 +337,14 @@ import '../assets/css/detailtable.css';
defineRoute({
alias: '/livetvsettings.html',
path: '/controllers/livetvsettings.html',
path: 'livetvsettings.html',
autoFocus: false,
controller: 'livetvsettings'
});
defineRoute({
alias: '/livetvstatus.html',
path: '/controllers/livetvstatus.html',
path: 'livetvstatus.html',
autoFocus: false,
roles: 'admin',
controller: 'livetvstatus'
@ -352,7 +352,7 @@ import '../assets/css/detailtable.css';
defineRoute({
alias: '/livetvtuner.html',
path: '/controllers/livetvtuner.html',
path: 'livetvtuner.html',
autoFocus: false,
roles: 'admin',
controller: 'livetvtuner'
@ -360,21 +360,21 @@ import '../assets/css/detailtable.css';
defineRoute({
alias: '/movies.html',
path: '/controllers/movies/movies.html',
path: 'movies/movies.html',
autoFocus: false,
controller: 'movies/moviesrecommended'
});
defineRoute({
alias: '/music.html',
path: '/controllers/music/music.html',
path: 'music/music.html',
controller: 'music/musicrecommended',
autoFocus: false
});
defineRoute({
alias: '/installedplugins.html',
path: '/controllers/dashboard/plugins/installed/index.html',
path: 'dashboard/plugins/installed/index.html',
autoFocus: false,
roles: 'admin',
controller: 'dashboard/plugins/installed/index'
@ -382,7 +382,7 @@ import '../assets/css/detailtable.css';
defineRoute({
alias: '/scheduledtask.html',
path: '/controllers/dashboard/scheduledtasks/scheduledtask.html',
path: 'dashboard/scheduledtasks/scheduledtask.html',
autoFocus: false,
roles: 'admin',
controller: 'dashboard/scheduledtasks/scheduledtask'
@ -390,7 +390,7 @@ import '../assets/css/detailtable.css';
defineRoute({
alias: '/scheduledtasks.html',
path: '/controllers/dashboard/scheduledtasks/scheduledtasks.html',
path: 'dashboard/scheduledtasks/scheduledtasks.html',
autoFocus: false,
roles: 'admin',
controller: 'dashboard/scheduledtasks/scheduledtasks'
@ -398,7 +398,7 @@ import '../assets/css/detailtable.css';
defineRoute({
alias: '/serveractivity.html',
path: '/controllers/dashboard/serveractivity.html',
path: 'dashboard/serveractivity.html',
autoFocus: false,
roles: 'admin',
controller: 'dashboard/serveractivity'
@ -406,7 +406,7 @@ import '../assets/css/detailtable.css';
defineRoute({
alias: '/apikeys.html',
path: '/controllers/dashboard/apikeys.html',
path: 'dashboard/apikeys.html',
autoFocus: false,
roles: 'admin',
controller: 'dashboard/apikeys'
@ -414,7 +414,7 @@ import '../assets/css/detailtable.css';
defineRoute({
alias: '/streamingsettings.html',
path: '/controllers/dashboard/streaming.html',
path: 'dashboard/streaming.html',
autoFocus: false,
roles: 'admin',
controller: 'dashboard/streaming'
@ -422,14 +422,14 @@ import '../assets/css/detailtable.css';
defineRoute({
alias: '/tv.html',
path: '/controllers/shows/tvrecommended.html',
path: 'shows/tvrecommended.html',
autoFocus: false,
controller: 'shows/tvrecommended'
});
defineRoute({
alias: '/useredit.html',
path: '/controllers/dashboard/users/useredit.html',
path: 'dashboard/users/useredit.html',
autoFocus: false,
roles: 'admin',
controller: 'dashboard/users/useredit'
@ -437,7 +437,7 @@ import '../assets/css/detailtable.css';
defineRoute({
alias: '/userlibraryaccess.html',
path: '/controllers/dashboard/users/userlibraryaccess.html',
path: 'dashboard/users/userlibraryaccess.html',
autoFocus: false,
roles: 'admin',
controller: 'dashboard/users/userlibraryaccess'
@ -445,7 +445,7 @@ import '../assets/css/detailtable.css';
defineRoute({
alias: '/usernew.html',
path: '/controllers/dashboard/users/usernew.html',
path: 'dashboard/users/usernew.html',
autoFocus: false,
roles: 'admin',
controller: 'dashboard/users/usernew'
@ -453,7 +453,7 @@ import '../assets/css/detailtable.css';
defineRoute({
alias: '/userparentalcontrol.html',
path: '/controllers/dashboard/users/userparentalcontrol.html',
path: 'dashboard/users/userparentalcontrol.html',
autoFocus: false,
roles: 'admin',
controller: 'dashboard/users/userparentalcontrol'
@ -461,14 +461,14 @@ import '../assets/css/detailtable.css';
defineRoute({
alias: '/userpassword.html',
path: '/controllers/dashboard/users/userpassword.html',
path: 'dashboard/users/userpassword.html',
autoFocus: false,
controller: 'dashboard/users/userpasswordpage'
});
defineRoute({
alias: '/userprofiles.html',
path: '/controllers/dashboard/users/userprofiles.html',
path: 'dashboard/users/userprofiles.html',
autoFocus: false,
roles: 'admin',
controller: 'dashboard/users/userprofilespage'
@ -476,7 +476,7 @@ import '../assets/css/detailtable.css';
defineRoute({
alias: '/wizardremoteaccess.html',
path: '/controllers/wizard/remote/index.html',
path: 'wizard/remote/index.html',
autoFocus: false,
anonymous: true,
controller: 'wizard/remote/index'
@ -484,7 +484,7 @@ import '../assets/css/detailtable.css';
defineRoute({
alias: '/wizardfinish.html',
path: '/controllers/wizard/finish/index.html',
path: 'wizard/finish/index.html',
autoFocus: false,
anonymous: true,
controller: 'wizard/finish/index'
@ -492,7 +492,7 @@ import '../assets/css/detailtable.css';
defineRoute({
alias: '/wizardlibrary.html',
path: '/controllers/wizard/library.html',
path: 'wizard/library.html',
autoFocus: false,
anonymous: true,
controller: 'dashboard/library'
@ -500,7 +500,7 @@ import '../assets/css/detailtable.css';
defineRoute({
alias: '/wizardsettings.html',
path: '/controllers/wizard/settings/index.html',
path: 'wizard/settings/index.html',
autoFocus: false,
anonymous: true,
controller: 'wizard/settings/index'
@ -508,7 +508,7 @@ import '../assets/css/detailtable.css';
defineRoute({
alias: '/wizardstart.html',
path: '/controllers/wizard/start/index.html',
path: 'wizard/start/index.html',
autoFocus: false,
anonymous: true,
controller: 'wizard/start/index'
@ -516,7 +516,7 @@ import '../assets/css/detailtable.css';
defineRoute({
alias: '/wizarduser.html',
path: '/controllers/wizard/user/index.html',
path: 'wizard/user/index.html',
controller: 'wizard/user/index',
autoFocus: false,
anonymous: true
@ -524,7 +524,7 @@ import '../assets/css/detailtable.css';
defineRoute({
alias: '/video',
path: '/controllers/playback/video/index.html',
path: 'playback/video/index.html',
controller: 'playback/video/index',
autoFocus: false,
type: 'video-osd',
@ -535,7 +535,7 @@ import '../assets/css/detailtable.css';
defineRoute({
alias: '/queue',
path: '/controllers/playback/queue/index.html',
path: 'playback/queue/index.html',
controller: 'playback/queue/index',
autoFocus: false,
fullscreen: true,
@ -544,7 +544,7 @@ import '../assets/css/detailtable.css';
});
defineRoute({
path: '/configurationpage',
path: 'configurationpage',
autoFocus: false,
enableCache: false,
enableContentQueryString: true,
@ -552,13 +552,13 @@ import '../assets/css/detailtable.css';
});
defineRoute({
path: '/',
path: '',
isDefaultRoute: true,
autoFocus: false
});
defineRoute({
path: '/index.html',
path: 'index.html',
autoFocus: false,
isDefaultRoute: true
});

View file

@ -1,10 +1,9 @@
import connectionManager from 'jellyfin-apiclient';
import playbackManager from '../components/playback/playbackmanager';
import { playbackManager } from '../components/playback/playbackmanager';
import syncPlayManager from '../components/syncPlay/syncPlayManager';
import events from 'jellyfin-apiclient';
import { events } from 'jellyfin-apiclient';
import inputManager from '../scripts/inputManager';
import focusManager from '../components/focusManager';
import appRouter from '../components/appRouter';
import { appRouter } from '../components/appRouter';
const serverNotifications = {};
@ -208,8 +207,8 @@ function bindEvents(apiClient) {
events.on(apiClient, 'message', onMessageReceived);
}
window.connectionManager.getApiClients().forEach(bindEvents);
events.on(window.connectionManager, 'apiclientcreated', function (e, newApiClient) {
window.ConnectionManager.getApiClients().forEach(bindEvents);
events.on(window.ConnectionManager, 'apiclientcreated', function (e, newApiClient) {
bindEvents(newApiClient);
});

View file

@ -1,5 +1,5 @@
import appSettings from './appSettings';
import events from 'jellyfin-apiclient';
import { events } from 'jellyfin-apiclient';
function onSaveTimeout() {
const self = this;

View file

@ -1,3 +1,4 @@
let data;
const urlResolver = document.createElement('a');
@ -42,16 +43,9 @@ async function fetchLocal(url, options) {
async function getConfig() {
if (data) return Promise.resolve(data);
try {
const response = await fetchLocal('config.json', {
cache: 'no-cache'
});
if (!response.ok) {
throw new Error('network response was not ok');
}
data = await response.json();
data = await import('../../config.json');
console.dir(data);
return data;
} catch (error) {
console.warn('failed to fetch the web config file:', error);
@ -61,15 +55,9 @@ async function getConfig() {
async function getDefaultConfig() {
try {
const response = await fetchLocal('config.template.json', {
cache: 'no-cache'
});
data = await import('../../config.template.json');
if (!response.ok) {
throw new Error('network response was not ok');
}
data = await response.json();
console.dir(data);
return data;
} catch (error) {
console.error('failed to fetch the default web config file:', error);

View file

@ -94,15 +94,11 @@ function initClient() {
return Promise.all([
import('jellyfin-apiclient'),
import('../components/apphost'),
import('jellyfin-apiclient'),
import('jellyfin-apiclient'),
import('./settings/userSettings')
])
.then(([ConnectionManager, appHost, credentialProvider, events, userSettings]) => {
appHost = appHost.default || appHost;
const credentialProviderInstance = new credentialProvider();
const promises = [appHost.init()];
.then(([{ ConnectionManager, Credentials, events }, { appHost} , userSettings]) => {
var credentialProviderInstance = new Credentials();
var promises = [appHost.init()];
return Promise.all(promises).then(function (responses) {
const capabilities = Dashboard.capabilities(appHost);
@ -118,10 +114,10 @@ function initClient() {
import('jellyfin-apiclient'),
import('./clientUtils')
])
.then(([apiClientFactory, clientUtils]) => {
.then(([{ ApiClient }, clientUtils]) => {
console.debug('creating ApiClient singleton');
var apiClient = new apiClientFactory(Dashboard.serverAddress(), appHost.appName(), appHost.appVersion(), appHost.deviceName(), appHost.deviceId());
var apiClient = new ApiClient(Dashboard.serverAddress(), appHost.appName(), appHost.appVersion(), appHost.deviceName(), appHost.deviceId());
apiClient.enableAutomaticNetworking = false;
apiClient.manualAddressOnly = true;
@ -160,17 +156,16 @@ function initClient() {
.then((keyboardnavigation) => {
keyboardnavigation.enable();
});
import(['./mouseManager']);
import('./mouseManager');
import('../components/autoFocuser').then((autoFocuser) => {
autoFocuser.enable();
});
Promise.all([
import('./globalize'),
import('jellyfin-apiclient'),
import('jellyfin-apiclient')
])
.then((globalize, connectionManager, events) => {
events.on(connectionManager, 'localusersignedin', globalize.updateCurrentCulture);
.then(([ globalize, { ConnectionManager, events } ]) => {
events.on(ConnectionManager, 'localusersignedin', globalize.updateCurrentCulture);
});
});
});
@ -181,7 +176,7 @@ function initClient() {
const translations = languages.map(function (language) {
return {
lang: language,
path: 'strings/' + language + '.json'
path: language + '.json'
};
});
globalize.defaultModule('core');
@ -208,21 +203,24 @@ function initClient() {
import('../assets/css/fonts.css');
}
Promise.all([
import('../components/apphost'),
import('../assets/css/librarybrowser.css')
]).then((appHost) => {
loadPlugins(appHost, browser).then(function () {
onAppReady(browser);
import('../assets/css/librarybrowser.css')
import('../components/apphost')
.then(({ appHost }) => {
loadPlugins(appHost, browser).then(function () {
onAppReady(browser);
});
});
});
}
function loadPlugins(appHost, browser, shell) {
console.groupCollapsed('loading installed plugins');
return new Promise(function (resolve, reject) {
import('./settings/webSettings')
.then((webSettings) => {
Promise.all([
import('./settings/webSettings'),
import('../components/pluginManager')
])
.then(([webSettings, { pluginManager: pluginManager }]) => {
console.dir(pluginManager);
webSettings.getPlugins().then(function (list) {
// these two plugins are dependent on features
if (!appHost.supports('remotecontrol')) {
@ -238,15 +236,17 @@ function initClient() {
list = list.concat(window.NativeShell.getPlugins());
}
Promise.all(list.map(loadPlugin))
.then(function () {
Promise.all(list.map((plugin) => {
return pluginManager.loadPlugin(import(/* webpackChunkName: "[request]" */ `../plugins/${plugin}`));
}))
.then(function (pluginPromises) {
console.debug('finished loading plugins');
})
.catch(() => reject)
.finally(() => {
console.groupEnd('loading installed plugins');
import('../components/packageManager')
.then((packageManager) => {
.then(({ default: packageManager }) => {
packageManager.init().then(resolve, reject);
});
})
@ -256,27 +256,15 @@ function initClient() {
});
}
function loadPlugin(url) {
return new Promise(function (resolve, reject) {
import('../components/pluginManager')
.then((pluginManager) => {
pluginManager.loadPlugin(url).then(resolve, reject);
});
});
}
function onAppReady(browser) {
console.debug('begin onAppReady');
// ensure that appHost is loaded in this point
Promise.all([
import('jellyfin-apiclient'),
import('../components/apphost'),
import('../components/appRouter')
])
.then(([appHost, appRouter]) => {
appRouter = appRouter.default || appRouter;
appHost = appHost.default || appHost;
.then(([{ appHost }, { appRouter }]) => {
window.Emby = {};
console.debug('onAppReady: loading dependencies');

View file

@ -1,4 +1,3 @@
(function() {
'use strict';
window.appMode = 'standalone';
})();
window.appMode = 'standalone';
import('./site');

View file

@ -1,12 +1,12 @@
import { connectionManager, events } from 'jellyfin-apiclient';
import { ConnectionManager, events } from 'jellyfin-apiclient';
import serverNotifications from '../scripts/serverNotifications';
import globalize from '../scripts/globalize';
import '../elements/emby-button/emby-button';
export default function (options) {
function pollTasks() {
window.connectionManager.getApiClient(serverId).getScheduledTasks({
ConnectionManager.getApiClient(serverId).getScheduledTasks({
IsEnabled: true
}).then(updateTasks);
}
@ -63,7 +63,7 @@ export default function (options) {
}
function onScheduledTaskMessageConfirmed(id) {
window.connectionManager.getApiClient(serverId).startScheduledTask(id).then(pollTasks);
ConnectionManager.getApiClient(serverId).startScheduledTask(id).then(pollTasks);
}
function onButtonClick() {
@ -81,13 +81,13 @@ export default function (options) {
const serverId = ApiClient.serverId();
function onPollIntervalFired() {
if (!window.connectionManager.getApiClient(serverId).isMessageChannelOpen()) {
if (!ConnectionManager.getApiClient(serverId).isMessageChannelOpen()) {
pollTasks();
}
}
function startInterval() {
const apiClient = window.connectionManager.getApiClient(serverId);
const apiClient = ConnectionManager.getApiClient(serverId);
if (pollInterval) {
clearInterval(pollInterval);
@ -97,7 +97,7 @@ export default function (options) {
}
function stopInterval() {
window.connectionManager.getApiClient(serverId).sendMessage('ScheduledTasksInfoStop');
ConnectionManager.getApiClient(serverId).sendMessage('ScheduledTasksInfoStop');
if (pollInterval) {
clearInterval(pollInterval);

View file

@ -21,6 +21,14 @@ function getThemeStylesheetInfo(id) {
return id ? theme.id === id : theme.default;
});
if (!theme) {
theme = {
'name': 'Dark',
'id': 'dark',
'default': true
};
}
return {
stylesheetPath: 'themes/' + theme.id + '/theme.css',
themeId: theme.id

View file

@ -1,5 +1,5 @@
import dom from '../scripts/dom';
import events from 'jellyfin-apiclient';
import { events } from 'jellyfin-apiclient';
function getTouches(e) {
return e.changedTouches || e.targetTouches || e.touches;