anudeepND / whitelist

A simple tool to add commonly white listed domains to your Pi-Hole setup.
MIT License
4.18k stars 281 forks source link

add logic #170

Closed mwoolweaver closed 3 years ago

mwoolweaver commented 4 years ago

caveat

anudeepND commented 4 years ago

@mwoolweaver @mmotti I'm still a learner so my python code isn't great :smile:

mwoolweaver commented 4 years ago

@anudeepND me too! With your 2.0 update you triggered my want to learn when I saw python and sql I couldn't resist giving it a go. Hopefully you don't mind the P/R's and hopefully I leave enough comments in my code that everyone can understand what is happening.

Also don't rush to merge this as I'd say it's still a WIP for it to accomplish it's title but I'm working towards the goal now. Almost have all logic worked out

logic

let me know if I missed a case

anudeepND commented 4 years ago

@mwoolweaver so far everything looks good to me. I will keep this PR open for a while if someone wants to add anything

mwoolweaver commented 4 years ago

So I think I have all the logic worked out.

Here is my initial attempt at making it work https://github.com/mwoolweaver/whitelist/commit/20beea94455e85d12841822d585e01aaf064198f (it will say it is adding/deleting but it's not I want to make sure the logic works first)

worth noting is I haven't tried running this yet but my visual inspection thinks it should work, that could be wrong tho. . .

Please also note the changes I made to domains.sql --> https://github.com/mwoolweaver/whitelist/commit/1aef09682bda96746ebb6c8bc62e0a60995d4b3c so I could hopefully handle single INSERT statements dynamically

mwoolweaver commented 4 years ago

ok so ~8 hours later i have a working version.

should do everything your current master does just selectively

https://github.com/mwoolweaver/whitelist/commit/5cc11338c676e501fb379fd0fa7ea36b90faa7c3

Again

please also note the changes I made to domains.sql --> https://github.com/mwoolweaver/whitelist/commit/1aef09682bda96746ebb6c8bc62e0a60995d4b3c so I could hopefully handle single INSERT statements dynamically

I modified whitelist.py on this branch to use the mentioned domains.sql (see here mwoolweaver/whitelist branch sql-testing whitelist.py Line 7) dynamically adding missing entries does work!!

caveats

mwoolweaver commented 3 years ago

closed in favor of #172