Use sdk for item download url
This commit is contained in:
@@ -1,18 +1,21 @@
|
||||
import 'material-design-icons-iconfont';
|
||||
import { getLibraryApi } from '@jellyfin/sdk/lib/utils/api/library-api';
|
||||
import Screenfull from 'screenfull';
|
||||
|
||||
import { ServerConnections } from 'lib/jellyfin-apiclient';
|
||||
import browser from 'scripts/browser';
|
||||
import TouchHelper from 'scripts/touchHelper';
|
||||
import { toApi } from 'utils/jellyfin-apiclient/compat';
|
||||
|
||||
import loading from '../../components/loading/loading';
|
||||
import keyboardnavigation from '../../scripts/keyboardNavigation';
|
||||
import dialogHelper from '../../components/dialogHelper/dialogHelper';
|
||||
import Screenfull from 'screenfull';
|
||||
import TableOfContents from './tableOfContents';
|
||||
import { translateHtml } from '../../lib/globalize';
|
||||
import { ServerConnections } from 'lib/jellyfin-apiclient';
|
||||
import browser from 'scripts/browser';
|
||||
import * as userSettings from '../../scripts/settings/userSettings';
|
||||
import TouchHelper from 'scripts/touchHelper';
|
||||
import { PluginType } from '../../types/plugin.ts';
|
||||
import Events from '../../utils/events.ts';
|
||||
|
||||
import 'material-design-icons-iconfont';
|
||||
import '../../elements/emby-button/paper-icon-button-light';
|
||||
|
||||
import html from './template.html';
|
||||
@@ -324,16 +327,14 @@ export class BookPlayer {
|
||||
}
|
||||
};
|
||||
|
||||
const serverId = item.ServerId;
|
||||
const apiClient = ServerConnections.getApiClient(serverId);
|
||||
|
||||
if (!Screenfull.isEnabled) {
|
||||
document.getElementById('btnBookplayerFullscreen').display = 'none';
|
||||
}
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
import('epubjs').then(({ default: epubjs }) => {
|
||||
const downloadHref = apiClient.getItemDownloadUrl(item.Id);
|
||||
const api = toApi(ServerConnections.getApiClient(item));
|
||||
const downloadHref = getLibraryApi(api).getDownloadUrl({ itemId: item.Id });
|
||||
const book = epubjs(downloadHref, { openAs: 'epub' });
|
||||
|
||||
// We need to calculate the height of the window beforehand because using 100% is not accurate when the dialog is opening.
|
||||
|
||||
@@ -1,9 +1,13 @@
|
||||
import { getLibraryApi } from '@jellyfin/sdk/lib/utils/api/library-api';
|
||||
import { Archive } from 'libarchive.js';
|
||||
|
||||
import { ServerConnections } from 'lib/jellyfin-apiclient';
|
||||
import { toApi } from 'utils/jellyfin-apiclient/compat';
|
||||
|
||||
import loading from '../../components/loading/loading';
|
||||
import dialogHelper from '../../components/dialogHelper/dialogHelper';
|
||||
import keyboardnavigation from '../../scripts/keyboardNavigation';
|
||||
import { appRouter } from '../../components/router/appRouter';
|
||||
import { ServerConnections } from 'lib/jellyfin-apiclient';
|
||||
import * as userSettings from '../../scripts/settings/userSettings';
|
||||
import { PluginType } from '../../types/plugin.ts';
|
||||
|
||||
@@ -287,14 +291,12 @@ export class ComicsPlayer {
|
||||
|
||||
loading.show();
|
||||
|
||||
const serverId = item.ServerId;
|
||||
const apiClient = ServerConnections.getApiClient(serverId);
|
||||
|
||||
Archive.init({
|
||||
workerUrl: appRouter.baseUrl() + '/libraries/worker-bundle.js'
|
||||
});
|
||||
|
||||
const downloadUrl = apiClient.getItemDownloadUrl(item.Id);
|
||||
const api = toApi(ServerConnections.getApiClient(item));
|
||||
const downloadUrl = getLibraryApi(api).getDownloadUrl({ itemId: item.Id });
|
||||
this.archiveSource = new ArchiveSource(downloadUrl);
|
||||
|
||||
//eslint-disable-next-line import/no-unresolved
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
import { getLibraryApi } from '@jellyfin/sdk/lib/utils/api/library-api';
|
||||
|
||||
import { toApi } from 'utils/jellyfin-apiclient/compat';
|
||||
|
||||
import loading from '../../components/loading/loading';
|
||||
import keyboardnavigation from '../../scripts/keyboardNavigation';
|
||||
import dialogHelper from '../../components/dialogHelper/dialogHelper';
|
||||
@@ -205,11 +209,9 @@ export class PdfPlayer {
|
||||
}
|
||||
};
|
||||
|
||||
const serverId = item.ServerId;
|
||||
const apiClient = ServerConnections.getApiClient(serverId);
|
||||
|
||||
return import('pdfjs-dist').then(({ GlobalWorkerOptions, getDocument }) => {
|
||||
const downloadHref = apiClient.getItemDownloadUrl(item.Id);
|
||||
const api = toApi(ServerConnections.getApiClient(item));
|
||||
const downloadHref = getLibraryApi(api).getDownloadUrl({ itemId: item.Id });
|
||||
|
||||
this.bindEvents();
|
||||
GlobalWorkerOptions.workerSrc = appRouter.baseUrl() + '/libraries/pdf.worker.js';
|
||||
|
||||
Reference in New Issue
Block a user