How to add blocklists - V5 and later

6 posts were split to a new topic: Blocklist question

Just joining in. Experiencing the same discomfort here. It is indeed about inputting multiple lists at once, but also, about 1 duplicate list stopping the whole processing instead of just being skipped. This is also a case of regression in 5.0, since 4.x did this before.

So I took the liberty to dive into it real quick, code wise:

File containing the HTML interface:

File containing the JS events:

File processing the inputted adlists:

Relevant action: add_adlist
Starting at line: 660

Culprits:

  1. Possible confusion
  • HTML placeholder shows "http://..., https://..., file://...". Note the commas. Users might think the comma needs to be actually there.
  • The actual code does: $addresses = explode(' ', trim($_POST['address'])); which means it splits multiple domains by spaces.
  • Solution: it would be better not to split on space, since web addresses can contain non-encoded spaces (non %20). Best is to split on \n AND \r (to make it cross platform compatible, *nix/win) and leaving out any empty array elements it might result in. This solution works best with a textarea instead of the input now.
  1. Terminating all execution
  • Further code (lines 676-692) executes statements to populate the database. These throw new Exception(). This halts further processing.
  • Solution: populate an empty array with each exception encountered, but continue processing. At the end, return the array showing in the popup in the interface. No need for terminating the whole process.

I'm currently about to grab a bite to eat, otherwise I would have written the code myself. If nobody does it before I get a chance to, I still will. It would a a nice addition to V5.

Yes, that will work. It uses spaces between each (simple) address.

This is a different problem: you are entering addresses of lists you already have. Right now, you can only enter new addresses. But as said in my post above, this will be changed so you can have addresses in there that you already have without stopping. If not for me, some of us programmers will add this asap.

that is correct

correct. for now. again, I hope we can offer a larger field again soon that will accept multiple lines. hang in.

Pihole is getting rid of that IP anyways. It will block the domain name. No matter what IP is in front. Normally you only add domain names. But pihole can work with lists that have an IP in front to some degree, this style is called "host file"-style and comes from a long time ago. But it can still be used today. Anyways, do not worry about it. Pihole got your back and does it right.

the domain "fpn81171321mp.hol.es?" contains a question mark at the end, which is not valid. The other domains seem valid, this might indeed be a URL encoding problem.

Please note, the Adlist Group Management is ONLY meant to supply lists to. Lists having domains that you want to block. Do not add domains there which you want to block. You can add domain to block under "Blacklist". The Adlist page is for addresses leading to lists that contain many domains to block.

Agreed

Since I ran into this myself, I just might send a pull request or at least paste the desired code changes for all this myself.

I am aware of this. The original question was how to bulk add adlists, not domains.

Bulk addition of domains is also supported in the same way, but with domains only, not URLS that would be added to the adlist.

no, i know you know @jfb :smiley: this was just to clarify for other readers that might stumble upon this thread.

This would be really great.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.