Adds widget for NextDNS

pull/688/head
Luis Brito 2 years ago
parent e7b0fc1419
commit fb2492e577

@ -22,6 +22,7 @@ const components = {
lidarr: dynamic(() => import("./lidarr/component")),
mastodon: dynamic(() => import("./mastodon/component")),
navidrome: dynamic(() => import("./navidrome/component")),
nextdns: dynamic(() => import("./nextdns/component")),
npm: dynamic(() => import("./npm/component")),
nzbget: dynamic(() => import("./nzbget/component")),
ombi: dynamic(() => import("./ombi/component")),

@ -0,0 +1,31 @@
import { useTranslation } from "next-i18next";
import Container from "components/services/widget/container";
import Block from "components/services/widget/block";
import useWidgetAPI from "utils/proxy/use-widget-api";
export default function Component({ service }) {
const { t } = useTranslation();
const { widget } = service;
const { data: nextdnsData, error: nextdnsError } = useWidgetAPI(widget, "analytics/status");
if (nextdnsError) {
return <Container error={nextdnsError} />;
}
if (!nextdnsData) {
return (
<Container service={service}>
No data
</Container>
);
}
return (
<Container service={service}>
{nextdnsData?.data?.map(d => <Block key={d.status} label={d.status} value={t("common.number", { value: d.queries })} />)}
</Container>
);
}

@ -0,0 +1,17 @@
import credentialedProxyHandler from "utils/proxy/handlers/credentialed";
const widget = {
api: "https://api.nextdns.io/profiles/{profile}/{endpoint}",
proxyHandler: credentialedProxyHandler,
mappings: {
"analytics/status": {
endpoint: "analytics/status",
validate: [
"data",
]
},
},
};
export default widget;

@ -17,6 +17,7 @@ import jellyseerr from "./jellyseerr/widget";
import lidarr from "./lidarr/widget";
import mastodon from "./mastodon/widget";
import navidrome from "./navidrome/widget";
import nextdns from "./nextdns/widget";
import npm from "./npm/widget";
import nzbget from "./nzbget/widget";
import ombi from "./ombi/widget";
@ -66,6 +67,7 @@ const widgets = {
lidarr,
mastodon,
navidrome,
nextdns,
npm,
nzbget,
ombi,

Loading…
Cancel
Save