diff --git a/src/components/IssueDetails/index.tsx b/src/components/IssueDetails/index.tsx index 90cfb494c..346133896 100644 --- a/src/components/IssueDetails/index.tsx +++ b/src/components/IssueDetails/index.tsx @@ -366,13 +366,18 @@ const IssueDetails: React.FC = () => { > - {intl.formatMessage(messages.playonplex, { - mediaServerName: - settings.currentSettings.mediaServerType === + {process.env.JELLYFIN_TYPE == 'emby' + ? intl.formatMessage(messages.playonplex, { + mediaServerName: 'Emby', + }) + : settings.currentSettings.mediaServerType === MediaServerType.PLEX - ? 'Plex' - : 'Jellyfin', - })} + ? intl.formatMessage(messages.playonplex, { + mediaServerName: 'Plex', + }) + : intl.formatMessage(messages.playonplex, { + mediaServerName: 'Jellyfin', + })} )} @@ -407,13 +412,18 @@ const IssueDetails: React.FC = () => { > - {intl.formatMessage(messages.play4konplex, { - mediaServerName: - settings.currentSettings.mediaServerType === + {process.env.JELLYFIN_TYPE == 'emby' + ? intl.formatMessage(messages.play4konplex, { + mediaServerName: 'Emby', + }) + : settings.currentSettings.mediaServerType === MediaServerType.PLEX - ? 'Plex' - : 'Jellyfin', - })} + ? intl.formatMessage(messages.play4konplex, { + mediaServerName: 'Plex', + }) + : intl.formatMessage(messages.play4konplex, { + mediaServerName: 'Jellyfin', + })} )} @@ -618,13 +628,18 @@ const IssueDetails: React.FC = () => { > - {intl.formatMessage(messages.playonplex, { - mediaServerName: - settings.currentSettings.mediaServerType === + {process.env.JELLYFIN_TYPE == 'emby' + ? intl.formatMessage(messages.playonplex, { + mediaServerName: 'Emby', + }) + : settings.currentSettings.mediaServerType === MediaServerType.PLEX - ? 'Plex' - : 'Jellyfin', - })} + ? intl.formatMessage(messages.playonplex, { + mediaServerName: 'Plex', + }) + : intl.formatMessage(messages.playonplex, { + mediaServerName: 'Jellyfin', + })} )} @@ -659,13 +674,18 @@ const IssueDetails: React.FC = () => { > - {intl.formatMessage(messages.play4konplex, { - mediaServerName: - settings.currentSettings.mediaServerType === + {process.env.JELLYFIN_TYPE == 'emby' + ? intl.formatMessage(messages.play4konplex, { + mediaServerName: 'Emby', + }) + : settings.currentSettings.mediaServerType === MediaServerType.PLEX - ? 'Plex' - : 'Jellyfin', - })} + ? intl.formatMessage(messages.play4konplex, { + mediaServerName: 'Plex', + }) + : intl.formatMessage(messages.play4konplex, { + mediaServerName: 'Jellyfin', + })} )} diff --git a/src/components/Login/JellyfinLogin.tsx b/src/components/Login/JellyfinLogin.tsx index 540fb6fdc..bfc92fc82 100644 --- a/src/components/Login/JellyfinLogin.tsx +++ b/src/components/Login/JellyfinLogin.tsx @@ -11,9 +11,9 @@ import useSettings from '../../hooks/useSettings'; const messages = defineMessages({ username: 'Username', password: 'Password', - host: 'Jellyfin URL', + host: '{mediaServerName} URL', email: 'Email', - validationhostrequired: 'Jellyfin URL required', + validationhostrequired: '{mediaServerName} URL required', validationhostformat: 'Valid URL required', validationemailrequired: 'Email required', validationemailformat: 'Valid email required', @@ -46,9 +46,17 @@ const JellyfinLogin: React.FC = ({ host: Yup.string() .matches( /^(?:(?:(?:https?):)?\/\/)(?:\S+(?::\S*)?@)?(?:(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)(?:\.(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)*\.?)(?::\d{2,5})?(?:[/?#]\S*)?$/, - intl.formatMessage(messages.validationhostformat) + intl.formatMessage(messages.validationhostformat, { + mediaServerName: + process.env.JELLYFIN_TYPE == 'emby' ? 'Emby' : 'Jellyfin', + }) ) - .required(intl.formatMessage(messages.validationhostrequired)), + .required( + intl.formatMessage(messages.validationhostrequired, { + mediaServerName: + process.env.JELLYFIN_TYPE == 'emby' ? 'Emby' : 'Jellyfin', + }) + ), email: Yup.string() .email(intl.formatMessage(messages.validationemailformat)) .required(intl.formatMessage(messages.validationemailrequired)), @@ -97,7 +105,10 @@ const JellyfinLogin: React.FC = ({
@@ -105,7 +116,12 @@ const JellyfinLogin: React.FC = ({ id="host" name="host" type="text" - placeholder={intl.formatMessage(messages.host)} + placeholder={intl.formatMessage(messages.host, { + mediaServerName: + process.env.JELLYFIN_TYPE == 'emby' + ? 'Emby' + : 'Jellyfin', + })} />
{errors.host && touched.host && ( diff --git a/src/components/MovieDetails/index.tsx b/src/components/MovieDetails/index.tsx index fbbad4bd3..0ba0b9279 100644 --- a/src/components/MovieDetails/index.tsx +++ b/src/components/MovieDetails/index.tsx @@ -130,10 +130,7 @@ const MovieDetails: React.FC = ({ movie }) => { if (data.mediaInfo?.mediaUrl) { mediaLinks.push({ - text: - settings.currentSettings.mediaServerType === MediaServerType.JELLYFIN - ? intl.formatMessage(messages.play, { mediaServerName: 'Jellyfin' }) - : intl.formatMessage(messages.play, { mediaServerName: 'Plex' }), + text: getAvalaibleMediaServerName(), url: data.mediaInfo?.mediaUrl, svg: , }); @@ -146,10 +143,7 @@ const MovieDetails: React.FC = ({ movie }) => { }) ) { mediaLinks.push({ - text: - settings.currentSettings.mediaServerType === MediaServerType.JELLYFIN - ? intl.formatMessage(messages.play4k, { mediaServerName: 'Jellyfin' }) - : intl.formatMessage(messages.play4k, { mediaServerName: 'Plex' }), + text: getAvalaible4kMediaServerName(), url: data.mediaInfo?.mediaUrl4k, svg: , }); @@ -228,6 +222,30 @@ const MovieDetails: React.FC = ({ movie }) => { data?.watchProviders?.find((provider) => provider.iso_3166_1 === region) ?.flatrate ?? []; + function getAvalaibleMediaServerName() { + if (process.env.JELLYFIN_TYPE === 'emby') { + return intl.formatMessage(messages.play, { mediaServerName: 'Emby' }); + } + + if (settings.currentSettings.mediaServerType === MediaServerType.PLEX) { + return intl.formatMessage(messages.play, { mediaServerName: 'Plex' }); + } + + return intl.formatMessage(messages.play, { mediaServerName: 'Jellyfin' }); + } + + function getAvalaible4kMediaServerName() { + if (process.env.JELLYFIN_TYPE === 'emby') { + return intl.formatMessage(messages.play4k, { mediaServerName: 'Emby' }); + } + + if (settings.currentSettings.mediaServerType === MediaServerType.PLEX) { + return intl.formatMessage(messages.play4k, { mediaServerName: 'Plex' }); + } + + return intl.formatMessage(messages.play4k, { mediaServerName: 'Jellyfin' }); + } + return (
= ({ <>

- + {process.env.JELLYFIN_TYPE == 'emby' + ? intl.formatMessage(messages.jellyfinlibraries, { + mediaServerName: 'Emby', + }) + : intl.formatMessage(messages.jellyfinlibraries, { + mediaServerName: 'Jellyfin', + })}

- + {process.env.JELLYFIN_TYPE == 'emby' + ? intl.formatMessage(messages.jellyfinlibrariesDescription, { + mediaServerName: 'Emby', + }) + : intl.formatMessage(messages.jellyfinlibrariesDescription, { + mediaServerName: 'Jellyfin', + })}

@@ -201,7 +213,13 @@ const SettingsJellyfin: React.FC = ({

- + {process.env.JELLYFIN_TYPE == 'emby' + ? intl.formatMessage(messages.manualscanDescriptionJellyfin, { + mediaServerName: 'Emby', + }) + : intl.formatMessage(messages.manualscanDescriptionJellyfin, { + mediaServerName: 'Jellyfin', + })}

@@ -305,10 +323,22 @@ const SettingsJellyfin: React.FC = ({ <>

- {intl.formatMessage(messages.jellyfinSettings)} + {process.env.JELLYFIN_TYPE == 'emby' + ? intl.formatMessage(messages.jellyfinSettings, { + mediaServerName: 'Emby', + }) + : intl.formatMessage(messages.jellyfinSettings, { + mediaServerName: 'Jellyfin', + })}

- {intl.formatMessage(messages.jellyfinSettingsDescription)} + {process.env.JELLYFIN_TYPE == 'emby' + ? intl.formatMessage(messages.jellyfinSettingsDescription, { + mediaServerName: 'Emby', + }) + : intl.formatMessage(messages.jellyfinSettingsDescription, { + mediaServerName: 'Jellyfin', + })}

= ({ externalHostname: values.jellyfinExternalUrl, } as JellyfinSettings); - addToast(intl.formatMessage(messages.jellyfinSettingsSuccess), { - autoDismiss: true, - appearance: 'success', - }); + addToast( + intl.formatMessage(messages.jellyfinSettingsSuccess, { + mediaServerName: + process.env.JELLYFIN_TYPE == 'emby' ? 'Emby' : 'Jellyfin', + }), + { + autoDismiss: true, + appearance: 'success', + } + ); } catch (e) { - addToast(intl.formatMessage(messages.jellyfinSettingsFailure), { - autoDismiss: true, - appearance: 'error', - }); + addToast( + intl.formatMessage(messages.jellyfinSettingsFailure, { + mediaServerName: + process.env.JELLYFIN_TYPE == 'emby' ? 'Emby' : 'Jellyfin', + }), + { + autoDismiss: true, + appearance: 'error', + } + ); } finally { revalidate(); } diff --git a/src/components/Settings/SettingsLayout.tsx b/src/components/Settings/SettingsLayout.tsx index f2fa90784..23af1c632 100644 --- a/src/components/Settings/SettingsLayout.tsx +++ b/src/components/Settings/SettingsLayout.tsx @@ -8,7 +8,7 @@ const messages = defineMessages({ menuGeneralSettings: 'General', menuUsers: 'Users', menuPlexSettings: 'Plex', - menuJellyfinSettings: 'Jellyfin', + menuJellyfinSettings: '{mediaServerName}', menuServices: 'Services', menuNotifications: 'Notifications', menuLogs: 'Logs', @@ -18,7 +18,6 @@ const messages = defineMessages({ const SettingsLayout: React.FC = ({ children }) => { const intl = useIntl(); - const settingsRoutes: SettingsRoute[] = [ { text: intl.formatMessage(messages.menuGeneralSettings), @@ -36,7 +35,7 @@ const SettingsLayout: React.FC = ({ children }) => { regex: /^\/settings\/plex/, }, { - text: intl.formatMessage(messages.menuJellyfinSettings), + text: getAvalaibleMediaServerName(), route: '/settings/jellyfin', regex: /^\/settings\/jellyfin/, }, @@ -76,6 +75,17 @@ const SettingsLayout: React.FC = ({ children }) => {
{children}
); + function getAvalaibleMediaServerName() { + if (process.env.JELLYFIN_TYPE === 'emby') { + return intl.formatMessage(messages.menuJellyfinSettings, { + mediaServerName: 'Emby', + }); + } + + return intl.formatMessage(messages.menuJellyfinSettings, { + mediaServerName: 'Jellyfin', + }); + } }; export default SettingsLayout; diff --git a/src/components/Settings/SettingsUsers/index.tsx b/src/components/Settings/SettingsUsers/index.tsx index d53a619bf..03232f884 100644 --- a/src/components/Settings/SettingsUsers/index.tsx +++ b/src/components/Settings/SettingsUsers/index.tsx @@ -131,16 +131,20 @@ const SettingsUsers: React.FC = () => {