[BUG] pi-hole widget does not display data from API
saniac opened this issue · comments
Environment
Self-Hosted (Bare Metal)
System
Firefox 126.0.2 and Chromium Version 126.0.6478.114
Version
3.1.1
Describe the problem
Dashy displays the widget correctly but unpopulated with data except for Active Clients field which shows "Undefined/Undefined".
Additional info
I set up the pi-hole-stats widget as follows:
- type: pi-hole-stats
label: Pihole DNS
options:
hostname: http://dns
apiKey: xxxxxxxxxxxxxxxxxxx
I have created a proxy server for the pihole server which adds the header Access-Control-Allow-Origin: * and I can verify that this is set in the response:
HTTP/1.1 200 OK
Access-Control-Allow-Origin: *
Cache-Control: no-store, no-cache, must-revalidate
Content-Length: 756
Content-Security-Policy: default-src 'self' 'unsafe-inline';
Content-Type: application/json
Date: Thu, 27 Jun 2024 09:21:35 GMT
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Pragma: no-cache
Referrer-Policy: same-origin
Server: Caddy
Server: lighttpd/1.4.53
Set-Cookie: PHPSESSID=bg4fueo32aq6rr42cls3qb5lm3; path=/; HttpOnly; SameSite=Strict
X-Content-Type-Options: nosniff
X-Frame-Options: DENY
X-Permitted-Cross-Domain-Policies: none
X-Pi-Hole: The Pi-hole Web interface is working!
X-Xss-Protection: 0
The pihole server returns this JSON:
{"domains_being_blocked":"161,604","dns_queries_today":"48,829","ads_blocked_today":"10,490","ads_percentage_today":"21.5","unique_domains":"4,020","queries_forwarded":"30,186","queries_cached":"7,323","clients_ever_seen":"16","unique_clients":"16","dns_queries_all_types":"48,829","reply_UNKNOWN":"965","reply_NODATA":"6,344","reply_NXDOMAIN":"815","reply_CNAME":"11,853","reply_IP":"26,375","reply_DOMAIN":"301","reply_RRNAME":"138","reply_SERVFAIL":"1,894","reply_REFUSED":"0","reply_NOTIMP":"0","reply_OTHER":"0","reply_DNSSEC":"6","reply_NONE":"0","reply_BLOB":"138","dns_queries_all_replies":"48,829","privacy_level":"0","status":"enabled","gravity_last_updated":{"file_exists":true,"absolute":1719476443,"relative":{"days":0,"hours":1,"minutes":0}}}
I do not see errors in the browser console.
Please tick the boxes
- You have explained the issue clearly, and included all relevant info
- You are using a supported version of Dashy
- You've checked that this issue hasn't already been raised
- You've checked the docs and troubleshooting guide
- You agree to the code of conduct