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

Support to lists #7

Closed
ghost opened this issue May 15, 2020 · 13 comments · Fixed by #8
Closed

Support to lists #7

ghost opened this issue May 15, 2020 · 13 comments · Fixed by #8
Labels
enhancement New feature or request

Comments

@ghost
Copy link

ghost commented May 15, 2020

If the API allows, there might be an option to add the site to the white / black list.

@badsgahhl
Copy link
Owner

Unfortunatly there is no PIHole Api point to do this.

The only way to do this would be writing a small php script and loading that on the server to execute the commands via the cli.
I think blocklisting/whitelisting a website via the extension would be very cool. I will keep this in mind, but this won't be an upcoming feature the next time i think.

Maybe we can get some pihole devs to add these points to the api.

@ghost
Copy link
Author

ghost commented May 16, 2020

I looked a bit at the pihole code a bit and I see there is a method.

example request:

http://pi.hole:8085/admin/api.php?list=black&add=example.com&auth=here_api_key

list can be:

white
black
white_regex
white_wild
black_regex
black_wild
audit

@badsgahhl
Copy link
Owner

Insane! Is there any online documentation about this? The API documentation seems just old and not updated anymore.

I will try this methods out. Hopefully that will work fluently in the extension!

@ghost
Copy link
Author

ghost commented May 16, 2020

I can see that there was also a sub method [https://github.com/pi-hole/web/issues/1297], but something probably went wrong.

example request:

http://pi.hole:8085/admin/api.php?list=black&sub=example.com&auth=here_api_key

@PromoFaux
Copy link

Maybe we can get some pihole devs to add these points to the api.

There is likely not going to be much more work done in terms of the PHP API, it was never really ideal to start with (hence not very well documented) Things will change on or around version 6.0 of Pi-hole with: pi-hole/FTL#659

But, obviously no timelines.

In the meantime I'll see what I can find out about the removal of the sub method

@badsgahhl badsgahhl added the enhancement New feature or request label May 17, 2020
badsgahhl added a commit that referenced this issue May 21, 2020
@badsgahhl
Copy link
Owner

badsgahhl commented May 21, 2020

I built now the first UI components and logic to solve this problem.
This is how it will probably look like:
pihole2

My plan was to show the Whitelist/Blacklist Button depending on the current state in the DB. But because of the missing API Points get.php this wont work.
Second problem was that having a domain directly on the blacklist, whitelisting it wont revert it. This can only be done by removing it via sub and then adding it to white. Or only removing it (Neither of this will work without the sub.php)

badsgahhl added a commit that referenced this issue May 22, 2020
@ghost
Copy link
Author

ghost commented May 22, 2020

Interesting idea. As if I had a moment of time, maybe I could add the missing methods, but I don't know what the development path is. I have no idea if the service in the new pihole will be through add / sub or by groups.

@badsgahhl
Copy link
Owner

Yea i saw this point in the groups, but i dont think authentification will work. As i have seen the code, you need a token which you get via the password authentification.
But getting the password from the user in the extension wont work.

@ghost
Copy link
Author

ghost commented May 23, 2020

I've added a few lines of code that should do the trick. We will see if it will be accepted.

pi-hole/web@master...dariusz-hub:patch-1

@badsgahhl
Copy link
Owner

badsgahhl commented May 23, 2020

Very cool! Hope this will pass. The implementation you made suits the extension perfect. But overall the implementation now seems more logical than before.

badsgahhl added a commit that referenced this issue May 25, 2020
badsgahhl added a commit that referenced this issue May 25, 2020
@badsgahhl
Copy link
Owner

If you are interested in testing this feature, feel free to use this beta built here:
https://github.com/badsgahhl/pihole-chrome-extension/releases/tag/2.1.0-beta1

@badsgahhl badsgahhl linked a pull request May 25, 2020 that will close this issue
badsgahhl added a commit that referenced this issue May 25, 2020
@ghost ghost mentioned this issue May 25, 2020
badsgahhl added a commit that referenced this issue May 26, 2020
badsgahhl added a commit that referenced this issue May 28, 2020
badsgahhl added a commit that referenced this issue May 28, 2020
badsgahhl added a commit that referenced this issue May 28, 2020
@PromoFaux
Copy link

@badsgahhl could you try your extension against the new/api_add_sub_get_lists branch, please? (pihole checkout web new/api_add_sub_get_lists) and let me know if it works for you?

@badsgahhl
Copy link
Owner

badsgahhl commented May 28, 2020

@PromoFaux Works like a charm!

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

Successfully merging a pull request may close this issue.

2 participants