Pihole allow auth, updated API endpoint

pull/714/head
Michael Shamoon 2 years ago
parent de584eae8f
commit a9429e5335

@ -9,7 +9,7 @@ export default function Component({ service }) {
const { widget } = service; const { widget } = service;
const { data: piholeData, error: piholeError } = useWidgetAPI(widget, "api.php"); const { data: piholeData, error: piholeError } = useWidgetAPI(widget, "summaryRaw");
if (piholeError) { if (piholeError) {
return <Container error={piholeError} />; return <Container error={piholeError} />;
@ -27,9 +27,9 @@ export default function Component({ service }) {
return ( return (
<Container service={service}> <Container service={service}>
<Block label="pihole.queries" value={t("common.number", { value: piholeData.dns_queries_today })} /> <Block label="pihole.queries" value={t("common.number", { value: parseInt(piholeData.dns_queries_today, 10) })} />
<Block label="pihole.blocked" value={t("common.number", { value: piholeData.ads_blocked_today })} /> <Block label="pihole.blocked" value={t("common.number", { value: parseInt(piholeData.ads_blocked_today, 10) })} />
<Block label="pihole.gravity" value={t("common.number", { value: piholeData.domains_being_blocked })} /> <Block label="pihole.gravity" value={t("common.number", { value: parseInt(piholeData.domains_being_blocked, 10) })} />
</Container> </Container>
); );
} }

@ -1,12 +1,12 @@
import genericProxyHandler from "utils/proxy/handlers/generic"; import genericProxyHandler from "utils/proxy/handlers/generic";
const widget = { const widget = {
api: "{url}/admin/{endpoint}", api: "{url}/admin/api.php?{endpoint}&auth={key}",
proxyHandler: genericProxyHandler, proxyHandler: genericProxyHandler,
mappings: { mappings: {
"api.php": { "summaryRaw": {
endpoint: "api.php", endpoint: "summaryRaw",
validate: [ validate: [
"dns_queries_today", "dns_queries_today",
"ads_blocked_today", "ads_blocked_today",

Loading…
Cancel
Save