impulse-blocker
impulse-blocker copied to clipboard
subdomain whitelist
Great tool but the one problem I regularly run into is my youtube.com listing.
The result is that if I enter my username and password into any Google login prompt (or when they want me to revalidate who I am, etc etc), I get dropped onto:
Impulse Blocker
Your impulse to visit accounts.youtube.com is successfully blocked!
Google seem to use this as to set some authentication cookie for me, I have no idea why they do this (probably ads, duh!) but it is what it is.
Is there a way for me to allow 'accounts.youtube.com' whilst blocking everything else?
I run into the same problem constantly so it would be nice to work on this. Let's not forget that we can contribute!
Thanks for the idea! I can see how this can be a big annoyance.
I don't know if we can implement a "whitelist" with the API we're using. It just allows me feed in a list or URLs (via a match pattern). So I don't think I can say block youtube.com
but not accounts.youtube.com
.
I think we block all subdomains by default. Which seems wrong to me. Maybe we should change that. If you block example.com
, we start blocking a.example.com
as well. That's due the match pattern we're creating.
Feel free to play around this idea. I certainly will this weekend. Now that we have unit tests I am more comfortable making a change like this.
My advice is to treat the webRequest
filter as a first-pass filter that only triggers your callback function when there is something of interest. This filter covers 99%+ of requests and means your extension only sees the traffic it needs to actually make a decision on.
The hook looks to be at https://github.com/raicem/impulse-blocker/blob/master/src/ImpulseBlocker.js#L62 and that hardcoded 'block' instruction will need to be replaced with a function that hooks in your rule engine.
Holding me back submitting a PR is that my opinion on how this should work (UI/UX wise) is probably different to how you see it and that decision is ultimately yours, once the UX/UI decision is the actual rule engine work is straight forward.
One recommendation though, consider using the https://publicsuffix.org/ list to create your webRequest
match pattern filter.
I agree with @jimdigriz, the webRequest.RequestFilter will return a match for all blacklisted sites. That is the right time to check for matches against a whiteList before blocking the request.