anudeepND / whitelist

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

remove error prone total_changes function introduced in #158 #163

Closed mwoolweaver closed 4 years ago

mwoolweaver commented 4 years ago

https://github.com/anudeepND/whitelist/pull/158/files/e58bf0e986d6d1942b40c33f1458619c2941ac1a#diff-ae558a92912d7c9374a906e64b4b158eR133

and

https://github.com/anudeepND/whitelist/pull/158/files/e58bf0e986d6d1942b40c33f1458619c2941ac1a#diff-6fea026f04d10fad806b3d3b71d7747aR129

IMO your only adding or removing and URL from the whitelist WHERE type = 0 AND comment LIKE '%qjz9zk%' so that's all we should check for.

Also worth noting is the number you're wanting to get back from total_changes is the same as the number of domains added OR removed by the respective scripts.

 # find only the domains we added
        number_domains = cursor.execute(" SELECT * FROM domainlist WHERE type = 0 AND comment LIKE '%qjz9zk%' ")

        numberDomains = len(number_domains.fetchall())

new version can be tested from here

https://github.com/mwoolweaver/whitelist/tree/devel

wget https://raw.githubusercontent.com/mwoolweaver/whitelist/devel/scripts/whitelist.py

mwoolweaver commented 4 years ago

development branch does not appear up-to-date with master so re-opening

anudeepND commented 4 years ago

@mwoolweaver Thanks for the information.

IMO your only adding or removing and URL from the whitelist WHERE type = 0 AND comment LIKE '%qjz9zk%' so that's all we should check for.

I think it is better to get all the domain in the whitelist, including both regex and normal domains. I merged a previously opened PR so there's a merge conflict, can you fix it?

mwoolweaver commented 4 years ago

@anudeepND see #164 for update. also accomplished in less commits