1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

some bug fixes after master rebase

This commit is contained in:
vitorsemeano 2020-10-18 18:58:09 +01:00
parent 3c84773792
commit a106e23ff8
9 changed files with 748 additions and 89 deletions

View file

@ -56,6 +56,7 @@
"webpack": "^5.3.2", "webpack": "^5.3.2",
"webpack-cli": "^4.0.0", "webpack-cli": "^4.0.0",
"webpack-concat-plugin": "^3.0.0", "webpack-concat-plugin": "^3.0.0",
"webpack-dev-server": "^3.11.0",
"webpack-merge": "^4.2.2", "webpack-merge": "^4.2.2",
"webpack-stream": "^6.1.0", "webpack-stream": "^6.1.0",
"worker-plugin": "^5.0.0" "worker-plugin": "^5.0.0"

View file

@ -310,17 +310,6 @@ class AppRouter {
url = route.contentPath || route.path; url = route.contentPath || route.path;
} }
if (url.includes('configurationpage')) {
url = ApiClient.getUrl('/web' + url);
} else if (url.indexOf('://') === -1) {
// Put a slash at the beginning but make sure to avoid a double slash
if (url.indexOf('/') !== 0) {
url = '/' + url;
}
url = this.baseUrl() + url;
}
if (ctx.querystring && route.enableContentQueryString) { if (ctx.querystring && route.enableContentQueryString) {
url += '?' + ctx.querystring; url += '?' + ctx.querystring;
} }

View file

@ -1,7 +1,7 @@
import { appHost } from './apphost'; import { appHost } from './apphost';
import browser from '../scripts/browser'; import browser from '../scripts/browser';
import { set, get } from '../scripts/settings/appSettings'; import appSettings from '../scripts/settings/appSettings';
import { Events } from 'jellyfin-apiclient'; import { Events } from 'jellyfin-apiclient';
function setLayout(instance, layout, selectedLayout) { function setLayout(instance, layout, selectedLayout) {
@ -20,7 +20,7 @@ class LayoutManager {
this.autoLayout(); this.autoLayout();
if (save !== false) { if (save !== false) {
set('layout', ''); appSettings.set('layout', '');
} }
} else { } else {
setLayout(this, 'mobile', layout); setLayout(this, 'mobile', layout);
@ -28,7 +28,7 @@ class LayoutManager {
setLayout(this, 'desktop', layout); setLayout(this, 'desktop', layout);
if (save !== false) { if (save !== false) {
set('layout', layout); appSettings.set('layout', layout);
} }
} }
@ -36,7 +36,7 @@ class LayoutManager {
} }
getSavedLayout() { getSavedLayout() {
return get('layout'); return appSettings.get('layout');
} }
autoLayout() { autoLayout() {

View file

@ -14,6 +14,7 @@ import '../../assets/css/scrollstyles.css';
import '../../elements/emby-itemscontainer/emby-itemscontainer'; import '../../elements/emby-itemscontainer/emby-itemscontainer';
import '../../elements/emby-button/emby-button'; import '../../elements/emby-button/emby-button';
import Dashboard from '../../scripts/clientUtils'; import Dashboard from '../../scripts/clientUtils';
import autoFocuser from '../../components/autoFocuser';
/* eslint-disable indent */ /* eslint-disable indent */
@ -129,10 +130,8 @@ import Dashboard from '../../scripts/clientUtils';
}); });
loading.hide(); loading.hide();
import('../../components/autoFocuser').then(({default: autoFocuser}) => {
autoFocuser.autoFocus(view); autoFocuser.autoFocus(view);
}); });
});
} }
function loadLatest(view, userId, parentId) { function loadLatest(view, userId, parentId) {
@ -170,10 +169,8 @@ import Dashboard from '../../scripts/clientUtils';
}); });
loading.hide(); loading.hide();
import('autoFocuser').then(({default: autoFocuser}) => {
autoFocuser.autoFocus(view); autoFocuser.autoFocus(view);
}); });
});
} }
function loadNextUp(view, userId, parentId) { function loadNextUp(view, userId, parentId) {
@ -211,10 +208,8 @@ import Dashboard from '../../scripts/clientUtils';
}); });
loading.hide(); loading.hide();
import('autoFocuser').then(({default: autoFocuser}) => {
autoFocuser.autoFocus(view); autoFocuser.autoFocus(view);
}); });
});
} }
function enableScrollX() { function enableScrollX() {

View file

@ -1,6 +1,6 @@
import QuickConnectSettings from 'quickConnectSettings'; import QuickConnectSettings from '../../../components/quickConnectSettings/quickConnectSettings';
import globalize from 'globalize'; import globalize from '../../../scripts/globalize';
import toast from 'toast'; import toast from '../../../components/toast/toast';
export default function (view) { export default function (view) {
let quickConnectSettingsInstance = null; let quickConnectSettingsInstance = null;

View file

@ -1,8 +1,9 @@
import loading from 'loading'; import { Archive } from 'libarchive.js/main.js';
import dialogHelper from 'dialogHelper'; import loading from '../../components/loading/loading';
import keyboardnavigation from 'keyboardnavigation'; import dialogHelper from '../../components/dialogHelper/dialogHelper';
import appRouter from 'appRouter'; import keyboardnavigation from '../../scripts/keyboardNavigation';
import * as libarchive from 'libarchive'; import { appRouter } from '../../components/appRouter';
import ServerConnections from '../../components/ServerConnections';
export class ComicsPlayer { export class ComicsPlayer {
constructor() { constructor() {
@ -93,9 +94,9 @@ export class ComicsPlayer {
loading.show(); loading.show();
const serverId = item.ServerId; const serverId = item.ServerId;
const apiClient = window.connectionManager.getApiClient(serverId); const apiClient = ServerConnections.getApiClient(serverId);
libarchive.Archive.init({ Archive.init({
workerUrl: appRouter.baseUrl() + '/libraries/worker-bundle.js' workerUrl: appRouter.baseUrl() + '/libraries/worker-bundle.js'
}); });
@ -175,7 +176,7 @@ class ArchiveSource {
} }
const blob = await res.blob(); const blob = await res.blob();
this.archive = await libarchive.Archive.open(blob); this.archive = await Archive.open(blob);
this.raw = await this.archive.getFilesArray(); this.raw = await this.archive.getFilesArray();
this.numberOfFiles = this.raw.length; this.numberOfFiles = this.raw.length;
await this.archive.extractFiles(); await this.archive.extractFiles();

View file

@ -125,7 +125,7 @@ export function alert(options) {
} }
export function capabilities(appHost) { export function capabilities(appHost) {
const capabilities = { let capabilities = {
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',

View file

@ -1,7 +1,8 @@
/* eslint-disable indent */ /* eslint-disable indent */
import { AppStorage, Events } from 'jellyfin-apiclient'; import { AppStorage, Events } from 'jellyfin-apiclient';
function getKey(name, userId) { class AppSettings {
#getKey(name, userId) {
if (userId) { if (userId) {
name = userId + '-' + name; name = userId + '-' + name;
} }
@ -9,46 +10,46 @@ import { AppStorage, Events } from 'jellyfin-apiclient';
return name; return name;
} }
export function enableAutoLogin(val) { enableAutoLogin(val) {
if (val !== undefined) { if (val !== undefined) {
set('enableAutoLogin', val.toString()); this.set('enableAutoLogin', val.toString());
} }
return get('enableAutoLogin') !== 'false'; return this.get('enableAutoLogin') !== 'false';
} }
export function enableSystemExternalPlayers(val) { enableSystemExternalPlayers(val) {
if (val !== undefined) { if (val !== undefined) {
set('enableSystemExternalPlayers', val.toString()); this.set('enableSystemExternalPlayers', val.toString());
} }
return get('enableSystemExternalPlayers') === 'true'; return this.get('enableSystemExternalPlayers') === 'true';
} }
export function enableAutomaticBitrateDetection(isInNetwork, mediaType, val) { enableAutomaticBitrateDetection(isInNetwork, mediaType, val) {
const key = 'enableautobitratebitrate-' + mediaType + '-' + isInNetwork; const key = 'enableautobitratebitrate-' + mediaType + '-' + isInNetwork;
if (val !== undefined) { if (val !== undefined) {
if (isInNetwork && mediaType === 'Audio') { if (isInNetwork && mediaType === 'Audio') {
val = true; val = true;
} }
set(key, val.toString()); this.set(key, val.toString());
} }
if (isInNetwork && mediaType === 'Audio') { if (isInNetwork && mediaType === 'Audio') {
return true; return true;
} else { } else {
return get(key) !== 'false'; return this.get(key) !== 'false';
} }
} }
export function maxStreamingBitrate(isInNetwork, mediaType, val) { maxStreamingBitrate(isInNetwork, mediaType, val) {
const key = 'maxbitrate-' + mediaType + '-' + isInNetwork; const key = 'maxbitrate-' + mediaType + '-' + isInNetwork;
if (val !== undefined) { if (val !== undefined) {
if (isInNetwork && mediaType === 'Audio') { if (isInNetwork && mediaType === 'Audio') {
// nothing to do, this is always a max value // nothing to do, this is always a max value
} else { } else {
set(key, val); this.set(key, val);
} }
} }
@ -56,50 +57,42 @@ import { AppStorage, Events } from 'jellyfin-apiclient';
// return a huge number so that it always direct plays // return a huge number so that it always direct plays
return 150000000; return 150000000;
} else { } else {
return parseInt(get(key) || '0') || 1500000; return parseInt(this.get(key) || '0') || 1500000;
} }
} }
export function maxStaticMusicBitrate(val) { maxStaticMusicBitrate(val) {
if (val !== undefined) { if (val !== undefined) {
set('maxStaticMusicBitrate', val); this.set('maxStaticMusicBitrate', val);
} }
const defaultValue = 320000; const defaultValue = 320000;
return parseInt(get('maxStaticMusicBitrate') || defaultValue.toString()) || defaultValue; return parseInt(this.get('maxStaticMusicBitrate') || defaultValue.toString()) || defaultValue;
} }
export function maxChromecastBitrate(val) { maxChromecastBitrate(val) {
if (val !== undefined) { if (val !== undefined) {
set('chromecastBitrate1', val); this.set('chromecastBitrate1', val);
} }
val = get('chromecastBitrate1'); val = this.get('chromecastBitrate1');
return val ? parseInt(val) : null; return val ? parseInt(val) : null;
} }
export function set(name, value, userId) { set(name, value, userId) {
const currentValue = get(name, userId); const currentValue = this.get(name, userId);
AppStorage.setItem(getKey(name, userId), value); AppStorage.setItem(this.#getKey(name, userId), value);
if (currentValue !== value) { if (currentValue !== value) {
Events.trigger(this, 'change', [name]); Events.trigger(this, 'change', [name]);
} }
} }
export function get(name, userId) { get(name, userId) {
return AppStorage.getItem(getKey(name, userId)); return AppStorage.getItem(this.#getKey(name, userId));
}
} }
/* eslint-enable indent */ /* eslint-enable indent */
export default { export default new AppSettings();
enableAutoLogin: enableAutoLogin,
enableSystemExternalPlayers: enableSystemExternalPlayers,
enableAutomaticBitrateDetection: enableAutomaticBitrateDetection,
maxStreamingBitrate: maxStreamingBitrate,
maxStaticMusicBitrate: maxStaticMusicBitrate,
maxChromecastBitrate: maxChromecastBitrate,
set: set,
get: get
};

718
yarn.lock

File diff suppressed because it is too large Load diff