Skip to content
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

Adding customization options to PiHole custom service #784

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

emilywotruba
Copy link
Contributor

Description

Currently, the PiHole custom service can only show the percentage of blocked queries. I was interested in other statistics, so I added two new items to its configuration:

  • items an array of keys specifying in which fields of the api you are interested in
  • format a string giving the format of the subtitle. Here, "{n}" will be replaced by the value of the n'th key from items

Examples: If we leave items and format empty, the old subtitle will be generated, so this addition does not break old configurations. This is equivalent to setting:

items: ["ads_percentage_today"]
format: "{0}% blocked"

grafik

Another interesting statistic:

items: ["queries_forwarded", "dns_queries_today"]
format: "{0} of {1} queries forwarded"

grafik

The second addition is that instead of a red disabled, the status will now be an orange dns only if blocking is off. This is because PiHole itself can be enabled while the blocking feature is disabled:
grafik

Fixes # N/A

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist:

  • I've read & comply with the contributing guidelines
  • I have tested my code for new features & regressions on both mobile & desktop devices, using the latest version of major browsers.
  • I have made corresponding changes to the documentation (README.md).
  • I've checked my modifications for any breaking changes, especially in the config.yml file

Copy link

netlify bot commented May 22, 2024

Deploy Preview for homer-demo-content failed.

Name Link
🔨 Latest commit a82947c
🔍 Latest deploy log https://app.netlify.com/sites/homer-demo-content/deploys/664e0a4772e29a00078d2494

@emilywotruba emilywotruba marked this pull request as ready for review May 22, 2024 15:09
Copy link
Owner

@bastienwirtz bastienwirtz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this @emilywotruba ! Just one question and we should be good to merge.
Also if you could rebase your branch from main, it would be perfect 🙏

for (const i in this.items)
this.results[i] = response[this.items[i]];
} else throw new Error();
1;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this on purpose ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants