From 5e6312fe93265f050983894e8028284fe58404ec Mon Sep 17 00:00:00 2001 From: Francisco Coelho Date: Sun, 11 Sep 2022 04:11:02 +0100 Subject: [PATCH 1/7] Add Gotify Service --- public/locales/de/common.json | 5 ++++ public/locales/en/common.json | 5 ++++ public/locales/es/common.json | 5 ++++ public/locales/fr/common.json | 5 ++++ public/locales/it/common.json | 5 ++++ public/locales/nb-NO/common.json | 5 ++++ public/locales/nl/common.json | 5 ++++ public/locales/pt/common.json | 5 ++++ public/locales/ru/common.json | 5 ++++ public/locales/vi/common.json | 5 ++++ public/locales/zh-CN/common.json | 5 ++++ src/components/services/widget.jsx | 2 ++ .../services/widgets/service/gotify.jsx | 29 +++++++++++++++++++ src/utils/api-helpers.js | 1 + src/utils/proxies/credentialed.js | 12 +++++--- 15 files changed, 95 insertions(+), 4 deletions(-) create mode 100644 src/components/services/widgets/service/gotify.jsx diff --git a/public/locales/de/common.json b/public/locales/de/common.json index fbd5707d1..55619aa1e 100644 --- a/public/locales/de/common.json +++ b/public/locales/de/common.json @@ -89,5 +89,10 @@ "allow": "Zum Zulassen anklicken", "updating": "Aktualisieren", "wait": "Bitte warten" + }, + "gotify": { + "apps": "Anwendungen", + "clients": "Kunden", + "messages": "Mitteilungen" } } diff --git a/public/locales/en/common.json b/public/locales/en/common.json index cacfb7af1..502236f38 100644 --- a/public/locales/en/common.json +++ b/public/locales/en/common.json @@ -100,5 +100,10 @@ "enabled": "Enabled", "disabled": "Disabled", "total": "Total" + }, + "gotify": { + "apps": "Applications", + "clients": "Clients", + "messages": "Messages" } } diff --git a/public/locales/es/common.json b/public/locales/es/common.json index 15487f543..f857aaab6 100644 --- a/public/locales/es/common.json +++ b/public/locales/es/common.json @@ -89,5 +89,10 @@ "allow": "Click to allow", "updating": "Updating", "wait": "Please wait" + }, + "gotify": { + "apps": "Aplicaciones", + "clients": "Clientela", + "messages": "Mensajes" } } diff --git a/public/locales/fr/common.json b/public/locales/fr/common.json index 01ed86427..7d96095ee 100644 --- a/public/locales/fr/common.json +++ b/public/locales/fr/common.json @@ -100,5 +100,10 @@ "allow": "Click to allow", "updating": "Updating", "wait": "Please wait" + }, + "gotify": { + "apps": "Applications", + "clients": "Clients", + "messages": "Messages" } } diff --git a/public/locales/it/common.json b/public/locales/it/common.json index 754562b38..a55454584 100644 --- a/public/locales/it/common.json +++ b/public/locales/it/common.json @@ -89,5 +89,10 @@ "allow": "Click to allow", "updating": "Updating", "wait": "Please wait" + }, + "gotify": { + "apps": "Applications", + "clients": "Clients", + "messages": "Messages" } } diff --git a/public/locales/nb-NO/common.json b/public/locales/nb-NO/common.json index 7c1ffe4bd..7a8d28aa3 100644 --- a/public/locales/nb-NO/common.json +++ b/public/locales/nb-NO/common.json @@ -89,5 +89,10 @@ "updating": "Oppdaterer …", "wait": "Vent litt …", "current": "Nåværende posisjon" + }, + "gotify": { + "apps": "Applications", + "clients": "Clients", + "messages": "Messages" } } diff --git a/public/locales/nl/common.json b/public/locales/nl/common.json index 4d50a090c..77d55077f 100644 --- a/public/locales/nl/common.json +++ b/public/locales/nl/common.json @@ -89,5 +89,10 @@ "enabled": "Enabled", "disabled": "Disabled", "total": "Total" + }, + "gotify": { + "apps": "Applications", + "clients": "Clients", + "messages": "Messages" } } diff --git a/public/locales/pt/common.json b/public/locales/pt/common.json index afe2e320c..8c1331463 100644 --- a/public/locales/pt/common.json +++ b/public/locales/pt/common.json @@ -100,5 +100,10 @@ "allow": "Clicar para permitir", "updating": "A atualizar", "wait": "Por favor aguarde" + }, + "gotify": { + "apps": "Aplicações", + "clients": "Clientes", + "messages": "Mensagens" } } diff --git a/public/locales/ru/common.json b/public/locales/ru/common.json index 126f0cc0b..aa26d63fb 100644 --- a/public/locales/ru/common.json +++ b/public/locales/ru/common.json @@ -89,5 +89,10 @@ "current": "Current Location", "allow": "Click to allow", "updating": "Updating" + }, + "gotify": { + "apps": "Aplicações", + "clients": "Clientes", + "messages": "Mensagens" } } diff --git a/public/locales/vi/common.json b/public/locales/vi/common.json index de4466dd8..747e5c5c9 100644 --- a/public/locales/vi/common.json +++ b/public/locales/vi/common.json @@ -89,5 +89,10 @@ "allow": "Click to allow", "updating": "Updating", "wait": "Please wait" + }, + "gotify": { + "apps": "Aplicações", + "clients": "Clientes", + "messages": "Mensagens" } } diff --git a/public/locales/zh-CN/common.json b/public/locales/zh-CN/common.json index 7abedd30e..4fbf85565 100644 --- a/public/locales/zh-CN/common.json +++ b/public/locales/zh-CN/common.json @@ -89,5 +89,10 @@ "allow": "Click to allow", "updating": "Updating", "wait": "Please wait" + }, + "gotify": { + "apps": "Aplicações", + "clients": "Clientes", + "messages": "Mensagens" } } diff --git a/src/components/services/widget.jsx b/src/components/services/widget.jsx index 199dbd5d4..81c9b081b 100644 --- a/src/components/services/widget.jsx +++ b/src/components/services/widget.jsx @@ -15,6 +15,7 @@ import Traefik from "./widgets/service/traefik"; import Jellyseerr from "./widgets/service/jellyseerr"; import Npm from "./widgets/service/npm"; import Tautulli from "./widgets/service/tautulli"; +import Gotify from "./widgets/service/gotify"; const widgetMappings = { docker: Docker, @@ -32,6 +33,7 @@ const widgetMappings = { jellyseerr: Jellyseerr, npm: Npm, tautulli: Tautulli, + gotify: Gotify, }; export default function Widget({ service }) { diff --git a/src/components/services/widgets/service/gotify.jsx b/src/components/services/widgets/service/gotify.jsx new file mode 100644 index 000000000..578d31cfb --- /dev/null +++ b/src/components/services/widgets/service/gotify.jsx @@ -0,0 +1,29 @@ +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 Gotify({ service }) { + const { t } = useTranslation(); + + const config = service.widget; + + const { data: appsData, error: appsError } = useSWR(formatApiUrl(config, `application`)); + const { data: messagesData, error: messagesError } = useSWR(formatApiUrl(config, `message`)); + const { data: clientsData, error: clientsError } = useSWR(formatApiUrl(config, `client`)); + + if (appsError || messagesError || clientsError) { + return ; + } + + return ( + + + + + + ); +} diff --git a/src/utils/api-helpers.js b/src/utils/api-helpers.js index a889487ef..ee4392e0e 100644 --- a/src/utils/api-helpers.js +++ b/src/utils/api-helpers.js @@ -12,6 +12,7 @@ const formats = { jellyseerr: `{url}/api/v1/{endpoint}`, ombi: `{url}/api/v1/{endpoint}`, npm: `{url}/api/{endpoint}`, + gotify: `{url}/{endpoint}`, }; export function formatApiCall(api, args) { diff --git a/src/utils/proxies/credentialed.js b/src/utils/proxies/credentialed.js index 820d8cdba..1f8d8c30a 100644 --- a/src/utils/proxies/credentialed.js +++ b/src/utils/proxies/credentialed.js @@ -8,15 +8,19 @@ export default async function credentialedProxyHandler(req, res) { if (group && service) { const widget = await getServiceWidget(group, service); + var headersData + if(widget.type == "gotify"){ + headersData = {"X-gotify-Key": `${widget.key}`,"Content-Type": "application/json",} + }else{ + headersData = {"X-API-Key": `${widget.key}`,"Content-Type": "application/json",} + } + if (widget) { const url = new URL(formatApiCall(widget.type, { endpoint, ...widget })); const [status, contentType, data] = await httpProxy(url, { withCredentials: true, credentials: "include", - headers: { - "X-API-Key": `${widget.key}`, - "Content-Type": "application/json", - }, + headers: headersData, }); if (contentType) res.setHeader("Content-Type", contentType); From 9831df1427af0e6ad4ef3a7c8db0fdb8284090a8 Mon Sep 17 00:00:00 2001 From: Francisco Coelho Date: Sun, 11 Sep 2022 04:39:40 +0100 Subject: [PATCH 2/7] Update proxy.js --- src/pages/api/services/proxy.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/pages/api/services/proxy.js b/src/pages/api/services/proxy.js index 970008e1f..c9bee5433 100644 --- a/src/pages/api/services/proxy.js +++ b/src/pages/api/services/proxy.js @@ -15,6 +15,7 @@ const serviceProxyHandlers = { tautulli: genericProxyHandler, traefik: genericProxyHandler, // uses X-API-Key header auth + gotify: credentialedProxyHandler, portainer: credentialedProxyHandler, jellyseerr: credentialedProxyHandler, ombi: credentialedProxyHandler, From eeac1200e7aa22c94a4f3992a58f440eb7f3f2b5 Mon Sep 17 00:00:00 2001 From: Francisco Coelho Date: Sun, 11 Sep 2022 22:11:14 +0100 Subject: [PATCH 3/7] Update credentialed.js --- src/utils/proxies/credentialed.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/utils/proxies/credentialed.js b/src/utils/proxies/credentialed.js index d263adf0d..847a7f3e4 100644 --- a/src/utils/proxies/credentialed.js +++ b/src/utils/proxies/credentialed.js @@ -3,13 +3,13 @@ import { formatApiCall } from "utils/api-helpers"; import { httpProxy } from "utils/http"; export default async function credentialedProxyHandler(req, res) { + let headersData const { group, service, endpoint } = req.query; if (group && service) { const widget = await getServiceWidget(group, service); - var headersData - if(widget.type == "gotify"){ + if(widget.type === "gotify"){ headersData = {"X-gotify-Key": `${widget.key}`,"Content-Type": "application/json",} }else{ headersData = {"X-API-Key": `${widget.key}`,"Content-Type": "application/json",} From 9d790894d5334ac0e37cd409a05f72600a6d194f Mon Sep 17 00:00:00 2001 From: Francisco Coelho Date: Mon, 12 Sep 2022 02:22:39 +0100 Subject: [PATCH 4/7] Sabnzbd Support --- public/locales/de/common.json | 6 +++ public/locales/en/common.json | 6 +++ public/locales/es/common.json | 6 +++ public/locales/fr/common.json | 6 +++ public/locales/it/common.json | 6 +++ public/locales/nb-NO/common.json | 6 +++ public/locales/nl/common.json | 6 +++ public/locales/pt/common.json | 6 +++ public/locales/ru/common.json | 6 +++ public/locales/vi/common.json | 6 +++ public/locales/zh-CN/common.json | 6 +++ src/components/services/widget.jsx | 2 + .../services/widgets/service/sabnzbd.jsx | 41 +++++++++++++++++++ src/pages/api/services/proxy.js | 1 + src/utils/api-helpers.js | 1 + 15 files changed, 111 insertions(+) create mode 100644 src/components/services/widgets/service/sabnzbd.jsx 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) { From af02440c40991b8e214e38e8906d262f5969951c Mon Sep 17 00:00:00 2001 From: Francisco Coelho Date: Mon, 12 Sep 2022 09:31:44 +0100 Subject: [PATCH 5/7] Revert "Update credentialed.js" This reverts commit eeac1200e7aa22c94a4f3992a58f440eb7f3f2b5. --- src/utils/proxies/credentialed.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/utils/proxies/credentialed.js b/src/utils/proxies/credentialed.js index 847a7f3e4..d263adf0d 100644 --- a/src/utils/proxies/credentialed.js +++ b/src/utils/proxies/credentialed.js @@ -3,13 +3,13 @@ import { formatApiCall } from "utils/api-helpers"; import { httpProxy } from "utils/http"; export default async function credentialedProxyHandler(req, res) { - let headersData const { group, service, endpoint } = req.query; if (group && service) { const widget = await getServiceWidget(group, service); - if(widget.type === "gotify"){ + var headersData + if(widget.type == "gotify"){ headersData = {"X-gotify-Key": `${widget.key}`,"Content-Type": "application/json",} }else{ headersData = {"X-API-Key": `${widget.key}`,"Content-Type": "application/json",} From ba3b48e8ce75ca7cb7ee36a770220e265a01d681 Mon Sep 17 00:00:00 2001 From: Francisco Coelho Date: Mon, 12 Sep 2022 10:06:47 +0100 Subject: [PATCH 6/7] Gotify --- public/locales/de/common.json | 2 +- public/locales/en/common.json | 2 +- public/locales/es/common.json | 2 +- public/locales/fr/common.json | 2 +- public/locales/it/common.json | 2 +- public/locales/nb-NO/common.json | 2 +- public/locales/nl/common.json | 2 +- public/locales/pt/common.json | 2 +- public/locales/ru/common.json | 2 +- public/locales/zh-CN/common.json | 2 +- src/components/services/widget.jsx | 2 +- src/utils/proxies/credentialed.js | 10 +++------- 12 files changed, 14 insertions(+), 18 deletions(-) diff --git a/public/locales/de/common.json b/public/locales/de/common.json index 260a9537a..a78403ce6 100644 --- a/public/locales/de/common.json +++ b/public/locales/de/common.json @@ -114,5 +114,5 @@ "apps": "Applications", "clients": "Clients", "messages": "Messages" - }, + } } diff --git a/public/locales/en/common.json b/public/locales/en/common.json index 11a90f602..7c60dbe13 100644 --- a/public/locales/en/common.json +++ b/public/locales/en/common.json @@ -125,5 +125,5 @@ "apps": "Applications", "clients": "Clients", "messages": "Messages" - }, + } } diff --git a/public/locales/es/common.json b/public/locales/es/common.json index 3423a4077..ffb824ec2 100644 --- a/public/locales/es/common.json +++ b/public/locales/es/common.json @@ -114,5 +114,5 @@ "apps": "Applications", "clients": "Clients", "messages": "Messages" - }, + } } diff --git a/public/locales/fr/common.json b/public/locales/fr/common.json index 0e79661e2..3df79e172 100644 --- a/public/locales/fr/common.json +++ b/public/locales/fr/common.json @@ -125,5 +125,5 @@ "apps": "Applications", "clients": "Clients", "messages": "Messages" - }, + } } diff --git a/public/locales/it/common.json b/public/locales/it/common.json index 9ede53a3a..fe00a626d 100644 --- a/public/locales/it/common.json +++ b/public/locales/it/common.json @@ -114,5 +114,5 @@ "apps": "Applications", "clients": "Clients", "messages": "Messages" - }, + } } diff --git a/public/locales/nb-NO/common.json b/public/locales/nb-NO/common.json index 40d9d35b0..98e08cb45 100644 --- a/public/locales/nb-NO/common.json +++ b/public/locales/nb-NO/common.json @@ -114,5 +114,5 @@ "apps": "Applications", "clients": "Clients", "messages": "Messages" - }, + } } diff --git a/public/locales/nl/common.json b/public/locales/nl/common.json index dbb7b3de6..ac5d6a991 100644 --- a/public/locales/nl/common.json +++ b/public/locales/nl/common.json @@ -114,5 +114,5 @@ "apps": "Applications", "clients": "Clients", "messages": "Messages" - }, + } } diff --git a/public/locales/pt/common.json b/public/locales/pt/common.json index acd5d31b9..33e478806 100644 --- a/public/locales/pt/common.json +++ b/public/locales/pt/common.json @@ -125,5 +125,5 @@ "apps": "Applications", "clients": "Clients", "messages": "Messages" - }, + } } diff --git a/public/locales/ru/common.json b/public/locales/ru/common.json index ecd00b105..a7197e8e7 100644 --- a/public/locales/ru/common.json +++ b/public/locales/ru/common.json @@ -114,5 +114,5 @@ "apps": "Applications", "clients": "Clients", "messages": "Messages" - }, + } } diff --git a/public/locales/zh-CN/common.json b/public/locales/zh-CN/common.json index bb02bd828..bf19bdb63 100644 --- a/public/locales/zh-CN/common.json +++ b/public/locales/zh-CN/common.json @@ -114,5 +114,5 @@ "apps": "Aplicações", "clients": "Clientes", "messages": "Mensagens" - }, + } } diff --git a/src/components/services/widget.jsx b/src/components/services/widget.jsx index 43ea46c2e..86888a475 100644 --- a/src/components/services/widget.jsx +++ b/src/components/services/widget.jsx @@ -42,7 +42,7 @@ const widgetMappings = { npm: Npm, tautulli: Tautulli, gotify: Gotify, - sabnzbd: Sabnzbd + sabnzbd: SABnzbd }; export default function Widget({ service }) { diff --git a/src/utils/proxies/credentialed.js b/src/utils/proxies/credentialed.js index 4ee15e672..79a94bebd 100644 --- a/src/utils/proxies/credentialed.js +++ b/src/utils/proxies/credentialed.js @@ -8,13 +8,6 @@ export default async function credentialedProxyHandler(req, res) { if (group && service) { const widget = await getServiceWidget(group, service); - var headersData - if(widget.type == "gotify"){ - headersData = {"X-gotify-Key": `${widget.key}`,"Content-Type": "application/json",} - }else{ - headersData = {"X-API-Key": `${widget.key}`,"Content-Type": "application/json",} - } - if (widget) { const url = new URL(formatApiCall(widget.type, { endpoint, ...widget })); @@ -24,6 +17,9 @@ export default async function credentialedProxyHandler(req, res) { if (widget.type === "coinmarketcap") { headers["X-CMC_PRO_API_KEY"] = `${widget.key}`; + } + if(widget.type === "gotify"){ + headers["X-gotify-Key"] = `${widget.key}`; } else { headers["X-API-Key"] = `${widget.key}`; } From 840c88db89d9cf5a18203c488caf947370145dc6 Mon Sep 17 00:00:00 2001 From: Francisco Coelho Date: Mon, 12 Sep 2022 10:23:44 +0100 Subject: [PATCH 7/7] Update widget.jsx duplicated widget name --- src/components/services/widget.jsx | 1 - 1 file changed, 1 deletion(-) diff --git a/src/components/services/widget.jsx b/src/components/services/widget.jsx index 86888a475..2bebe84af 100644 --- a/src/components/services/widget.jsx +++ b/src/components/services/widget.jsx @@ -31,7 +31,6 @@ const widgetMappings = { emby: Emby, jellyfin: Jellyfin, nzbget: Nzbget, - sabnzbd: SABnzbd, pihole: Pihole, rutorrent: Rutorrent, speedtest: Speedtest,