diff --git a/public/locales/de/common.json b/public/locales/de/common.json index fbd5707d1d064457ae87673625867bfd818c2aaa..55619aa1e4e054ad54fdaf54e3bc30c714f28fd4 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 cacfb7af19d2239637626581bf41b2498c143b6c..502236f38e65e902f73cd0e1df79435b2bbc9e33 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 15487f54371d95ac118fa6e8b5109d2d86e50860..f857aaab6c7288336fa4f9931d8f3881c5a44184 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 01ed86427b44dbe4489bacfeef13a1abac3116b7..7d96095eeb1903d461ac55374f670940d5c5a16c 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 754562b38532f41e98f2f2a7eac475b26602801b..a55454584cb735b383316af025c834723c13d870 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 7c1ffe4bdcb3fc42981a8be65380cc9862e9465f..7a8d28aa3df401f1fb59ae0b7dd04e17a68f4073 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 4d50a090c73ced6a49ced51ff9de674ee36b302f..77d55077f26f65832d289e058d8fc4642f9a135c 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 afe2e320c35619dc809440db515439e8f5e90d0d..8c133146389fdeedb231d0064bebf564c827e0db 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 126f0cc0b032fb8c6c543c808f0dbb537ea0f0ef..aa26d63fb4168e6162402b0583eb13857f36b76a 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 de4466dd837fd27484e8e2e9a22a1087e84a70cc..747e5c5c9129547d92caa0a47cc5c3158d1dea17 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 7abedd30e05816e8403e5a3bfc131f5ffdb8466b..4fbf855650f203b63a7eccdab936837f36cc37c9 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 199dbd5d466bf1bed1f0cd1b81962d8d2f868112..81c9b081bdf69588e482795f69f63fd5af5b5d8d 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 0000000000000000000000000000000000000000..578d31cfb273d102fd1a9c09ccb8e668f61fcbb2 --- /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 a889487ef2daee01220dd4068f4f998e58d8a25a..ee4392e0e5a598423490f3edfde45632c5f432fb 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 820d8cdba31e4814b5c08e429bd5857e99db0ef7..1f8d8c30aacf7fc08625fb5d83cf376a97f5e91f 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);