diff --git a/public/locales/de/common.json b/public/locales/de/common.json index b43389f6..a78403ce 100644 --- a/public/locales/de/common.json +++ b/public/locales/de/common.json @@ -109,5 +109,10 @@ }, "coinmarketcap": { "configure": "Configure one or more crypto currencies to track" + }, + "gotify": { + "apps": "Applications", + "clients": "Clients", + "messages": "Messages" } } diff --git a/public/locales/en/common.json b/public/locales/en/common.json index 938fe810..7c60dbe1 100644 --- a/public/locales/en/common.json +++ b/public/locales/en/common.json @@ -120,5 +120,10 @@ }, "coinmarketcap": { "configure": "Configure one or more crypto currencies to track" + }, + "gotify": { + "apps": "Applications", + "clients": "Clients", + "messages": "Messages" } } diff --git a/public/locales/es/common.json b/public/locales/es/common.json index 98f04c84..ffb824ec 100644 --- a/public/locales/es/common.json +++ b/public/locales/es/common.json @@ -109,5 +109,10 @@ }, "coinmarketcap": { "configure": "Configure one or more crypto currencies to track" + }, + "gotify": { + "apps": "Applications", + "clients": "Clients", + "messages": "Messages" } } diff --git a/public/locales/fr/common.json b/public/locales/fr/common.json index d1c86c72..3df79e17 100644 --- a/public/locales/fr/common.json +++ b/public/locales/fr/common.json @@ -120,5 +120,10 @@ }, "coinmarketcap": { "configure": "Configure one or more crypto currencies to track" + }, + "gotify": { + "apps": "Applications", + "clients": "Clients", + "messages": "Messages" } } diff --git a/public/locales/it/common.json b/public/locales/it/common.json index 6b284a0c..fe00a626 100644 --- a/public/locales/it/common.json +++ b/public/locales/it/common.json @@ -109,5 +109,10 @@ }, "coinmarketcap": { "configure": "Configure one or more crypto currencies to track" + }, + "gotify": { + "apps": "Applications", + "clients": "Clients", + "messages": "Messages" } } diff --git a/public/locales/nb-NO/common.json b/public/locales/nb-NO/common.json index 86c80f9c..98e08cb4 100644 --- a/public/locales/nb-NO/common.json +++ b/public/locales/nb-NO/common.json @@ -109,5 +109,10 @@ }, "coinmarketcap": { "configure": "Configure one or more crypto currencies to track" + }, + "gotify": { + "apps": "Applications", + "clients": "Clients", + "messages": "Messages" } } diff --git a/public/locales/nl/common.json b/public/locales/nl/common.json index 20c4b8a8..ac5d6a99 100644 --- a/public/locales/nl/common.json +++ b/public/locales/nl/common.json @@ -109,5 +109,10 @@ }, "coinmarketcap": { "configure": "Configure one or more crypto currencies to track" + }, + "gotify": { + "apps": "Applications", + "clients": "Clients", + "messages": "Messages" } } diff --git a/public/locales/pt/common.json b/public/locales/pt/common.json index 6564d2d0..33e47880 100644 --- a/public/locales/pt/common.json +++ b/public/locales/pt/common.json @@ -120,5 +120,10 @@ }, "coinmarketcap": { "configure": "Configure one or more crypto currencies to track" + }, + "gotify": { + "apps": "Applications", + "clients": "Clients", + "messages": "Messages" } } diff --git a/public/locales/ru/common.json b/public/locales/ru/common.json index 17934885..a7197e8e 100644 --- a/public/locales/ru/common.json +++ b/public/locales/ru/common.json @@ -109,5 +109,10 @@ }, "coinmarketcap": { "configure": "Configure one or more crypto currencies to track" + }, + "gotify": { + "apps": "Applications", + "clients": "Clients", + "messages": "Messages" } } diff --git a/public/locales/vi/common.json b/public/locales/vi/common.json index f84d1602..fb07ee71 100644 --- a/public/locales/vi/common.json +++ b/public/locales/vi/common.json @@ -109,5 +109,10 @@ }, "coinmarketcap": { "configure": "Configure one or more crypto currencies to track" + }, + "gotify": { + "apps": "Applications", + "clients": "Clients", + "messages": "Messages" } } diff --git a/public/locales/zh-CN/common.json b/public/locales/zh-CN/common.json index 7f57f488..bf19bdb6 100644 --- a/public/locales/zh-CN/common.json +++ b/public/locales/zh-CN/common.json @@ -109,5 +109,10 @@ }, "coinmarketcap": { "configure": "Configure one or more crypto currencies to track" + }, + "gotify": { + "apps": "Aplicações", + "clients": "Clientes", + "messages": "Mensagens" } } diff --git a/src/components/services/widget.jsx b/src/components/services/widget.jsx index 361b2484..2bebe84a 100644 --- a/src/components/services/widget.jsx +++ b/src/components/services/widget.jsx @@ -19,6 +19,7 @@ import Overseerr from "./widgets/service/overseerr"; import Npm from "./widgets/service/npm"; import Tautulli from "./widgets/service/tautulli"; import CoinMarketCap from "./widgets/service/coinmarketcap"; +import Gotify from "./widgets/service/gotify"; const widgetMappings = { docker: Docker, @@ -30,7 +31,6 @@ const widgetMappings = { emby: Emby, jellyfin: Jellyfin, nzbget: Nzbget, - sabnzbd: SABnzbd, pihole: Pihole, rutorrent: Rutorrent, speedtest: Speedtest, @@ -40,6 +40,8 @@ const widgetMappings = { coinmarketcap: CoinMarketCap, npm: Npm, tautulli: Tautulli, + gotify: Gotify, + sabnzbd: SABnzbd }; 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 00000000..578d31cf --- /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/pages/api/services/proxy.js b/src/pages/api/services/proxy.js index fbc053da..0a444029 100644 --- a/src/pages/api/services/proxy.js +++ b/src/pages/api/services/proxy.js @@ -17,6 +17,7 @@ const serviceProxyHandlers = { traefik: genericProxyHandler, sabnzbd: genericProxyHandler, // uses X-API-Key (or similar) header auth + gotify: credentialedProxyHandler, portainer: credentialedProxyHandler, jellyseerr: credentialedProxyHandler, overseerr: credentialedProxyHandler, diff --git a/src/utils/api-helpers.js b/src/utils/api-helpers.js index 58147d24..56aea079 100644 --- a/src/utils/api-helpers.js +++ b/src/utils/api-helpers.js @@ -16,6 +16,7 @@ const formats = { readarr: `{url}/api/v1/{endpoint}?apikey={key}`, sabnzbd: `{url}/api/?apikey={key}&output=json&mode={endpoint}`, coinmarketcap: `{url}/{endpoint}`, + gotify: `{url}/{endpoint}`, }; export function formatApiCall(api, args) { diff --git a/src/utils/proxies/credentialed.js b/src/utils/proxies/credentialed.js index 70df6472..79a94beb 100644 --- a/src/utils/proxies/credentialed.js +++ b/src/utils/proxies/credentialed.js @@ -17,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}`; }