mirror of
https://github.com/karl0ss/homepage.git
synced 2025-05-02 21:43:39 +01:00
Adds widget for NextDNS
This commit is contained in:
parent
e7b0fc1419
commit
fb2492e577
@ -22,6 +22,7 @@ const components = {
|
|||||||
lidarr: dynamic(() => import("./lidarr/component")),
|
lidarr: dynamic(() => import("./lidarr/component")),
|
||||||
mastodon: dynamic(() => import("./mastodon/component")),
|
mastodon: dynamic(() => import("./mastodon/component")),
|
||||||
navidrome: dynamic(() => import("./navidrome/component")),
|
navidrome: dynamic(() => import("./navidrome/component")),
|
||||||
|
nextdns: dynamic(() => import("./nextdns/component")),
|
||||||
npm: dynamic(() => import("./npm/component")),
|
npm: dynamic(() => import("./npm/component")),
|
||||||
nzbget: dynamic(() => import("./nzbget/component")),
|
nzbget: dynamic(() => import("./nzbget/component")),
|
||||||
ombi: dynamic(() => import("./ombi/component")),
|
ombi: dynamic(() => import("./ombi/component")),
|
||||||
|
31
src/widgets/nextdns/component.jsx
Normal file
31
src/widgets/nextdns/component.jsx
Normal file
@ -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>
|
||||||
|
);
|
||||||
|
}
|
17
src/widgets/nextdns/widget.js
Normal file
17
src/widgets/nextdns/widget.js
Normal file
@ -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 lidarr from "./lidarr/widget";
|
||||||
import mastodon from "./mastodon/widget";
|
import mastodon from "./mastodon/widget";
|
||||||
import navidrome from "./navidrome/widget";
|
import navidrome from "./navidrome/widget";
|
||||||
|
import nextdns from "./nextdns/widget";
|
||||||
import npm from "./npm/widget";
|
import npm from "./npm/widget";
|
||||||
import nzbget from "./nzbget/widget";
|
import nzbget from "./nzbget/widget";
|
||||||
import ombi from "./ombi/widget";
|
import ombi from "./ombi/widget";
|
||||||
@ -66,6 +67,7 @@ const widgets = {
|
|||||||
lidarr,
|
lidarr,
|
||||||
mastodon,
|
mastodon,
|
||||||
navidrome,
|
navidrome,
|
||||||
|
nextdns,
|
||||||
npm,
|
npm,
|
||||||
nzbget,
|
nzbget,
|
||||||
ombi,
|
ombi,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user