Add Gotify Service
This commit is contained in:
parent
e3237b9022
commit
5e6312fe93
15 changed files with 95 additions and 4 deletions
|
@ -89,5 +89,10 @@
|
|||
"allow": "Zum Zulassen anklicken",
|
||||
"updating": "Aktualisieren",
|
||||
"wait": "Bitte warten"
|
||||
},
|
||||
"gotify": {
|
||||
"apps": "Anwendungen",
|
||||
"clients": "Kunden",
|
||||
"messages": "Mitteilungen"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -100,5 +100,10 @@
|
|||
"enabled": "Enabled",
|
||||
"disabled": "Disabled",
|
||||
"total": "Total"
|
||||
},
|
||||
"gotify": {
|
||||
"apps": "Applications",
|
||||
"clients": "Clients",
|
||||
"messages": "Messages"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -89,5 +89,10 @@
|
|||
"allow": "Click to allow",
|
||||
"updating": "Updating",
|
||||
"wait": "Please wait"
|
||||
},
|
||||
"gotify": {
|
||||
"apps": "Aplicaciones",
|
||||
"clients": "Clientela",
|
||||
"messages": "Mensajes"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -100,5 +100,10 @@
|
|||
"allow": "Click to allow",
|
||||
"updating": "Updating",
|
||||
"wait": "Please wait"
|
||||
},
|
||||
"gotify": {
|
||||
"apps": "Applications",
|
||||
"clients": "Clients",
|
||||
"messages": "Messages"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -89,5 +89,10 @@
|
|||
"allow": "Click to allow",
|
||||
"updating": "Updating",
|
||||
"wait": "Please wait"
|
||||
},
|
||||
"gotify": {
|
||||
"apps": "Applications",
|
||||
"clients": "Clients",
|
||||
"messages": "Messages"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -89,5 +89,10 @@
|
|||
"updating": "Oppdaterer …",
|
||||
"wait": "Vent litt …",
|
||||
"current": "Nåværende posisjon"
|
||||
},
|
||||
"gotify": {
|
||||
"apps": "Applications",
|
||||
"clients": "Clients",
|
||||
"messages": "Messages"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -89,5 +89,10 @@
|
|||
"enabled": "Enabled",
|
||||
"disabled": "Disabled",
|
||||
"total": "Total"
|
||||
},
|
||||
"gotify": {
|
||||
"apps": "Applications",
|
||||
"clients": "Clients",
|
||||
"messages": "Messages"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -100,5 +100,10 @@
|
|||
"allow": "Clicar para permitir",
|
||||
"updating": "A atualizar",
|
||||
"wait": "Por favor aguarde"
|
||||
},
|
||||
"gotify": {
|
||||
"apps": "Aplicações",
|
||||
"clients": "Clientes",
|
||||
"messages": "Mensagens"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -89,5 +89,10 @@
|
|||
"current": "Current Location",
|
||||
"allow": "Click to allow",
|
||||
"updating": "Updating"
|
||||
},
|
||||
"gotify": {
|
||||
"apps": "Aplicações",
|
||||
"clients": "Clientes",
|
||||
"messages": "Mensagens"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -89,5 +89,10 @@
|
|||
"allow": "Click to allow",
|
||||
"updating": "Updating",
|
||||
"wait": "Please wait"
|
||||
},
|
||||
"gotify": {
|
||||
"apps": "Aplicações",
|
||||
"clients": "Clientes",
|
||||
"messages": "Mensagens"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -89,5 +89,10 @@
|
|||
"allow": "Click to allow",
|
||||
"updating": "Updating",
|
||||
"wait": "Please wait"
|
||||
},
|
||||
"gotify": {
|
||||
"apps": "Aplicações",
|
||||
"clients": "Clientes",
|
||||
"messages": "Mensagens"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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 }) {
|
||||
|
|
29
src/components/services/widgets/service/gotify.jsx
Normal file
29
src/components/services/widgets/service/gotify.jsx
Normal file
|
@ -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 <Widget error={t("widget.api_error")} />;
|
||||
}
|
||||
|
||||
return (
|
||||
<Widget>
|
||||
<Block label={t("gotify.apps")} value={appsData?.length} />
|
||||
<Block label={t("gotify.clients")} value={clientsData?.length} />
|
||||
<Block label={t("gotify.messages")} value={messagesData?.messages?.length} />
|
||||
</Widget>
|
||||
);
|
||||
}
|
|
@ -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) {
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Add table
Reference in a new issue