getAlby / lightning-browser-extension

The Bitcoin Lightning Browser extension that connects to different wallet interfaces and brings deep lightning integration to the web
https://getalby.com
MIT License
530 stars 193 forks source link

block webln provider request on a certain site #258

Closed pseudozach closed 2 years ago

pseudozach commented 2 years ago

It should be possible to block a domain (and remove from block list later) because otherwise it might pop up every single time and user has to close the popup every time.

bumi commented 2 years ago

some inspiration how we can do this with browser built in functionality/context menus: https://github.com/fregante/webext-domain-permission-toggle

pseudozach commented 2 years ago

In my case, I have a site I visit regularly that supports webLN but for some personal reason I would rather not use my alby connected wallet there. So every time I visit this site either I need to close the connect request popup window on each refresh or I have to disable alby completely.

bumi commented 2 years ago

Wondering if that library could help: https://github.com/fregante/webext-domain-permission-toggle - I don't know how it works exactly but I think it enables/disables the extension using the browser permissions.

Alternatively we should introduce a block list and store that one in the settings. Then we need to check if the host is in that list in the shouldInject.

We can just store an array and allow users to edit that list in the settings?

pseudozach commented 2 years ago

I looked at webext-domain-permission-toggle but it requires refreshing the whole extension and uses global extension domain access.

I like the block list saved in extension settings option. Maybe we can add block list to the websites list under blocked section and user can click to remove them from there.

bumi commented 2 years ago

That's actually much much better! this is how we should do it. It is simple a flag on the website/allowance in the DB that we already store. great.

pseudozach commented 2 years ago

hi @bumi I started doing this on this branch https://github.com/pseudozach/lightning-browser-extension/tree/blocklist

site is added to db.blocklist but I'm a little bit lost on where the getblocklist check should be made and where the decision to show the popup would be made and for blocklisted sites it won't show. Would you be able to take a look please?