matryer / xbar-plugins

Plugin repository for xbar (the BitBar reboot)
https://xbarapp.com
2.45k stars 1.04k forks source link

Additions to the pi-hole plugin #1040

Open C4Wiz opened 6 years ago

C4Wiz commented 6 years ago

can the following be added to version 3.1?

print "Most Recent Blocked Domain: | color=navy" request = urllib2.Request(pihole + 'api.php?recentBlocked') response = urllib2.urlopen(request) html = response.read() print html + "|  color=black"
    print "---"
    print "Top 3 Active Clients: | color=navy"
    request = urllib2.Request(pihole + 'api.php?topClients=3&auth=' + passwd)
    response = urllib2.urlopen(request)
    html = response.read()
    print html + "|  color=black"
    print "---"
    print "Top 2 Domains & Ad's Requested: | color=navy"
    request = urllib2.Request(pihole + 'api.php?topItems=2&auth=' + passwd)
    response = urllib2.urlopen(request)
    html = response.read()
    print html + "|  color=black"
gingerbeardman commented 6 years ago

Yes, the process here on GitHub is that you create a fork of the project and make the edit, then send it back to us as a Pull Request.

The easiest way to accomplish this is to browse to the file on github.com, click the edit pencil button, make your edit, save and then press the pull request button.

We'd appreciate your help on this! Thanks.

Reply if you need any more guidance.

C4Wiz commented 6 years ago

Im sorry i didnt specify, i was wondering if the author could add it in his coding format. It’s much cleaner then mine

C4Wiz commented 6 years ago

@fmartingr

i have expanded your pi-hole plugin, and would like to chat about adding other capabilities

i have integrated the new api.php?versions to include: displaying current installed versions of core, web, FTL as well as branch. and also a update check and display. i have also included the last blocked domain: please see screenshots below

screen shot 2018-06-21 at 9 17 53 am screen shot 2018-06-21 at 9 19 37 am
fmartingr commented 6 years ago

Hey @C4Wiz! Thanks for reaching. Keep in mind that this is not my plugin, but I don't mind adding the improvements you suggested to the code if you don't want to do it.

Just notice that I no longer use Pi-hole at home so this will take some time for me.

@gingerbeardman put me on assigned if you want so I do not forget about this!

C4Wiz commented 6 years ago

@fmartingr my changes are based on the development branch that includes the new api calls for versions

i would also like to cange the enable/disable so a webpage is not opened. i had it working with urlopen, but it kept looping everytime the plugin refreshed, auto refresh after enable/disable is also a feature i tried to get going

i would also like to add the ability to run the pihole -up command from clicking on the update available, also could not figure that one out

he is my repo with the changes https://github.com/C4Wiz/pi-hole-plugin/blob/master/pi-hole.30s.py