From 739f5f9c9ade8a1680bcb374f6c9e919a9e1426c Mon Sep 17 00:00:00 2001 From: notfakie <103784113+notfakie@users.noreply.github.com> Date: Thu, 2 Jun 2022 18:47:22 +1200 Subject: [PATCH 1/3] fix: only show mediaserver settings for current active mediaserver --- src/components/Settings/SettingsLayout.tsx | 37 +++++++++++----------- 1 file changed, 18 insertions(+), 19 deletions(-) diff --git a/src/components/Settings/SettingsLayout.tsx b/src/components/Settings/SettingsLayout.tsx index 3963d5c5e..3de72f4a7 100644 --- a/src/components/Settings/SettingsLayout.tsx +++ b/src/components/Settings/SettingsLayout.tsx @@ -1,9 +1,11 @@ +import getConfig from 'next/config'; import React from 'react'; import { defineMessages, useIntl } from 'react-intl'; +import { MediaServerType } from '../../../server/constants/server'; +import useSettings from '../../hooks/useSettings'; import globalMessages from '../../i18n/globalMessages'; import PageTitle from '../Common/PageTitle'; import SettingsTabs, { SettingsRoute } from '../Common/SettingsTabs'; -import getConfig from 'next/config'; const messages = defineMessages({ menuGeneralSettings: 'General', @@ -20,6 +22,7 @@ const messages = defineMessages({ const SettingsLayout: React.FC = ({ children }) => { const intl = useIntl(); const { publicRuntimeConfig } = getConfig(); + const settings = useSettings(); const settingsRoutes: SettingsRoute[] = [ { text: intl.formatMessage(messages.menuGeneralSettings), @@ -31,16 +34,17 @@ const SettingsLayout: React.FC = ({ children }) => { route: '/settings/users', regex: /^\/settings\/users/, }, - { - text: intl.formatMessage(messages.menuPlexSettings), - route: '/settings/plex', - regex: /^\/settings\/plex/, - }, - { - text: getAvalaibleMediaServerName(), - route: '/settings/jellyfin', - regex: /^\/settings\/jellyfin/, - }, + settings.currentSettings.mediaServerType === MediaServerType.PLEX + ? { + text: intl.formatMessage(messages.menuPlexSettings), + route: '/settings/plex', + regex: /^\/settings\/plex/, + } + : { + text: getAvailableMediaServerName(), + route: '/settings/jellyfin', + regex: /^\/settings\/jellyfin/, + }, { text: intl.formatMessage(messages.menuServices), route: '/settings/services', @@ -77,15 +81,10 @@ const SettingsLayout: React.FC = ({ children }) => {
{children}
); - function getAvalaibleMediaServerName() { - if (publicRuntimeConfig.JELLYFIN_TYPE === 'emby') { - return intl.formatMessage(messages.menuJellyfinSettings, { - mediaServerName: 'Emby', - }); - } - + function getAvailableMediaServerName() { return intl.formatMessage(messages.menuJellyfinSettings, { - mediaServerName: 'Jellyfin', + mediaServerName: + publicRuntimeConfig.JELLYFIN_TYPE === 'emby' ? 'Emby' : 'Jellyfin', }); } }; From 4b7bdd3d7d608fe0bf52f494766fd7c40bede859 Mon Sep 17 00:00:00 2001 From: notfakie <103784113+notfakie@users.noreply.github.com> Date: Thu, 2 Jun 2022 18:47:25 +1200 Subject: [PATCH 2/3] fix: remove internal Overseerr sponsor link, this is remaining on the main github page instead --- .../Settings/SettingsAbout/index.tsx | 29 ------------------- 1 file changed, 29 deletions(-) diff --git a/src/components/Settings/SettingsAbout/index.tsx b/src/components/Settings/SettingsAbout/index.tsx index ab79b11cd..1afe948dc 100644 --- a/src/components/Settings/SettingsAbout/index.tsx +++ b/src/components/Settings/SettingsAbout/index.tsx @@ -188,35 +188,6 @@ const SettingsAbout: React.FC = () => { -
- - - - https://github.com/sponsors/sct - - - {intl.formatMessage(messages.preferredmethod)} - - - - - https://patreon.com/overseerr - - - -
From 7450138ac12640797952c1a2d5e1e111d17a11e1 Mon Sep 17 00:00:00 2001 From: notfakie <103784113+notfakie@users.noreply.github.com> Date: Thu, 2 Jun 2022 18:47:27 +1200 Subject: [PATCH 3/3] fix: hide plex guid cache settings from ui when running in jellyfin/emby mode --- .../Settings/SettingsJobsCache/index.tsx | 46 ++++++++++++------- 1 file changed, 30 insertions(+), 16 deletions(-) diff --git a/src/components/Settings/SettingsJobsCache/index.tsx b/src/components/Settings/SettingsJobsCache/index.tsx index 35e445cba..cfe8c4bfc 100644 --- a/src/components/Settings/SettingsJobsCache/index.tsx +++ b/src/components/Settings/SettingsJobsCache/index.tsx @@ -10,9 +10,11 @@ import { } from 'react-intl'; import { useToasts } from 'react-toast-notifications'; import useSWR from 'swr'; +import { MediaServerType } from '../../../../server/constants/server'; import { CacheItem } from '../../../../server/interfaces/api/settingsInterfaces'; import { JobId } from '../../../../server/lib/settings'; import Spinner from '../../../assets/spinner.svg'; +import useSettings from '../../../hooks/useSettings'; import globalMessages from '../../../i18n/globalMessages'; import { formatBytes } from '../../../utils/numberHelpers'; import Badge from '../../Common/Badge'; @@ -102,6 +104,7 @@ const SettingsJobs: React.FC = () => { const [isSaving, setIsSaving] = useState(false); const [jobScheduleMinutes, setJobScheduleMinutes] = useState(5); const [jobScheduleHours, setJobScheduleHours] = useState(1); + const settings = useSettings(); if (!data && !error) { return ; @@ -369,22 +372,33 @@ const SettingsJobs: React.FC = () => { - {cacheData?.map((cache) => ( - - {cache.name} - {intl.formatNumber(cache.stats.hits)} - {intl.formatNumber(cache.stats.misses)} - {intl.formatNumber(cache.stats.keys)} - {formatBytes(cache.stats.ksize)} - {formatBytes(cache.stats.vsize)} - - - - - ))} + {cacheData + ?.filter( + (cache) => + !( + settings.currentSettings.mediaServerType !== + MediaServerType.PLEX && cache.id === 'plexguid' + ) + ) + .map((cache) => ( + + {cache.name} + {intl.formatNumber(cache.stats.hits)} + {intl.formatNumber(cache.stats.misses)} + {intl.formatNumber(cache.stats.keys)} + {formatBytes(cache.stats.ksize)} + {formatBytes(cache.stats.vsize)} + + + + + ))}