From c4ab3eb9920548ad82e142d1635bee071b8b4a6b Mon Sep 17 00:00:00 2001 From: ilusi0n Date: Sun, 28 Aug 2022 11:22:43 +0100 Subject: [PATCH 1/2] add jellyseerr integration --- src/components/services/widget.jsx | 2 + .../services/widgets/service/jellyseerr.jsx | 51 +++++++++++++++++++ 2 files changed, 53 insertions(+) create mode 100644 src/components/services/widgets/service/jellyseerr.jsx diff --git a/src/components/services/widget.jsx b/src/components/services/widget.jsx index 142d790dc..926f1156f 100644 --- a/src/components/services/widget.jsx +++ b/src/components/services/widget.jsx @@ -10,6 +10,7 @@ import Rutorrent from "./widgets/service/rutorrent"; import Jellyfin from "./widgets/service/jellyfin"; import Speedtest from "./widgets/service/speedtest"; import Traefik from "./widgets/service/traefik"; +import Jellyseerr from "./widgets/service/jellyseerr"; const widgetMappings = { docker: Docker, @@ -24,6 +25,7 @@ const widgetMappings = { rutorrent: Rutorrent, speedtest: Speedtest, traefik: Traefik, + jellyseerr: Jellyseerr }; export default function Widget({ service }) { diff --git a/src/components/services/widgets/service/jellyseerr.jsx b/src/components/services/widgets/service/jellyseerr.jsx new file mode 100644 index 000000000..9d1ebad8c --- /dev/null +++ b/src/components/services/widgets/service/jellyseerr.jsx @@ -0,0 +1,51 @@ +import useSWR from "swr"; + +import Widget from "../widget"; +import Block from "../block"; + +export default function Jellyseerr({ service }) { + const config = service.widget; + + function buildApiUrl(endpoint) { + const { url } = config; + const reqUrl = new URL(`/api/v1/${endpoint}`, url); + return `/api/proxy?url=${encodeURIComponent(reqUrl)}`; + } + + const fetcher = async (url) => { + const res = await fetch(url, { + method: "GET", + withCredentials: true, + credentials: "include", + headers: { + "X-Api-Key": `${config.key}`, + "Content-Type": "application/json" + } + }); + return await res.json(); + }; + + const { data: statsData, error: statsError } = useSWR(buildApiUrl(`request/count`), fetcher); + + if (statsError) { + return ; + } + + if (!statsData) { + return ( + + + + + + ); + } + + return ( + + + + + + ); +} From 2d764ce59bd89a157fcc9873b4a5673de3bbe050 Mon Sep 17 00:00:00 2001 From: ilusi0n Date: Sun, 28 Aug 2022 11:27:45 +0100 Subject: [PATCH 2/2] update readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 58b8e80d3..d00815d59 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ - Docker Integration - Status light + CPU, Memory & Network Reporting *(click on the status light)* - Service Integration - - Currently supports Sonarr, Radarr, Ombi, Emby, Jellyfin, NZBGet, ruTorrent + - Currently supports Sonarr, Radarr, Ombi, Emby, Jellyfin, Jellyseerr, NZBGet, ruTorrent - Portainer, Traefik, Speedtest Tracker, PiHole * Homepage Widgets - System Stats (Disk, CPU, Memory)