Can I implement my own plugin?

Hi,
I'm a developer and I was wondering if there's an option to extend pihole with my won logic, for example detect ads in the browser and add them to my pihole using a chrome extension. for maybe disable pihole for the current site.

Thanks

The Pi-hole documentation is available here:

https://docs.pi-hole.net/

I don't think there is a (direct and ) easy way that a browser extension (or anything external for that matter) to add a link to the database. I supposes you could over complicate a call into the blacklist feature ...

RamSet has already pointed you to the docs, so I just share some general thoughts as provoked by your question. :wink:

Pi-hole is a DNS filtering forwarder. It is dealing with DNS requests exclusively, independently processing isolated individual DNS queries as they happen, request by request.

As such, Pi-hole is utterly oblivious to concepts like web pages, let alone whole sites.
The logic that defines these concepts is tied to your browser, and they are completely absent from the DNS protocol.

You should be aware that Pi-hole is strictly a server. It doesn't require your clients to install any software, so there are no Pi-hole components running on a client.

Also, the browser context is much richer in detail than the DNS protocol, so your endeavour of detecting ads in the browser may turn up items that are not blockable at the DNS level.
E.g. pictures of certain dimensions that are commonly used for advertising could be blocked in the browser, but cannot be blocked by Pi-hole if sourced from the same domain that serves the content you want to look at.

If you'd focus on just identifying domains, you could perhaps just collect them and store them in a network shared folder in HOSTS format and have Pi-hole read that file as another blocklist.

My personal guess would be that even then, with a Pi-hole properly tailored with blocklists appropriate to a specific network's behaviour, you'd hardly come across any domains that are not partial to a blocklist or regex already.

I've seen only yesterday

Isn't this what is looking for?

pi.hole/admin/api.php?list=white&add=dangerousstuff.com

I very much agree on this point. If there is a browser plugin available, users will install it without thinking about if they need it at all. They may even switch to using your plugin exclusively. Humans are lazy as you all know. If they can do something with one click less, they will adopt it. However, if something breaks, they will flood the Pi-hole forums with support requests even when nothing can be done about it here.

That is indeed. It is not released yet though but it’s set to be out with Pi-hole 5.1.