Lissy93 / dashy

🚀 A self-hostable personal dashboard built for you. Includes status-checking, widgets, themes, icon packs, a UI editor and tons more!
https://dashy.to
MIT License
18.06k stars 1.36k forks source link

[BUG] pi-hole widget does not display data from API #1628

Closed saniac closed 3 months ago

saniac commented 4 months ago

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".

image

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

saniac commented 4 months ago

I forgot to add the pihole versions: Pi-hole v5.18.2 FTL v5.25.2 Web Interface v5.21

CrazyWolf13 commented 3 months ago

Hi

For me it's still working for Pi-hole v5.18.3 FTL v5.25.2 Web Interface v5.21

Can you make sure the hostname is correct, and set up the api-key again?

You can also try to add the CORS Proxy:

Could you show the output of the browser console?

- type: pi-hole-stats
    label: Pihole DNS
    useProxy: true
    options:
        hostname: http://dns
        apiKey: xxxxxxxxxxxxxxxxxxx 
liss-bot commented 3 months ago

Issue closed due to no response from user.