Merge pull request #121 from xicopitz/main

Gotify
pull/134/head
Ben Phelps 2 years ago committed by GitHub
commit ea55cde043
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -109,5 +109,10 @@
}, },
"coinmarketcap": { "coinmarketcap": {
"configure": "Configure one or more crypto currencies to track" "configure": "Configure one or more crypto currencies to track"
},
"gotify": {
"apps": "Applications",
"clients": "Clients",
"messages": "Messages"
} }
} }

@ -120,5 +120,10 @@
}, },
"coinmarketcap": { "coinmarketcap": {
"configure": "Configure one or more crypto currencies to track" "configure": "Configure one or more crypto currencies to track"
},
"gotify": {
"apps": "Applications",
"clients": "Clients",
"messages": "Messages"
} }
} }

@ -109,5 +109,10 @@
}, },
"coinmarketcap": { "coinmarketcap": {
"configure": "Configure one or more crypto currencies to track" "configure": "Configure one or more crypto currencies to track"
},
"gotify": {
"apps": "Applications",
"clients": "Clients",
"messages": "Messages"
} }
} }

@ -120,5 +120,10 @@
}, },
"coinmarketcap": { "coinmarketcap": {
"configure": "Configure one or more crypto currencies to track" "configure": "Configure one or more crypto currencies to track"
},
"gotify": {
"apps": "Applications",
"clients": "Clients",
"messages": "Messages"
} }
} }

@ -109,5 +109,10 @@
}, },
"coinmarketcap": { "coinmarketcap": {
"configure": "Configure one or more crypto currencies to track" "configure": "Configure one or more crypto currencies to track"
},
"gotify": {
"apps": "Applications",
"clients": "Clients",
"messages": "Messages"
} }
} }

@ -109,5 +109,10 @@
}, },
"coinmarketcap": { "coinmarketcap": {
"configure": "Configure one or more crypto currencies to track" "configure": "Configure one or more crypto currencies to track"
},
"gotify": {
"apps": "Applications",
"clients": "Clients",
"messages": "Messages"
} }
} }

@ -109,5 +109,10 @@
}, },
"coinmarketcap": { "coinmarketcap": {
"configure": "Configure one or more crypto currencies to track" "configure": "Configure one or more crypto currencies to track"
},
"gotify": {
"apps": "Applications",
"clients": "Clients",
"messages": "Messages"
} }
} }

@ -120,5 +120,10 @@
}, },
"coinmarketcap": { "coinmarketcap": {
"configure": "Configure one or more crypto currencies to track" "configure": "Configure one or more crypto currencies to track"
},
"gotify": {
"apps": "Applications",
"clients": "Clients",
"messages": "Messages"
} }
} }

@ -109,5 +109,10 @@
}, },
"coinmarketcap": { "coinmarketcap": {
"configure": "Configure one or more crypto currencies to track" "configure": "Configure one or more crypto currencies to track"
},
"gotify": {
"apps": "Applications",
"clients": "Clients",
"messages": "Messages"
} }
} }

@ -109,5 +109,10 @@
}, },
"coinmarketcap": { "coinmarketcap": {
"configure": "Configure one or more crypto currencies to track" "configure": "Configure one or more crypto currencies to track"
},
"gotify": {
"apps": "Applications",
"clients": "Clients",
"messages": "Messages"
} }
} }

@ -109,5 +109,10 @@
}, },
"coinmarketcap": { "coinmarketcap": {
"configure": "Configure one or more crypto currencies to track" "configure": "Configure one or more crypto currencies to track"
},
"gotify": {
"apps": "Aplicações",
"clients": "Clientes",
"messages": "Mensagens"
} }
} }

@ -19,6 +19,7 @@ import Overseerr from "./widgets/service/overseerr";
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 CoinMarketCap from "./widgets/service/coinmarketcap"; import CoinMarketCap from "./widgets/service/coinmarketcap";
import Gotify from "./widgets/service/gotify";
const widgetMappings = { const widgetMappings = {
docker: Docker, docker: Docker,
@ -30,7 +31,6 @@ const widgetMappings = {
emby: Emby, emby: Emby,
jellyfin: Jellyfin, jellyfin: Jellyfin,
nzbget: Nzbget, nzbget: Nzbget,
sabnzbd: SABnzbd,
pihole: Pihole, pihole: Pihole,
rutorrent: Rutorrent, rutorrent: Rutorrent,
speedtest: Speedtest, speedtest: Speedtest,
@ -40,6 +40,8 @@ const widgetMappings = {
coinmarketcap: CoinMarketCap, coinmarketcap: CoinMarketCap,
npm: Npm, npm: Npm,
tautulli: Tautulli, tautulli: Tautulli,
gotify: Gotify,
sabnzbd: SABnzbd
}; };
export default function Widget({ service }) { export default function Widget({ service }) {

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

@ -17,6 +17,7 @@ const serviceProxyHandlers = {
traefik: genericProxyHandler, traefik: genericProxyHandler,
sabnzbd: genericProxyHandler, sabnzbd: genericProxyHandler,
// uses X-API-Key (or similar) header auth // uses X-API-Key (or similar) header auth
gotify: credentialedProxyHandler,
portainer: credentialedProxyHandler, portainer: credentialedProxyHandler,
jellyseerr: credentialedProxyHandler, jellyseerr: credentialedProxyHandler,
overseerr: credentialedProxyHandler, overseerr: credentialedProxyHandler,

@ -16,6 +16,7 @@ const formats = {
readarr: `{url}/api/v1/{endpoint}?apikey={key}`, readarr: `{url}/api/v1/{endpoint}?apikey={key}`,
sabnzbd: `{url}/api/?apikey={key}&output=json&mode={endpoint}`, sabnzbd: `{url}/api/?apikey={key}&output=json&mode={endpoint}`,
coinmarketcap: `{url}/{endpoint}`, coinmarketcap: `{url}/{endpoint}`,
gotify: `{url}/{endpoint}`,
}; };
export function formatApiCall(api, args) { export function formatApiCall(api, args) {

@ -17,6 +17,9 @@ export default async function credentialedProxyHandler(req, res) {
if (widget.type === "coinmarketcap") { if (widget.type === "coinmarketcap") {
headers["X-CMC_PRO_API_KEY"] = `${widget.key}`; headers["X-CMC_PRO_API_KEY"] = `${widget.key}`;
}
if(widget.type === "gotify"){
headers["X-gotify-Key"] = `${widget.key}`;
} else { } else {
headers["X-API-Key"] = `${widget.key}`; headers["X-API-Key"] = `${widget.key}`;
} }

Loading…
Cancel
Save