Fixed a bug that caused some artist to crash the discover page if recently added and fixed the lidarr setting pop up not displaying the current lidarr installation

pull/3800/merge^2
Anatole Sot 4 months ago
parent 3013fbdb2e
commit fc507244cd

@ -17,12 +17,14 @@ function getPosterFromMB(
}); });
try { try {
const artist = (lidarr as LidarrAPI).getArtist(element.id); const artist = (lidarr as LidarrAPI).getArtist(element.id);
return LidarrAPI.buildUrl( if (artist.images.find((i) => i.coverType === 'poster')?.url) {
lidarrSettings, return LidarrAPI.buildUrl(
(artist.images ?? [{ coverType: 'poster', url: undefined }]).find( lidarrSettings,
(i) => i.coverType === 'poster' artist.images.find((i) => i.coverType === 'poster')?.url
)?.url );
); } else {
return undefined;
}
} catch (e) { } catch (e) {
return undefined; return undefined;
} }

@ -17,7 +17,6 @@ const CachedImage = ({ src, ...props }: ImageProps) => {
setImageUrl(currentSettings?.fallbackImage); setImageUrl(currentSettings?.fallbackImage);
}; };
if (typeof imageUrl === 'string' && imageUrl.startsWith('http')) { if (typeof imageUrl === 'string' && imageUrl.startsWith('http')) {
const parsedUrl = new URL(imageUrl); const parsedUrl = new URL(imageUrl);
@ -26,8 +25,15 @@ const CachedImage = ({ src, ...props }: ImageProps) => {
} }
} }
return (
return <Image unoptimized loader={imageLoader} src={imageUrl} onError={handleError} {...props} />; <Image
unoptimized
loader={imageLoader}
src={imageUrl}
onError={handleError}
{...props}
/>
);
}; };
export default CachedImage; export default CachedImage;

@ -1,19 +1,23 @@
import LidarrLogo from '@app/assets/services/lidarr.svg';
import RadarrLogo from '@app/assets/services/radarr.svg'; import RadarrLogo from '@app/assets/services/radarr.svg';
import SonarrLogo from '@app/assets/services/sonarr.svg'; import SonarrLogo from '@app/assets/services/sonarr.svg';
import LidarrLogo from '@app/assets/services/lidarr.svg';
import Alert from '@app/components/Common/Alert'; import Alert from '@app/components/Common/Alert';
import Badge from '@app/components/Common/Badge'; import Badge from '@app/components/Common/Badge';
import Button from '@app/components/Common/Button'; import Button from '@app/components/Common/Button';
import LoadingSpinner from '@app/components/Common/LoadingSpinner'; import LoadingSpinner from '@app/components/Common/LoadingSpinner';
import Modal from '@app/components/Common/Modal'; import Modal from '@app/components/Common/Modal';
import PageTitle from '@app/components/Common/PageTitle'; import PageTitle from '@app/components/Common/PageTitle';
import LidarrModal from '@app/components/Settings/LidarrModal';
import RadarrModal from '@app/components/Settings/RadarrModal'; import RadarrModal from '@app/components/Settings/RadarrModal';
import SonarrModal from '@app/components/Settings/SonarrModal'; import SonarrModal from '@app/components/Settings/SonarrModal';
import LidarrModal from '@app/components/Settings/LidarrModal';
import globalMessages from '@app/i18n/globalMessages'; import globalMessages from '@app/i18n/globalMessages';
import { Transition } from '@headlessui/react'; import { Transition } from '@headlessui/react';
import { PencilIcon, PlusIcon, TrashIcon } from '@heroicons/react/24/solid'; import { PencilIcon, PlusIcon, TrashIcon } from '@heroicons/react/24/solid';
import type { RadarrSettings, SonarrSettings, LidarrSettings } from '@server/lib/settings'; import type {
LidarrSettings,
RadarrSettings,
SonarrSettings,
} from '@server/lib/settings';
import axios from 'axios'; import axios from 'axios';
import { Fragment, useState } from 'react'; import { Fragment, useState } from 'react';
import { defineMessages, useIntl } from 'react-intl'; import { defineMessages, useIntl } from 'react-intl';
@ -269,7 +273,7 @@ const SettingsServices = () => {
)} )}
{editLidarrModal.open && ( {editLidarrModal.open && (
<LidarrModal <LidarrModal
sonarr={editLidarrModal.lidarr} lidarr={editLidarrModal.lidarr}
onClose={() => setEditLidarrModal({ open: false, lidarr: null })} onClose={() => setEditLidarrModal({ open: false, lidarr: null })}
onSave={() => { onSave={() => {
revalidateLidarr(); revalidateLidarr();
@ -301,7 +305,11 @@ const SettingsServices = () => {
} }
title={intl.formatMessage(messages.deleteServer, { title={intl.formatMessage(messages.deleteServer, {
serverType: serverType:
deleteServerModal.type === 'radarr' ? 'Radarr' : (deleteServerModal.type === 'sonarr' ? 'Sonarr' : 'Lidarr'), deleteServerModal.type === 'radarr'
? 'Radarr'
: deleteServerModal.type === 'sonarr'
? 'Sonarr'
: 'Lidarr',
})} })}
> >
{intl.formatMessage(messages.deleteserverconfirm)} {intl.formatMessage(messages.deleteserverconfirm)}
@ -495,8 +503,7 @@ const SettingsServices = () => {
mediaType: intl.formatMessage(messages.mediaTypeSeries), mediaType: intl.formatMessage(messages.mediaTypeSeries),
})} })}
/> />
) : null ) : null)}
)}
<ul className="grid max-w-6xl grid-cols-1 gap-6 lg:grid-cols-2 xl:grid-cols-3"> <ul className="grid max-w-6xl grid-cols-1 gap-6 lg:grid-cols-2 xl:grid-cols-3">
{lidarrData.map((lidarr) => ( {lidarrData.map((lidarr) => (
<ServerInstance <ServerInstance

Loading…
Cancel
Save