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);