-
-
Notifications
You must be signed in to change notification settings - Fork 392
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enhancement/add support pihole v6 #371
base: main
Are you sure you want to change the base?
Conversation
@@ -27,6 +33,8 @@ type dnsStatsWidget struct { | |||
AllowInsecure bool `yaml:"allow-insecure"` | |||
URL string `yaml:"url"` | |||
Token string `yaml:"token"` | |||
AppPassword string `yaml:"app-password"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could probably get away with using the existing password
though that's for the maintainer to decide
internal/glance/widget-dns-stats.go
Outdated
if token == "" { | ||
return nil, errors.New("missing API token") | ||
// piholeGetSID retrieves a new SID from Pi-hole using the app password. | ||
func piholeGetSID(instanceURL, appPassword string) (string, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing allowInsecure, I was getting certificate error
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The API was rewritten, and so are the output, it looks like you're still using the same piholeStatsResponse
as v5. I think you'd need to query multiple API from pihole to get those required data as /api/stats/summary
doesn't have everything required for the widget to work.
# Probably for QueriesSeries and BlockedSeries,
# or not
/api/stats/database/summary?from=1740020400&until=1740021160`
# TopBlockedDomains
/api/stats/top_domains?blocked=true&count=10
The rest should be available from the first query.
@ralphocdol I've been able to fix a good portion of your comments. The only thing left is for me to understand these two values:
Are these in the original |
@KallanX I think this has something to do with the widget's bar graph based on the comment on this code // Pihole _should_ return data for the last 24 hours in a 10 minute interval, 6*24 = 144
if len(r.QueriesSeries) != 144 || len(r.BlockedSeries) != 144 {
return stats
} So the API Looking at the screenshot from the DNS Stats docs The reddish one is most likely the |
{
"history": [
{
"timestamp": 1511819900.539157,
"total": 2134,
"cached": 525,
"blocked": 413,
"forwarded": 1196
},
{
"timestamp": 1511820500.583821,
"total": 2014,
"cached": 52,
"blocked": 43,
"forwarded": 1910
}
],
"took": 0.003
} BlockedSeries = blocked |
Adding support for the newly released Pi-hole major version 6. This update changed how you interact with the API.