Add Jellyseerr full support

This commit is contained in:
ajnart
2022-08-09 13:26:55 +02:00
parent c157c94d95
commit 67a274804f
7 changed files with 11 additions and 8 deletions

View File

@@ -254,6 +254,7 @@ export function AddAppShelfItemForm(props: { setOpened: (b: boolean) => void } &
form.values.type === 'Radarr' ||
form.values.type === 'Lidarr' ||
form.values.type === 'Overseerr' ||
form.values.type === 'Jellyseerr' ||
form.values.type === 'Readarr') && (
<>
<TextInput

View File

@@ -186,12 +186,12 @@ export function MediaDisplay({ media }: { media: IMedia }) {
</Text>
</Stack>
<Group grow>
{media.plexUrl && (
{(media.plexUrl || media.mediaUrl) && (
<Button
component="a"
target="_blank"
variant="outline"
href={media.plexUrl}
href={media.plexUrl ?? media.mediaUrl}
size="sm"
rightIcon={<IconPlayerPlay size={15} />}
>

View File

@@ -4,7 +4,7 @@ import { IModule } from '../ModuleTypes';
export const OverseerrModule: IModule = {
title: 'Overseerr',
description: 'Allows you to search and add media from Overseerr',
description: 'Allows you to search and add media from Overseerr/Jellyseerr',
icon: IconEyeglass,
component: OverseerrMediaDisplay,
};

View File

@@ -38,7 +38,7 @@ export default function SearchBar(props: any) {
const { config } = useConfig();
const isModuleEnabled = config.modules?.[SearchModule.title]?.enabled ?? false;
const isOverseerrEnabled = config.modules?.[OverseerrModule.title]?.enabled ?? false;
const OverseerrService = config.services.find((service) => service.type === 'Overseerr');
const OverseerrService = config.services.find((service) => service.type === 'Overseerr' || service.type === 'Jellyseerr');
const queryUrl = config.settings.searchUrl ?? 'https://www.google.com/search?q=';
const [OverseerrResults, setOverseerrResults] = useState<any[]>([]);
@@ -61,7 +61,7 @@ export default function SearchBar(props: any) {
if (OverseerrService === undefined && isOverseerrEnabled) {
showNotification({
title: 'Overseerr integration',
message: 'Module enabled but no service is configured with the type "Overseerr"',
message: 'Module enabled but no service is configured with the type "Overseerr" / "Jellyseerr"',
color: 'red',
});
}

View File

@@ -11,7 +11,7 @@ async function Get(req: NextApiRequest, res: NextApiResponse) {
const { id, type } = req.query as { id: string; type: string };
const configName = getCookie('config-name', { req });
const { config }: { config: Config } = getConfig(configName?.toString() ?? 'default').props;
const service = config.services.find((service) => service.type === 'Overseerr');
const service = config.services.find((service) => service.type === 'Overseerr' || service.type === 'Jellyseerr');
if (!id) {
return res.status(400).json({ error: 'No id provided' });
}
@@ -70,7 +70,7 @@ async function Post(req: NextApiRequest, res: NextApiResponse) {
const { seasons, type } = req.body as { seasons?: number[]; type: MediaType };
const configName = getCookie('config-name', { req });
const { config }: { config: Config } = getConfig(configName?.toString() ?? 'default').props;
const service = config.services.find((service) => service.type === 'Overseerr');
const service = config.services.find((service) => service.type === 'Overseerr' || service.type === 'Jellyseerr');
if (!id) {
return res.status(400).json({ error: 'No id provided' });
}

View File

@@ -8,7 +8,7 @@ async function Get(req: NextApiRequest, res: NextApiResponse) {
const configName = getCookie('config-name', { req });
const { config }: { config: Config } = getConfig(configName?.toString() ?? 'default').props;
const { query } = req.query;
const service = config.services.find((service) => service.type === 'Overseerr');
const service = config.services.find((service) => service.type === 'Overseerr' || service.type === 'Jellyseerr');
// If query is an empty string, return an empty array
if (query === '' || query === undefined) {
return res.status(200).json([]);

View File

@@ -71,6 +71,7 @@ export const ServiceTypeList = [
'Sonarr',
'Transmission',
'Overseerr',
'Jellyseerr',
];
export type ServiceType =
| 'Other'
@@ -84,6 +85,7 @@ export type ServiceType =
| 'Readarr'
| 'Sonarr'
| 'Overseerr'
| 'Jellyseerr'
| 'Transmission';
export function tryMatchPort(name: string | undefined, form?: any) {