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",
|
"allow": "Zum Zulassen anklicken",
|
||||||
"updating": "Aktualisieren",
|
"updating": "Aktualisieren",
|
||||||
"wait": "Bitte warten"
|
"wait": "Bitte warten"
|
||||||
|
},
|
||||||
|
"gotify": {
|
||||||
|
"apps": "Anwendungen",
|
||||||
|
"clients": "Kunden",
|
||||||
|
"messages": "Mitteilungen"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -100,5 +100,10 @@
|
||||||
"enabled": "Enabled",
|
"enabled": "Enabled",
|
||||||
"disabled": "Disabled",
|
"disabled": "Disabled",
|
||||||
"total": "Total"
|
"total": "Total"
|
||||||
|
},
|
||||||
|
"gotify": {
|
||||||
|
"apps": "Applications",
|
||||||
|
"clients": "Clients",
|
||||||
|
"messages": "Messages"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -89,5 +89,10 @@
|
||||||
"allow": "Click to allow",
|
"allow": "Click to allow",
|
||||||
"updating": "Updating",
|
"updating": "Updating",
|
||||||
"wait": "Please wait"
|
"wait": "Please wait"
|
||||||
|
},
|
||||||
|
"gotify": {
|
||||||
|
"apps": "Aplicaciones",
|
||||||
|
"clients": "Clientela",
|
||||||
|
"messages": "Mensajes"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -100,5 +100,10 @@
|
||||||
"allow": "Click to allow",
|
"allow": "Click to allow",
|
||||||
"updating": "Updating",
|
"updating": "Updating",
|
||||||
"wait": "Please wait"
|
"wait": "Please wait"
|
||||||
|
},
|
||||||
|
"gotify": {
|
||||||
|
"apps": "Applications",
|
||||||
|
"clients": "Clients",
|
||||||
|
"messages": "Messages"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -89,5 +89,10 @@
|
||||||
"allow": "Click to allow",
|
"allow": "Click to allow",
|
||||||
"updating": "Updating",
|
"updating": "Updating",
|
||||||
"wait": "Please wait"
|
"wait": "Please wait"
|
||||||
|
},
|
||||||
|
"gotify": {
|
||||||
|
"apps": "Applications",
|
||||||
|
"clients": "Clients",
|
||||||
|
"messages": "Messages"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -89,5 +89,10 @@
|
||||||
"updating": "Oppdaterer …",
|
"updating": "Oppdaterer …",
|
||||||
"wait": "Vent litt …",
|
"wait": "Vent litt …",
|
||||||
"current": "Nåværende posisjon"
|
"current": "Nåværende posisjon"
|
||||||
|
},
|
||||||
|
"gotify": {
|
||||||
|
"apps": "Applications",
|
||||||
|
"clients": "Clients",
|
||||||
|
"messages": "Messages"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -89,5 +89,10 @@
|
||||||
"enabled": "Enabled",
|
"enabled": "Enabled",
|
||||||
"disabled": "Disabled",
|
"disabled": "Disabled",
|
||||||
"total": "Total"
|
"total": "Total"
|
||||||
|
},
|
||||||
|
"gotify": {
|
||||||
|
"apps": "Applications",
|
||||||
|
"clients": "Clients",
|
||||||
|
"messages": "Messages"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -100,5 +100,10 @@
|
||||||
"allow": "Clicar para permitir",
|
"allow": "Clicar para permitir",
|
||||||
"updating": "A atualizar",
|
"updating": "A atualizar",
|
||||||
"wait": "Por favor aguarde"
|
"wait": "Por favor aguarde"
|
||||||
|
},
|
||||||
|
"gotify": {
|
||||||
|
"apps": "Aplicações",
|
||||||
|
"clients": "Clientes",
|
||||||
|
"messages": "Mensagens"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -89,5 +89,10 @@
|
||||||
"current": "Current Location",
|
"current": "Current Location",
|
||||||
"allow": "Click to allow",
|
"allow": "Click to allow",
|
||||||
"updating": "Updating"
|
"updating": "Updating"
|
||||||
|
},
|
||||||
|
"gotify": {
|
||||||
|
"apps": "Aplicações",
|
||||||
|
"clients": "Clientes",
|
||||||
|
"messages": "Mensagens"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -89,5 +89,10 @@
|
||||||
"allow": "Click to allow",
|
"allow": "Click to allow",
|
||||||
"updating": "Updating",
|
"updating": "Updating",
|
||||||
"wait": "Please wait"
|
"wait": "Please wait"
|
||||||
|
},
|
||||||
|
"gotify": {
|
||||||
|
"apps": "Aplicações",
|
||||||
|
"clients": "Clientes",
|
||||||
|
"messages": "Mensagens"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -89,5 +89,10 @@
|
||||||
"allow": "Click to allow",
|
"allow": "Click to allow",
|
||||||
"updating": "Updating",
|
"updating": "Updating",
|
||||||
"wait": "Please wait"
|
"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 Jellyseerr from "./widgets/service/jellyseerr";
|
||||||
import Npm from "./widgets/service/npm";
|
import Npm from "./widgets/service/npm";
|
||||||
import Tautulli from "./widgets/service/tautulli";
|
import Tautulli from "./widgets/service/tautulli";
|
||||||
|
import Gotify from "./widgets/service/gotify";
|
||||||
|
|
||||||
const widgetMappings = {
|
const widgetMappings = {
|
||||||
docker: Docker,
|
docker: Docker,
|
||||||
|
@ -32,6 +33,7 @@ const widgetMappings = {
|
||||||
jellyseerr: Jellyseerr,
|
jellyseerr: Jellyseerr,
|
||||||
npm: Npm,
|
npm: Npm,
|
||||||
tautulli: Tautulli,
|
tautulli: Tautulli,
|
||||||
|
gotify: Gotify,
|
||||||
};
|
};
|
||||||
|
|
||||||
export default function Widget({ service }) {
|
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}`,
|
jellyseerr: `{url}/api/v1/{endpoint}`,
|
||||||
ombi: `{url}/api/v1/{endpoint}`,
|
ombi: `{url}/api/v1/{endpoint}`,
|
||||||
npm: `{url}/api/{endpoint}`,
|
npm: `{url}/api/{endpoint}`,
|
||||||
|
gotify: `{url}/{endpoint}`,
|
||||||
};
|
};
|
||||||
|
|
||||||
export function formatApiCall(api, args) {
|
export function formatApiCall(api, args) {
|
||||||
|
|
|
@ -8,15 +8,19 @@ export default async function credentialedProxyHandler(req, res) {
|
||||||
if (group && service) {
|
if (group && service) {
|
||||||
const widget = await getServiceWidget(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) {
|
if (widget) {
|
||||||
const url = new URL(formatApiCall(widget.type, { endpoint, ...widget }));
|
const url = new URL(formatApiCall(widget.type, { endpoint, ...widget }));
|
||||||
const [status, contentType, data] = await httpProxy(url, {
|
const [status, contentType, data] = await httpProxy(url, {
|
||||||
withCredentials: true,
|
withCredentials: true,
|
||||||
credentials: "include",
|
credentials: "include",
|
||||||
headers: {
|
headers: headersData,
|
||||||
"X-API-Key": `${widget.key}`,
|
|
||||||
"Content-Type": "application/json",
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
|
|
||||||
if (contentType) res.setHeader("Content-Type", contentType);
|
if (contentType) res.setHeader("Content-Type", contentType);
|
||||||
|
|
Loading…
Add table
Reference in a new issue