Merge remote-tracking branch 'upstream/master' into site-js-prepare-es6
This commit is contained in:
commit
8d7912cae4
237 changed files with 11686 additions and 12791 deletions
|
@ -90,17 +90,16 @@ function initClient() {
|
|||
}
|
||||
|
||||
function createConnectionManager() {
|
||||
return require(['connectionManagerFactory', 'apphost', 'credentialprovider', 'events', 'userSettings'], function (ConnectionManager, apphost, credentialProvider, events, userSettings) {
|
||||
return require(['connectionManagerFactory', 'apphost', 'credentialprovider', 'events', 'userSettings'], function (ConnectionManager, appHost, credentialProvider, events, userSettings) {
|
||||
appHost = appHost.default || appHost;
|
||||
|
||||
var credentialProviderInstance = new credentialProvider();
|
||||
var promises = [apphost.getSyncProfile(), apphost.init()];
|
||||
var promises = [appHost.init()];
|
||||
|
||||
return Promise.all(promises).then(function (responses) {
|
||||
var deviceProfile = responses[0];
|
||||
var capabilities = Dashboard.capabilities(apphost);
|
||||
var capabilities = Dashboard.capabilities(appHost);
|
||||
|
||||
capabilities.DeviceProfile = deviceProfile;
|
||||
|
||||
var connectionManager = new ConnectionManager(credentialProviderInstance, apphost.appName(), apphost.appVersion(), apphost.deviceName(), apphost.deviceId(), capabilities);
|
||||
var connectionManager = new ConnectionManager(credentialProviderInstance, appHost.appName(), appHost.appVersion(), appHost.deviceName(), appHost.deviceId(), capabilities);
|
||||
|
||||
defineConnectionManager(connectionManager);
|
||||
bindConnectionManagerEvents(connectionManager, events, userSettings);
|
||||
|
@ -111,7 +110,7 @@ function initClient() {
|
|||
return require(['apiclient', 'clientUtils'], function (apiClientFactory, clientUtils) {
|
||||
console.debug('creating ApiClient singleton');
|
||||
|
||||
var apiClient = new apiClientFactory(Dashboard.serverAddress(), apphost.appName(), apphost.appVersion(), apphost.deviceName(), apphost.deviceId());
|
||||
var apiClient = new apiClientFactory(Dashboard.serverAddress(), appHost.appName(), appHost.appVersion(), appHost.deviceName(), appHost.deviceId());
|
||||
|
||||
apiClient.enableAutomaticNetworking = false;
|
||||
apiClient.manualAddressOnly = true;
|
||||
|
@ -160,7 +159,7 @@ function initClient() {
|
|||
function getPlaybackManager(playbackManager) {
|
||||
window.addEventListener('beforeunload', function () {
|
||||
try {
|
||||
playbackManager.onAppClose();
|
||||
playbackManager.default.onAppClose();
|
||||
} catch (err) {
|
||||
console.error('error in onAppClose: ' + err);
|
||||
}
|
||||
|
@ -169,6 +168,8 @@ function initClient() {
|
|||
}
|
||||
|
||||
function getLayoutManager(layoutManager, appHost) {
|
||||
layoutManager = layoutManager.default || layoutManager;
|
||||
appHost = appHost.default || appHost;
|
||||
if (appHost.getDefaultLayout) {
|
||||
layoutManager.defaultLayout = appHost.getDefaultLayout();
|
||||
}
|
||||
|
@ -264,6 +265,8 @@ function initClient() {
|
|||
}
|
||||
|
||||
require(['apphost', 'css!assets/css/librarybrowser'], function (appHost) {
|
||||
appHost = appHost.default || appHost;
|
||||
|
||||
loadPlugins(appHost, browser).then(function () {
|
||||
onAppReady(browser);
|
||||
});
|
||||
|
@ -312,6 +315,9 @@ function initClient() {
|
|||
|
||||
// ensure that appHost is loaded in this point
|
||||
require(['apphost', 'appRouter'], function (appHost, appRouter) {
|
||||
appRouter = appRouter.default || appRouter;
|
||||
appHost = appHost.default || appHost;
|
||||
|
||||
window.Emby = {};
|
||||
|
||||
console.debug('onAppReady: loading dependencies');
|
||||
|
@ -431,8 +437,8 @@ function initClient() {
|
|||
init();
|
||||
}
|
||||
|
||||
var promise;
|
||||
var localApiClient;
|
||||
let promise;
|
||||
|
||||
function initRequireJs() {
|
||||
var urlArgs = 'v=' + (window.dashboardVersion || new Date().getDate());
|
||||
|
@ -466,7 +472,8 @@ function initClient() {
|
|||
pluginManager: componentsPath + '/pluginManager',
|
||||
packageManager: componentsPath + '/packageManager',
|
||||
screensaverManager: componentsPath + '/screensavermanager',
|
||||
clientUtils: scriptsPath + '/clientUtils'
|
||||
clientUtils: scriptsPath + '/clientUtils',
|
||||
appRouter: 'components/appRouter'
|
||||
};
|
||||
|
||||
requirejs.onError = onRequireJsError;
|
||||
|
@ -665,269 +672,9 @@ function initClient() {
|
|||
return window.ApiClient;
|
||||
};
|
||||
});
|
||||
define('appRouter', [componentsPath + '/appRouter', 'itemHelper'], function (appRouter, itemHelper) {
|
||||
function showItem(item, serverId, options) {
|
||||
if (typeof item == 'string') {
|
||||
require(['connectionManager'], function (connectionManager) {
|
||||
var apiClient = connectionManager.currentApiClient();
|
||||
apiClient.getItem(apiClient.getCurrentUserId(), item).then(function (item) {
|
||||
appRouter.showItem(item, options);
|
||||
});
|
||||
});
|
||||
} else {
|
||||
if (arguments.length == 2) {
|
||||
options = arguments[1];
|
||||
}
|
||||
|
||||
appRouter.show('/' + appRouter.getRouteUrl(item, options), {
|
||||
item: item
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
appRouter.showLocalLogin = function (serverId, manualLogin) {
|
||||
Dashboard.navigate('login.html?serverid=' + serverId);
|
||||
};
|
||||
|
||||
appRouter.showVideoOsd = function () {
|
||||
return Dashboard.navigate('video');
|
||||
};
|
||||
|
||||
appRouter.showSelectServer = function () {
|
||||
Dashboard.navigate(AppInfo.isNativeApp ? 'selectserver.html' : 'login.html');
|
||||
};
|
||||
|
||||
appRouter.showWelcome = function () {
|
||||
Dashboard.navigate(AppInfo.isNativeApp ? 'selectserver.html' : 'login.html');
|
||||
};
|
||||
|
||||
appRouter.showSettings = function () {
|
||||
Dashboard.navigate('mypreferencesmenu.html');
|
||||
};
|
||||
|
||||
appRouter.showGuide = function () {
|
||||
Dashboard.navigate('livetv.html?tab=1');
|
||||
};
|
||||
|
||||
appRouter.goHome = function () {
|
||||
Dashboard.navigate('home.html');
|
||||
};
|
||||
|
||||
appRouter.showSearch = function () {
|
||||
Dashboard.navigate('search.html');
|
||||
};
|
||||
|
||||
appRouter.showLiveTV = function () {
|
||||
Dashboard.navigate('livetv.html');
|
||||
};
|
||||
|
||||
appRouter.showRecordedTV = function () {
|
||||
Dashboard.navigate('livetv.html?tab=3');
|
||||
};
|
||||
|
||||
appRouter.showFavorites = function () {
|
||||
Dashboard.navigate('home.html?tab=1');
|
||||
};
|
||||
|
||||
appRouter.showSettings = function () {
|
||||
Dashboard.navigate('mypreferencesmenu.html');
|
||||
};
|
||||
|
||||
appRouter.setTitle = function (title) {
|
||||
LibraryMenu.setTitle(title);
|
||||
};
|
||||
|
||||
appRouter.getRouteUrl = function (item, options) {
|
||||
if (!item) {
|
||||
throw new Error('item cannot be null');
|
||||
}
|
||||
|
||||
if (item.url) {
|
||||
return item.url;
|
||||
}
|
||||
|
||||
var context = options ? options.context : null;
|
||||
var id = item.Id || item.ItemId;
|
||||
|
||||
if (!options) {
|
||||
options = {};
|
||||
}
|
||||
|
||||
var url;
|
||||
var itemType = item.Type || (options ? options.itemType : null);
|
||||
var serverId = item.ServerId || options.serverId;
|
||||
|
||||
if (item === 'settings') {
|
||||
return 'mypreferencesmenu.html';
|
||||
}
|
||||
|
||||
if (item === 'wizard') {
|
||||
return 'wizardstart.html';
|
||||
}
|
||||
|
||||
if (item === 'manageserver') {
|
||||
return 'dashboard.html';
|
||||
}
|
||||
|
||||
if (item === 'recordedtv') {
|
||||
return 'livetv.html?tab=3&serverId=' + options.serverId;
|
||||
}
|
||||
|
||||
if (item === 'nextup') {
|
||||
return 'list.html?type=nextup&serverId=' + options.serverId;
|
||||
}
|
||||
|
||||
if (item === 'list') {
|
||||
var url = 'list.html?serverId=' + options.serverId + '&type=' + options.itemTypes;
|
||||
|
||||
if (options.isFavorite) {
|
||||
url += '&IsFavorite=true';
|
||||
}
|
||||
|
||||
return url;
|
||||
}
|
||||
|
||||
if (item === 'livetv') {
|
||||
if (options.section === 'programs') {
|
||||
return 'livetv.html?tab=0&serverId=' + options.serverId;
|
||||
}
|
||||
if (options.section === 'guide') {
|
||||
return 'livetv.html?tab=1&serverId=' + options.serverId;
|
||||
}
|
||||
|
||||
if (options.section === 'movies') {
|
||||
return 'list.html?type=Programs&IsMovie=true&serverId=' + options.serverId;
|
||||
}
|
||||
|
||||
if (options.section === 'shows') {
|
||||
return 'list.html?type=Programs&IsSeries=true&IsMovie=false&IsNews=false&serverId=' + options.serverId;
|
||||
}
|
||||
|
||||
if (options.section === 'sports') {
|
||||
return 'list.html?type=Programs&IsSports=true&serverId=' + options.serverId;
|
||||
}
|
||||
|
||||
if (options.section === 'kids') {
|
||||
return 'list.html?type=Programs&IsKids=true&serverId=' + options.serverId;
|
||||
}
|
||||
|
||||
if (options.section === 'news') {
|
||||
return 'list.html?type=Programs&IsNews=true&serverId=' + options.serverId;
|
||||
}
|
||||
|
||||
if (options.section === 'onnow') {
|
||||
return 'list.html?type=Programs&IsAiring=true&serverId=' + options.serverId;
|
||||
}
|
||||
|
||||
if (options.section === 'dvrschedule') {
|
||||
return 'livetv.html?tab=4&serverId=' + options.serverId;
|
||||
}
|
||||
|
||||
if (options.section === 'seriesrecording') {
|
||||
return 'livetv.html?tab=5&serverId=' + options.serverId;
|
||||
}
|
||||
|
||||
return 'livetv.html?serverId=' + options.serverId;
|
||||
}
|
||||
|
||||
if (itemType == 'SeriesTimer') {
|
||||
return 'details?seriesTimerId=' + id + '&serverId=' + serverId;
|
||||
}
|
||||
|
||||
if (item.CollectionType == 'livetv') {
|
||||
return 'livetv.html';
|
||||
}
|
||||
|
||||
if (item.Type === 'Genre') {
|
||||
url = 'list.html?genreId=' + item.Id + '&serverId=' + serverId;
|
||||
|
||||
if (context === 'livetv') {
|
||||
url += '&type=Programs';
|
||||
}
|
||||
|
||||
if (options.parentId) {
|
||||
url += '&parentId=' + options.parentId;
|
||||
}
|
||||
|
||||
return url;
|
||||
}
|
||||
|
||||
if (item.Type === 'MusicGenre') {
|
||||
url = 'list.html?musicGenreId=' + item.Id + '&serverId=' + serverId;
|
||||
|
||||
if (options.parentId) {
|
||||
url += '&parentId=' + options.parentId;
|
||||
}
|
||||
|
||||
return url;
|
||||
}
|
||||
|
||||
if (item.Type === 'Studio') {
|
||||
url = 'list.html?studioId=' + item.Id + '&serverId=' + serverId;
|
||||
|
||||
if (options.parentId) {
|
||||
url += '&parentId=' + options.parentId;
|
||||
}
|
||||
|
||||
return url;
|
||||
}
|
||||
|
||||
if (context !== 'folders' && !itemHelper.isLocalItem(item)) {
|
||||
if (item.CollectionType == 'movies') {
|
||||
url = 'movies.html?topParentId=' + item.Id;
|
||||
|
||||
if (options && options.section === 'latest') {
|
||||
url += '&tab=1';
|
||||
}
|
||||
|
||||
return url;
|
||||
}
|
||||
|
||||
if (item.CollectionType == 'tvshows') {
|
||||
url = 'tv.html?topParentId=' + item.Id;
|
||||
|
||||
if (options && options.section === 'latest') {
|
||||
url += '&tab=2';
|
||||
}
|
||||
|
||||
return url;
|
||||
}
|
||||
|
||||
if (item.CollectionType == 'music') {
|
||||
return 'music.html?topParentId=' + item.Id;
|
||||
}
|
||||
}
|
||||
|
||||
var itemTypes = ['Playlist', 'TvChannel', 'Program', 'BoxSet', 'MusicAlbum', 'MusicGenre', 'Person', 'Recording', 'MusicArtist'];
|
||||
|
||||
if (itemTypes.indexOf(itemType) >= 0) {
|
||||
return 'details?id=' + id + '&serverId=' + serverId;
|
||||
}
|
||||
|
||||
var contextSuffix = context ? '&context=' + context : '';
|
||||
|
||||
if (itemType == 'Series' || itemType == 'Season' || itemType == 'Episode') {
|
||||
return 'details?id=' + id + contextSuffix + '&serverId=' + serverId;
|
||||
}
|
||||
|
||||
if (item.IsFolder) {
|
||||
if (id) {
|
||||
return 'list.html?parentId=' + id + '&serverId=' + serverId;
|
||||
}
|
||||
|
||||
return '#';
|
||||
}
|
||||
|
||||
return 'details?id=' + id + '&serverId=' + serverId;
|
||||
};
|
||||
|
||||
appRouter.showItem = showItem;
|
||||
return appRouter;
|
||||
});
|
||||
}
|
||||
|
||||
initRequireJs();
|
||||
|
||||
promise.then(onWebComponentsReady);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue