diff --git a/public/locales/de/common.json b/public/locales/de/common.json index d3ff6e716..0083a337d 100644 --- a/public/locales/de/common.json +++ b/public/locales/de/common.json @@ -101,5 +101,11 @@ "apps": "Anwendungen", "clients": "Kunden", "messages": "Mitteilungen" + }, + "sabnzbd": { + "status": "Status", + "speed": "Speed", + "remaining": "Remaining", + "timeleft": "Time left" } } diff --git a/public/locales/en/common.json b/public/locales/en/common.json index c71ac966d..155aae4a5 100644 --- a/public/locales/en/common.json +++ b/public/locales/en/common.json @@ -112,5 +112,11 @@ "apps": "Applications", "clients": "Clients", "messages": "Messages" + }, + "sabnzbd": { + "status": "Status", + "speed": "Speed", + "remaining": "Remaining", + "timeleft": "Time left" } } diff --git a/public/locales/es/common.json b/public/locales/es/common.json index 21bc68234..5889917b9 100644 --- a/public/locales/es/common.json +++ b/public/locales/es/common.json @@ -101,5 +101,11 @@ "apps": "Aplicaciones", "clients": "Clientela", "messages": "Mensajes" + }, + "sabnzbd": { + "status": "Status", + "speed": "Speed", + "remaining": "Remaining", + "timeleft": "Time left" } } diff --git a/public/locales/fr/common.json b/public/locales/fr/common.json index ac3f7e392..fe980f4b3 100644 --- a/public/locales/fr/common.json +++ b/public/locales/fr/common.json @@ -112,5 +112,11 @@ "apps": "Applications", "clients": "Clients", "messages": "Messages" + }, + "sabnzbd": { + "status": "Status", + "speed": "Speed", + "remaining": "Remaining", + "timeleft": "Time left" } } diff --git a/public/locales/it/common.json b/public/locales/it/common.json index b9ddbacce..b9357ef04 100644 --- a/public/locales/it/common.json +++ b/public/locales/it/common.json @@ -101,5 +101,11 @@ "apps": "Applications", "clients": "Clients", "messages": "Messages" + }, + "sabnzbd": { + "status": "Status", + "speed": "Speed", + "remaining": "Remaining", + "timeleft": "Time left" } } diff --git a/public/locales/nb-NO/common.json b/public/locales/nb-NO/common.json index e273650c8..d6af78204 100644 --- a/public/locales/nb-NO/common.json +++ b/public/locales/nb-NO/common.json @@ -101,5 +101,11 @@ "apps": "Applications", "clients": "Clients", "messages": "Messages" + }, + "sabnzbd": { + "status": "Status", + "speed": "Speed", + "remaining": "Remaining", + "timeleft": "Time left" } } diff --git a/public/locales/nl/common.json b/public/locales/nl/common.json index 8377a56d6..d4d28a0ba 100644 --- a/public/locales/nl/common.json +++ b/public/locales/nl/common.json @@ -101,5 +101,11 @@ "apps": "Applications", "clients": "Clients", "messages": "Messages" + }, + "sabnzbd": { + "status": "Status", + "speed": "Speed", + "remaining": "Remaining", + "timeleft": "Time left" } } diff --git a/public/locales/pt/common.json b/public/locales/pt/common.json index ab25e1910..a5cabc23a 100644 --- a/public/locales/pt/common.json +++ b/public/locales/pt/common.json @@ -112,5 +112,11 @@ "apps": "Aplicações", "clients": "Clientes", "messages": "Mensagens" + }, + "sabnzbd": { + "status": "Status", + "speed": "Speed", + "remaining": "Remaining", + "timeleft": "Time left" } } diff --git a/public/locales/ru/common.json b/public/locales/ru/common.json index 121e8673b..9b3984be6 100644 --- a/public/locales/ru/common.json +++ b/public/locales/ru/common.json @@ -101,5 +101,11 @@ "apps": "Aplicações", "clients": "Clientes", "messages": "Mensagens" + }, + "sabnzbd": { + "status": "Status", + "speed": "Speed", + "remaining": "Remaining", + "timeleft": "Time left" } } diff --git a/public/locales/vi/common.json b/public/locales/vi/common.json index 519c2ab6b..8396fed84 100644 --- a/public/locales/vi/common.json +++ b/public/locales/vi/common.json @@ -101,5 +101,11 @@ "apps": "Aplicações", "clients": "Clientes", "messages": "Mensagens" + }, + "sabnzbd": { + "status": "Status", + "speed": "Speed", + "remaining": "Remaining", + "timeleft": "Time left" } } diff --git a/public/locales/zh-CN/common.json b/public/locales/zh-CN/common.json index bb7e66a35..a7f504f16 100644 --- a/public/locales/zh-CN/common.json +++ b/public/locales/zh-CN/common.json @@ -101,5 +101,11 @@ "apps": "Aplicações", "clients": "Clientes", "messages": "Mensagens" + }, + "sabnzbd": { + "status": "Status", + "speed": "Speed", + "remaining": "Remaining", + "timeleft": "Time left" } } diff --git a/src/components/services/widget.jsx b/src/components/services/widget.jsx index f55f3a6d9..0712c7f3c 100644 --- a/src/components/services/widget.jsx +++ b/src/components/services/widget.jsx @@ -17,6 +17,7 @@ import Overseerr from "./widgets/service/overseerr"; import Npm from "./widgets/service/npm"; import Tautulli from "./widgets/service/tautulli"; import Gotify from "./widgets/service/gotify"; +import Sabnzbd from "./widgets/service/sabnzbd"; const widgetMappings = { docker: Docker, @@ -36,6 +37,7 @@ const widgetMappings = { npm: Npm, tautulli: Tautulli, gotify: Gotify, + sabnzbd: Sabnzbd }; export default function Widget({ service }) { diff --git a/src/components/services/widgets/service/sabnzbd.jsx b/src/components/services/widgets/service/sabnzbd.jsx new file mode 100644 index 000000000..fbafc4b57 --- /dev/null +++ b/src/components/services/widgets/service/sabnzbd.jsx @@ -0,0 +1,41 @@ +import useSWR from "swr"; +import { useTranslation } from "react-i18next"; + +import Widget from "../widget"; +import Block from "../block"; + +import { formatApiUrl } from "utils/api-helpers"; + +export default function Sabnzbd({ service }) { + const { t } = useTranslation("common"); + + const config = service.widget; + const { data: statusData, error: statusError } = useSWR(formatApiUrl(config, "mode=queue")); + + if (statusError) { + return ; + } + + if (!statusData) { + return ( + + + + + + + ); + } + + return ( + + + + + + + ); +} diff --git a/src/pages/api/services/proxy.js b/src/pages/api/services/proxy.js index efa691931..c1737b0c1 100644 --- a/src/pages/api/services/proxy.js +++ b/src/pages/api/services/proxy.js @@ -14,6 +14,7 @@ const serviceProxyHandlers = { speedtest: genericProxyHandler, tautulli: genericProxyHandler, traefik: genericProxyHandler, + sabnzbd: genericProxyHandler, // uses X-API-Key header auth gotify: credentialedProxyHandler, portainer: credentialedProxyHandler, diff --git a/src/utils/api-helpers.js b/src/utils/api-helpers.js index cc7c5e11a..7b53c02c2 100644 --- a/src/utils/api-helpers.js +++ b/src/utils/api-helpers.js @@ -14,6 +14,7 @@ const formats = { ombi: `{url}/api/v1/{endpoint}`, npm: `{url}/api/{endpoint}`, gotify: `{url}/{endpoint}`, + sabnzbd: `{url}/api?output=json&apikey={key}&{endpoint}`, }; export function formatApiCall(api, args) {