fix(ui): fix ui elements not reflecting the env variable
Fix emby ui elements not reflecting the emby env variable set during runtime
This commit is contained in:
@@ -8,6 +8,7 @@ import useSettings from '../../hooks/useSettings';
|
||||
import globalMessages from '../../i18n/globalMessages';
|
||||
import Alert from '../Common/Alert';
|
||||
import Modal from '../Common/Modal';
|
||||
import getConfig from 'next/config';
|
||||
|
||||
interface JellyfinImportProps {
|
||||
onCancel?: () => void;
|
||||
@@ -32,6 +33,7 @@ const JellyfinImportModal: React.FC<JellyfinImportProps> = ({
|
||||
}) => {
|
||||
const intl = useIntl();
|
||||
const settings = useSettings();
|
||||
const { publicRuntimeConfig } = getConfig();
|
||||
const { addToast } = useToasts();
|
||||
const [isImporting, setImporting] = useState(false);
|
||||
const [selectedUsers, setSelectedUsers] = useState<string[]>([]);
|
||||
@@ -67,7 +69,7 @@ const JellyfinImportModal: React.FC<JellyfinImportProps> = ({
|
||||
return <strong>{msg}</strong>;
|
||||
},
|
||||
mediaServerName:
|
||||
process.env.JELLYFIN_TYPE == 'emby' ? 'Emby' : 'Jellyfin',
|
||||
publicRuntimeConfig.JELLYFIN_TYPE == 'emby' ? 'Emby' : 'Jellyfin',
|
||||
}),
|
||||
{
|
||||
autoDismiss: true,
|
||||
@@ -82,7 +84,7 @@ const JellyfinImportModal: React.FC<JellyfinImportProps> = ({
|
||||
addToast(
|
||||
intl.formatMessage(messages.importfromJellyfinerror, {
|
||||
mediaServerName:
|
||||
process.env.JELLYFIN_TYPE == 'emby' ? 'Emby' : 'Jellyfin',
|
||||
publicRuntimeConfig.JELLYFIN_TYPE == 'emby' ? 'Emby' : 'Jellyfin',
|
||||
}),
|
||||
{
|
||||
autoDismiss: true,
|
||||
@@ -120,7 +122,7 @@ const JellyfinImportModal: React.FC<JellyfinImportProps> = ({
|
||||
loading={!data && !error}
|
||||
title={intl.formatMessage(messages.importfromJellyfin, {
|
||||
mediaServerName:
|
||||
process.env.JELLYFIN_TYPE == 'emby' ? 'Emby' : 'Jellyfin',
|
||||
publicRuntimeConfig.JELLYFIN_TYPE == 'emby' ? 'Emby' : 'Jellyfin',
|
||||
})}
|
||||
iconSvg={<InboxInIcon />}
|
||||
onOk={() => {
|
||||
@@ -138,7 +140,9 @@ const JellyfinImportModal: React.FC<JellyfinImportProps> = ({
|
||||
<Alert
|
||||
title={intl.formatMessage(messages.newJellyfinsigninenabled, {
|
||||
mediaServerName:
|
||||
process.env.JELLYFIN_TYPE == 'emby' ? 'Emby' : 'Jellyfin',
|
||||
publicRuntimeConfig.JELLYFIN_TYPE == 'emby'
|
||||
? 'Emby'
|
||||
: 'Jellyfin',
|
||||
strong: function strong(msg) {
|
||||
return (
|
||||
<strong className="font-semibold text-white">{msg}</strong>
|
||||
@@ -255,7 +259,7 @@ const JellyfinImportModal: React.FC<JellyfinImportProps> = ({
|
||||
<Alert
|
||||
title={intl.formatMessage(messages.noJellyfinuserstoimport, {
|
||||
mediaServerName:
|
||||
process.env.JELLYFIN_TYPE == 'emby' ? 'Emby' : 'Jellyfin',
|
||||
publicRuntimeConfig.JELLYFIN_TYPE == 'emby' ? 'Emby' : 'Jellyfin',
|
||||
})}
|
||||
type="info"
|
||||
/>
|
||||
|
||||
@@ -36,6 +36,7 @@ import Transition from '../Transition';
|
||||
import BulkEditModal from './BulkEditModal';
|
||||
import JellyfinImportModal from './JellyfinImportModal';
|
||||
import PlexImportModal from './PlexImportModal';
|
||||
import getConfig from 'next/config';
|
||||
|
||||
const messages = defineMessages({
|
||||
users: 'Users',
|
||||
@@ -87,6 +88,7 @@ const UserList: React.FC = () => {
|
||||
const intl = useIntl();
|
||||
const router = useRouter();
|
||||
const settings = useSettings();
|
||||
const { publicRuntimeConfig } = getConfig();
|
||||
const { addToast } = useToasts();
|
||||
const { user: currentUser, hasPermission: currentHasPermission } = useUser();
|
||||
const [currentSort, setCurrentSort] = useState<Sort>('displayname');
|
||||
@@ -503,7 +505,7 @@ const UserList: React.FC = () => {
|
||||
>
|
||||
<InboxInIcon />
|
||||
<span>
|
||||
{process.env.JELLYFIN_TYPE == 'emby'
|
||||
{publicRuntimeConfig.JELLYFIN_TYPE == 'emby'
|
||||
? intl.formatMessage(messages.importfromplex, {
|
||||
mediaServerName: 'Emby',
|
||||
})
|
||||
@@ -645,7 +647,7 @@ const UserList: React.FC = () => {
|
||||
<Badge badgeType="default">
|
||||
{intl.formatMessage(messages.localuser)}
|
||||
</Badge>
|
||||
) : process.env.JELLYFIN_TYPE == 'emby' ? (
|
||||
) : publicRuntimeConfig.JELLYFIN_TYPE == 'emby' ? (
|
||||
<Badge badgeType="success">
|
||||
{intl.formatMessage(messages.mediaServerUser, {
|
||||
mediaServerName: 'Emby',
|
||||
|
||||
Reference in New Issue
Block a user