Add constants for app features

This commit is contained in:
Bill Thornton
2025-04-30 17:41:36 -04:00
parent bb810a183a
commit fdcf1b06c3
34 changed files with 211 additions and 129 deletions
+4 -3
View File
@@ -21,6 +21,7 @@ import loading from 'components/loading/loading';
import { playbackManager } from 'components/playback/playbackmanager';
import { appRouter } from 'components/router/appRouter';
import itemShortcuts from 'components/shortcuts';
import { AppFeature } from 'constants/appFeature';
import globalize from 'lib/globalize';
import { ServerConnections } from 'lib/jellyfin-apiclient';
import browser from 'scripts/browser';
@@ -636,7 +637,7 @@ function reloadFromItem(instance, page, params, item, user) {
if (item.Type == 'Person' && item.ProductionLocations && item.ProductionLocations.length) {
let location = item.ProductionLocations[0];
if (!layoutManager.tv && appHost.supports('externallinks')) {
if (!layoutManager.tv && appHost.supports(AppFeature.ExternalLinks)) {
location = `<a is="emby-linkbutton" class="button-link textlink" target="_blank" href="https://www.openstreetmap.org/search?query=${encodeURIComponent(location)}">${escapeHtml(location)}</a>`;
} else {
location = escapeHtml(location);
@@ -650,7 +651,7 @@ function reloadFromItem(instance, page, params, item, user) {
setPeopleHeader(page, item);
loading.hide();
if (item.Type === 'Book' && item.CanDownload && appHost.supports('filedownload')) {
if (item.Type === 'Book' && item.CanDownload && appHost.supports(AppFeature.FileDownload)) {
hideAll(page, 'btnDownload', true);
}
@@ -1083,7 +1084,7 @@ function renderDetails(page, item, apiClient, context) {
renderLyricsContainer(page, item, apiClient);
// Don't allow redirection to other websites from the TV layout
if (!layoutManager.tv && appHost.supports('externallinks')) {
if (!layoutManager.tv && appHost.supports(AppFeature.ExternalLinks)) {
renderLinks(page, item);
}
+7 -4
View File
@@ -1,4 +1,10 @@
import escapeHtml from 'escape-html';
import { PlayerEvent } from 'apps/stable/features/playback/constants/playerEvent';
import { AppFeature } from 'constants/appFeature';
import { TICKS_PER_MINUTE, TICKS_PER_SECOND } from 'constants/time';
import { EventType } from 'types/eventType';
import { playbackManager } from '../../../components/playback/playbackmanager';
import browser from '../../../scripts/browser';
import dom from '../../../scripts/dom';
@@ -27,9 +33,6 @@ import LibraryMenu from '../../../scripts/libraryMenu';
import { setBackdropTransparency, TRANSPARENCY_LEVEL } from '../../../components/backdrop/backdrop';
import { pluginManager } from '../../../components/pluginManager';
import { PluginType } from '../../../types/plugin.ts';
import { EventType } from 'types/eventType';
import { TICKS_PER_MINUTE, TICKS_PER_SECOND } from 'constants/time';
import { PlayerEvent } from 'apps/stable/features/playback/constants/playerEvent';
function getOpenedDialog() {
return document.querySelector('.dialogContainer .dialog.opened');
@@ -872,7 +875,7 @@ export default function (view) {
showVolumeSlider = false;
}
if (player.isLocalPlayer && appHost.supports('physicalvolumecontrol')) {
if (player.isLocalPlayer && appHost.supports(AppFeature.PhysicalVolumeControl)) {
showMuteButton = false;
showVolumeSlider = false;
}
+5 -2
View File
@@ -1,5 +1,9 @@
import DOMPurify from 'dompurify';
import markdownIt from 'markdown-it';
import { AppFeature } from 'constants/appFeature';
import { ServerConnections } from 'lib/jellyfin-apiclient';
import { appHost } from '../../../components/apphost';
import appSettings from '../../../scripts/settings/appSettings';
import dom from '../../../scripts/dom';
@@ -15,7 +19,6 @@ import toast from '../../../components/toast/toast';
import dialogHelper from '../../../components/dialogHelper/dialogHelper';
import baseAlert from '../../../components/alert';
import { getDefaultBackgroundClass } from '../../../components/cardbuilder/cardBuilderUtils';
import { ServerConnections } from 'lib/jellyfin-apiclient';
import './login.scss';
@@ -263,7 +266,7 @@ export default function (view, params) {
loading.show();
libraryMenu.setTransparentMenu(true);
if (!appHost.supports('multiserver')) {
if (!appHost.supports(AppFeature.MultiServer)) {
view.querySelector('.btnSelectServer').classList.add('hide');
}