mirror of
				https://github.com/karl0ss/homepage.git
				synced 2025-11-04 00:10:57 +00:00 
			
		
		
		
	Merge pull request #714 from benphelps/pihole-changes-1222
Pihole allow auth, updated API endpoint
This commit is contained in:
		
						commit
						ccba3d87b0
					
				@ -9,7 +9,7 @@ export default function Component({ service }) {
 | 
			
		||||
 | 
			
		||||
  const { widget } = service;
 | 
			
		||||
 | 
			
		||||
  const { data: piholeData, error: piholeError } = useWidgetAPI(widget, "api.php");
 | 
			
		||||
  const { data: piholeData, error: piholeError } = useWidgetAPI(widget, "summaryRaw");
 | 
			
		||||
 | 
			
		||||
  if (piholeError) {
 | 
			
		||||
    return <Container error={piholeError} />;
 | 
			
		||||
@ -27,9 +27,9 @@ export default function Component({ service }) {
 | 
			
		||||
 | 
			
		||||
  return (
 | 
			
		||||
    <Container service={service}>
 | 
			
		||||
      <Block label="pihole.queries" value={t("common.number", { value: piholeData.dns_queries_today })} />
 | 
			
		||||
      <Block label="pihole.blocked" value={t("common.number", { value: piholeData.ads_blocked_today })} />
 | 
			
		||||
      <Block label="pihole.gravity" value={t("common.number", { value: piholeData.domains_being_blocked })} />
 | 
			
		||||
      <Block label="pihole.queries" value={t("common.number", { value: parseInt(piholeData.dns_queries_today, 10) })} />
 | 
			
		||||
      <Block label="pihole.blocked" value={t("common.number", { value: parseInt(piholeData.ads_blocked_today, 10) })} />
 | 
			
		||||
      <Block label="pihole.gravity" value={t("common.number", { value: parseInt(piholeData.domains_being_blocked, 10) })} />
 | 
			
		||||
    </Container>
 | 
			
		||||
  );
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -1,12 +1,12 @@
 | 
			
		||||
import genericProxyHandler from "utils/proxy/handlers/generic";
 | 
			
		||||
 | 
			
		||||
const widget = {
 | 
			
		||||
  api: "{url}/admin/{endpoint}",
 | 
			
		||||
  api: "{url}/admin/api.php?{endpoint}&auth={key}",
 | 
			
		||||
  proxyHandler: genericProxyHandler,
 | 
			
		||||
 | 
			
		||||
  mappings: {
 | 
			
		||||
    "api.php": {
 | 
			
		||||
      endpoint: "api.php",
 | 
			
		||||
    "summaryRaw": {
 | 
			
		||||
      endpoint: "summaryRaw",
 | 
			
		||||
      validate: [
 | 
			
		||||
        "dns_queries_today",
 | 
			
		||||
        "ads_blocked_today",
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user