diff --git a/src/widgets/components.js b/src/widgets/components.js index b0752b62..552e4934 100644 --- a/src/widgets/components.js +++ b/src/widgets/components.js @@ -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")), diff --git a/src/widgets/nextdns/component.jsx b/src/widgets/nextdns/component.jsx new file mode 100644 index 00000000..75ef04f0 --- /dev/null +++ b/src/widgets/nextdns/component.jsx @@ -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 ; + } + + if (!nextdnsData) { + return ( + + No data + + ); + } + + return ( + + {nextdnsData?.data?.map(d => )} + + ); +} diff --git a/src/widgets/nextdns/widget.js b/src/widgets/nextdns/widget.js new file mode 100644 index 00000000..012ef029 --- /dev/null +++ b/src/widgets/nextdns/widget.js @@ -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; diff --git a/src/widgets/widgets.js b/src/widgets/widgets.js index b3eaa885..e8998164 100644 --- a/src/widgets/widgets.js +++ b/src/widgets/widgets.js @@ -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,