Jelmerro / Vieb

Vim Inspired Electron Browser - Vim bindings for the web by design
https://vieb.dev
GNU General Public License v3.0
1.33k stars 65 forks source link

Extension support overview #130

Closed Jelmerro closed 2 years ago

Jelmerro commented 3 years ago

Background

Since Vieb version 4.0.0 it is possible to install extensions from the Chrome and Mozilla extension stores. However, the support for extensions is far from ideal, so this issue aims to list the status of support of various extension features.

Features

Improvements

I welcome everyone to improve the extensions support of Vieb (and other features) via PRs. Please also discuss things I missed in this list, or comment your experience with extensions, and what would be needed to make them work.

albert-ying commented 3 years ago

Wow, this is the only vim-like browser that supports extensions, as far as I noticed. This is really a game-changer if the extensions that require interactions are fully supported. I'm looking forward to seeing where it goes!

chramb commented 3 years ago

Hi, I've recently started using vieb (4.3.0 on tar.gz and appimage) and encountered this error swappy-20210412_110925 When trying to install extensions from web store, it downloads them correctly but fails to extract. The workaround for me for now was to manually extract extensions to ~/.config/Vieb/extensions/

ByJumperX4 commented 3 years ago

@chramb I have the same with a build from last commit as of 12 April 2021 Capture d’écran du 2021-04-12 13-56-46

Jelmerro commented 3 years ago

I believe I have located the issue, please check again after git pull or wait for the next release.

mplanchard commented 3 years ago

Howdy! For some reason when I try to download this extension, I get the error:

Failed to install extension due to a network error.

I get the same error when trying to install the extension from the chrome web store.

I don't see any errors in either the regular or the internal dev tools. Any hints for trying to dig in further to figure out what's going on?

Thanks!

mplanchard commented 3 years ago

Nevermind. I noticed this was also happening with other extensions. Quitting Vieb completely and restarting seems to have fixed it. Thanks again!

Jelmerro commented 3 years ago

If it fails the first time, there is a fair chance that installing it a second time WITHOUT restarting Vieb will also fail. Glad that a restart solved it. Though just as a disclaimer, most extensions don't really work properly yet, due to the missing things listed as a checklist in my initial comment.

matthjes commented 3 years ago

Is it somehow possible to configure exensions? I've installed uBlock Origin, but it's not working (still seeing ads when comparing to Firefox).

Jelmerro commented 3 years ago

As outlined in the initial issue comment, it's not. The checklist above will be kept up to date with supported features and things that still need work. Though in this case I want to mention that Vieb has a built-in adblocker, for which you can also add additional blocklists (see :help adblocker for details). For now most extensions don't work, until someone decides to take the time to implement the missing APIs.

minego commented 3 years ago

Is this an issue where a PR would be helpful? I haven't dug into the source for this project yet, but I may be willing to start digging and poking for the sake of this feature.

I am a qutebrowser user, and would switch to this in a heartbeat if I could use the bitwarden extension. I currently use bitwarden with qutebrowser via a script, but it is NOT elegant, and actual support for the extension is a much better solution.

Jelmerro commented 3 years ago

All support in the form of feedback, comments or PRs are welcome for this and other issues/features, so absolutely! I personally got kind of stuck improving the extension support further than it currently is, but if somebody knows what we need to bring it to the next level, please feel free to leave a comment or even make a PR. The initial comment of this thread contains a list of features and checkboxes, everything that isn't checked still needs to be implemented.

minego commented 3 years ago

I can't promise anything, but I'll poke around and make an attempt. If I can find a decent way to use bitwarden with vieb then I'll be a convert.

minego commented 3 years ago

I've only been poking a bit (between work meetings) and it seems that using something like https://www.npmjs.com/package/electron-chrome-extensions might be the way to go.

Jelmerro commented 3 years ago

Seems like a potential solution, would be great if you could get it to work!

minego commented 3 years ago

I'm not sure when I will have time, but I will try.

I tested their electron-browser-shell which uses that, and it does appear to load extensions properly, including bitwarden, which feels promising.

dit7ya commented 3 years ago

Is there any way to see the webextension background console? Like I have authored a Firefox extension which does not work on Vieb, and how would I know why does it not work?

Jelmerro commented 3 years ago

There is no way to do this, Electron doesn't provide it by default. Or as they say themselves in the docs: "It's a non-goal of Electron to support all extensions". This is where additional packages like this one come in, which SHOULD make it possible to do it. It's just that I haven't found a way to use them with webviews yet. If anyone knows how to do it, I welcome PRs! (this is also what the help wanted label is for, it's basically a list of things I don't have time for or can't get to work myself.)

Jelmerro commented 2 years ago

I'll be deprecating the current implementation of extension support in favor of bringing commonly requested features into Vieb, starting with darkreader and sponsorblock. Therefor, I'm closing this issue as a won't fix. It's simply too much work to implement working extension support, and I'll be working on bringing commonly requested features/extensions to Vieb instead of continuing this effort. If anyone every figures out how to make them work PROPERLY, don't hesitate to make a PR for it, but until then, I'm closing this.

kovdan01 commented 1 year ago

Hello @Jelmerro and thanks for your fantastic work on Vieb! As far as I understood, some initial extensions support was implemented, but then removed since it was hard to implement missing parts. Was just keeping already implemented stuff hard? If no, can't we just have this initial support considered an experimental option, but still enabled? I suppose that every person has their own set of extensions, and it's only possible to embed several most common ones, which might be a game changer if someone is very reliant on a non-popular extension which will never be implemented in Vieb itself.

Jelmerro commented 1 year ago

Since there wasn't a single extension that worked well, I have implemented a couple of the popular ones directly into Vieb, as per new linked ticket. Even darkreader as an example, which seems like a fairly basic extension in terms of interactivity with the graphical interface, did not work properly and did not have any options to toggle it or add exceptions, whereas the integrated darkreader is both easy to toggle and has an ignore list. And it's not just better in terms of usability and integration with Vieb's settings, it's also much smaller, as the extension API requires 7zip binaries to extract extensions, and even then they don't work well. Vieb's build process is as easy partially because this part of the app was dropped, and it has only lead to more essential extensions being integrated into Vieb, that are better aligned with Vieb's usage than any extension could. The install process also was quite flaky, needed frequent reinstalls, would always be per datafolder instead of per user and could only be done with commands instead of clicking website install buttons. If there's anything you are missing in Vieb, just let me know via a github issue or via Matrix/Telegram and I'll add it to the todo list, but I don't see full extensions coming back any time soon (PRs are welcome though).

kovdan01 commented 1 year ago

Ah, now I understand the issue, thanks for explanation!

Regarding features which Vieb may benefit from - embedding a uMatrix/NoScript-like extension, so each content type (media, script, frame, etc) may be enabled/disabled separately for each domain. As far as I understood (searched through the repo for related keywords), there is no such functionality yet.

A couple other ideas: embedding https://libredirect.github.io/ and https://github.com/igrigorik/videospeed

Jelmerro commented 1 year ago

Custom blocklists are supported in Vieb, see :h adblocker and you can customize which resources are allowed per site via the resourcetypes setting, including the regex lists to do this per site/domain/any regex match using resourcesallowed and resourcesblocked. So although not as graphical as uMatrix, it can do everything that you can do with that extension. For libredirect, the same is true using :h redirects and video speeds are a good suggestion, I'll add this to my todo list, should be easy.

kovdan01 commented 1 year ago

Thanks for such a detailed explanation!

dawsers commented 8 months ago

The main difference with uMatrix is there you can reject loading certain resources by default, and then whitelist them one by one. So you can navigate "safely" and incrementally allow certain objects to load. And it can differentiate between 1st party (loaded website) and third party (loaded from the original website) resources.

Vieb only allows to block or allow resources globally per domain. so to get the same "third party" differentiation, we need to use adblock rules, like clodflare.com$scripts,domain=example.com to block scripts from cloudflare.com when called from example.com. The problem is for this to work, cloudflare.com scripts need to be enabled globally, so when any domain loads, they are enabled until we create a rule to block them. So the approach is exactly the opposite of uMatrix, and arguably more dangerous, as by default we need to allow domains globally even if we just want to use them as a third party in a few sites.

So uMatrix works more like an "adenabler" than an adblocker. Maybe Vieb could support something like that too, either through the same logic as uMatrix, or having another field in resourcesblocked/allowed that supports the concept of origin URL, so we can block/allow resources coming from third party domains.

The other thing I miss from uMatrix is the cookies blocking (they are just another resource). It allows the site to store cookies, but doesn't allow them to read cookies when the resource is blocked. So the site thinks it set them, but when it tries to load them in another session, it thinks they were never set. The setting can be configured per site too. Vieb supports deleting cookies, but you need to do it manually.

Jelmerro commented 6 months ago

I like this idea, but I do not have the time at the moment to implement such a detailed filtering system, PRs are welcome if anyone else wants have a go at it.