mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
extracted connectionManager from site.js
new module ServerConnections for ConnectionManager all code adapted to this new module removed Events and ConnectionManager from eslintrc
This commit is contained in:
parent
923d53bb71
commit
5071aedcea
81 changed files with 446 additions and 397 deletions
|
@ -2,7 +2,7 @@ import { appHost } from '../../components/apphost';
|
|||
import loading from '../../components/loading/loading';
|
||||
import { appRouter } from '../../components/appRouter';
|
||||
import layoutManager from '../../components/layoutManager';
|
||||
import { ConnectionManager, Events } from 'jellyfin-apiclient';
|
||||
import { Events } from 'jellyfin-apiclient';
|
||||
import * as userSettings from '../../scripts/settings/userSettings';
|
||||
import cardBuilder from '../../components/cardbuilder/cardBuilder';
|
||||
import datetime from '../../scripts/datetime';
|
||||
|
@ -28,6 +28,7 @@ import '../../elements/emby-scroller/emby-scroller';
|
|||
import '../../elements/emby-select/emby-select';
|
||||
import itemShortcuts from '../../components/shortcuts';
|
||||
import Dashboard from '../../scripts/clientUtils';
|
||||
import ServerConnections from '../../components/ServerConnections';
|
||||
|
||||
function getPromise(apiClient, params) {
|
||||
const id = params.id;
|
||||
|
@ -564,7 +565,7 @@ function renderDetailPageBackdrop(page, item, apiClient) {
|
|||
}
|
||||
|
||||
function reloadFromItem(instance, page, params, item, user) {
|
||||
const apiClient = ConnectionManager.getApiClient(item.ServerId);
|
||||
const apiClient = ServerConnections.getApiClient(item.ServerId);
|
||||
|
||||
Emby.Page.setTitle('');
|
||||
|
||||
|
@ -806,7 +807,7 @@ function renderNextUp(page, item, user) {
|
|||
return void section.classList.add('hide');
|
||||
}
|
||||
|
||||
ConnectionManager.getApiClient(item.ServerId).getNextUpEpisodes({
|
||||
ServerConnections.getApiClient(item.ServerId).getNextUpEpisodes({
|
||||
SeriesId: item.Id,
|
||||
UserId: user.Id
|
||||
}).then(function (result) {
|
||||
|
@ -1210,7 +1211,7 @@ function renderSimilarItems(page, item, context) {
|
|||
}
|
||||
|
||||
similarCollapsible.classList.remove('hide');
|
||||
const apiClient = ConnectionManager.getApiClient(item.ServerId);
|
||||
const apiClient = ServerConnections.getApiClient(item.ServerId);
|
||||
const options = {
|
||||
userId: apiClient.getCurrentUserId(),
|
||||
limit: 12,
|
||||
|
@ -1324,7 +1325,7 @@ function renderChildren(page, item) {
|
|||
}
|
||||
|
||||
let promise;
|
||||
const apiClient = ConnectionManager.getApiClient(item.ServerId);
|
||||
const apiClient = ServerConnections.getApiClient(item.ServerId);
|
||||
const userId = apiClient.getCurrentUserId();
|
||||
|
||||
if (item.Type == 'Series') {
|
||||
|
@ -1572,7 +1573,7 @@ function renderChannelGuide(page, apiClient, item) {
|
|||
}
|
||||
|
||||
function renderSeriesSchedule(page, item) {
|
||||
const apiClient = ConnectionManager.getApiClient(item.ServerId);
|
||||
const apiClient = ServerConnections.getApiClient(item.ServerId);
|
||||
apiClient.getLiveTvPrograms({
|
||||
UserId: apiClient.getCurrentUserId(),
|
||||
HasAired: false,
|
||||
|
@ -1732,7 +1733,7 @@ function renderCollectionItemType(page, parentItem, type, items) {
|
|||
}
|
||||
|
||||
function renderMusicVideos(page, item, user) {
|
||||
ConnectionManager.getApiClient(item.ServerId).getItems(user.Id, {
|
||||
ServerConnections.getApiClient(item.ServerId).getItems(user.Id, {
|
||||
SortBy: 'SortName',
|
||||
SortOrder: 'Ascending',
|
||||
IncludeItemTypes: 'MusicVideo',
|
||||
|
@ -1752,7 +1753,7 @@ function renderMusicVideos(page, item, user) {
|
|||
}
|
||||
|
||||
function renderAdditionalParts(page, item, user) {
|
||||
ConnectionManager.getApiClient(item.ServerId).getAdditionalVideoParts(user.Id, item.Id).then(function (result) {
|
||||
ServerConnections.getApiClient(item.ServerId).getAdditionalVideoParts(user.Id, item.Id).then(function (result) {
|
||||
if (result.Items.length) {
|
||||
page.querySelector('#additionalPartsCollapsible').classList.remove('hide');
|
||||
const additionalPartsContent = page.querySelector('#additionalPartsContent');
|
||||
|
@ -1797,7 +1798,7 @@ function getVideosHtml(items) {
|
|||
}
|
||||
|
||||
function renderSpecials(page, item, user) {
|
||||
ConnectionManager.getApiClient(item.ServerId).getSpecialFeatures(user.Id, item.Id).then(function (specials) {
|
||||
ServerConnections.getApiClient(item.ServerId).getSpecialFeatures(user.Id, item.Id).then(function (specials) {
|
||||
const specialsContent = page.querySelector('#specialsContent');
|
||||
specialsContent.innerHTML = getVideosHtml(specials);
|
||||
imageLoader.lazyChildren(specialsContent);
|
||||
|
@ -1853,7 +1854,7 @@ export default function (view, params) {
|
|||
function reload(instance, page, params) {
|
||||
loading.show();
|
||||
|
||||
const apiClient = params.serverId ? ConnectionManager.getApiClient(params.serverId) : ApiClient;
|
||||
const apiClient = params.serverId ? ServerConnections.getApiClient(params.serverId) : ApiClient;
|
||||
|
||||
Promise.all([getPromise(apiClient, params), apiClient.getCurrentUser()]).then(([item, user]) => {
|
||||
currentItem = item;
|
||||
|
@ -1902,7 +1903,7 @@ export default function (view, params) {
|
|||
const item = currentItem;
|
||||
|
||||
if (item.Type === 'Program') {
|
||||
const apiClient = ConnectionManager.getApiClient(item.ServerId);
|
||||
const apiClient = ServerConnections.getApiClient(item.ServerId);
|
||||
return void apiClient.getLiveTvChannel(item.ChannelId, apiClient.getCurrentUserId()).then(function (channel) {
|
||||
playbackManager.play({
|
||||
items: [channel]
|
||||
|
@ -1939,7 +1940,7 @@ export default function (view, params) {
|
|||
|
||||
function onCancelTimerClick() {
|
||||
import('../../components/recordingcreator/recordinghelper').then(({ default: recordingHelper }) => {
|
||||
recordingHelper.cancelTimer(ConnectionManager.getApiClient(currentItem.ServerId), currentItem.TimerId).then(function () {
|
||||
recordingHelper.cancelTimer(ServerConnections.getApiClient(currentItem.ServerId), currentItem.TimerId).then(function () {
|
||||
reload(self, view, params);
|
||||
});
|
||||
});
|
||||
|
@ -2003,7 +2004,7 @@ export default function (view, params) {
|
|||
|
||||
let currentItem;
|
||||
const self = this;
|
||||
const apiClient = params.serverId ? ConnectionManager.getApiClient(params.serverId) : ApiClient;
|
||||
const apiClient = params.serverId ? ServerConnections.getApiClient(params.serverId) : ApiClient;
|
||||
|
||||
const btnResume = view.querySelector('.mainDetailButtons .btnResume');
|
||||
const btnPlay = view.querySelector('.mainDetailButtons .btnPlay');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue