make title-url of pihole and pihole-v6 default to /admin

This commit is contained in:
Ralph Ocdol 2025-03-18 11:02:26 +08:00
parent fd5cf98072
commit 55685e6854

View File

@ -60,10 +60,19 @@ func makeDNSWidgetTimeLabels(format string) [8]string {
return labels return labels
} }
func getWidgetTitleURL(widget *dnsStatsWidget) string {
switch widget.Service {
case dnsServicePihole, dnsServicePiholeV6:
return fmt.Sprintf("%s/admin", strings.TrimRight(widget.URL, "/"))
default:
return widget.URL
}
}
func (widget *dnsStatsWidget) initialize() error { func (widget *dnsStatsWidget) initialize() error {
widget. widget.
withTitle("DNS Stats"). withTitle("DNS Stats").
withTitleURL(string(widget.URL)). withTitleURL(getWidgetTitleURL(widget)).
withCacheDuration(10 * time.Minute) withCacheDuration(10 * time.Minute)
switch widget.Service { switch widget.Service {