foxyproxy / firefox-extension

FoxyProxy for Firefox extension beginning with Firefox 57 (Quantum)
GNU General Public License v2.0
523 stars 115 forks source link

Suggestion: make a "add this site to profile" button #172

Closed Simon311 closed 2 years ago

Simon311 commented 2 years ago

I was hoping for this functionality to be available already, but unfortunately it isn't. The basic idea is to be able to enable proxying for specific websites with a single click. Now, you can still make a prompt that asks which profile you want to add the website to and a prompt that lets you review the new whitelist rule before committing, but I hope you get the idea. I found it tedious to manually add websites that block access only to find after whitelisting them that they weren't good at all. But I also don't want to just enable the proxy globally in case there's a background tab accessing something from different sites.

erosman commented 2 years ago

you can still make a prompt that asks ...

There is a major hiccup with prompts and all modal popups in modern browsers. Such dialogues are passed to content context, which means the web page, as Firefox does not provide them anymore.

The problem with generating modals from the web page is that it can be blocked by the page via its Content Security Policy (CSP), therefore it is not reliable.

... asks which profile you want to add the website to and a prompt ...

There are far too many steps to make that possible:

In other words, nearly the entire Option page has to be recreated as a popup which defeats the purpose of not going to the Option page.

ericjung commented 2 years ago

This is something older versions of FoxyProxy for Firefox offered. I like the idea. We do not need to recreate the options popup. We could add a default include wildcard pattern to a pre-selected proxy. For example always add the pattern *://current-domain/

mall that is needed is a confirmation “toast” message to the user: “added pattern *://current-domain to proxy”

erosman commented 2 years ago

Simple confirmation is not possible on many sites that have restrictive CSP like GitHub.

ericjung commented 2 years ago

We don’t need confirmation. Just notification.

erosman commented 2 years ago

That is not the same as the request

The basic idea is to be able to enable proxying for specific websites with a single click.

Not possible with a single click. It require multiple clicks and a drop-down menu selection

you can still make a prompt that asks which profile you want to add the website to Modal prompt with all proxies in a select drop-down

and a prompt that lets you review the new whitelist rule before committing

New Modal prompt to view the result with proxy & whitelist pattern

It also needs a UI to allow user to edit, in case the *://current-domain/* is not desired.

In other words, just a small duplicate of the Option page.

Let's see if there is a popular demand for such a feature.

erosman commented 2 years ago

As work is underway for FoxyProxy v8.0:

Initial UI for "add this site to.."

Apply the Pattern

Observation:

It appears there is a lot of work involved that could be done with a simple copy/paste.

Suggestions are welcomed....

ericjung commented 2 years ago

Apply the Pattern

i don’t understand why the steps in this section are necessary.

  1. user can pre-select the proxy for the pattern in the options window. Thuan only needs to be done once, at setup time
  2. Can’t the pattern that is generated be saved directly to storage?3.
  3. Notify user with notifications bubble

why does the options window need to be opened?

erosman commented 2 years ago
  1. user can pre-select the proxy for the pattern in the options window.

That is possible but what if the user doesn't want to always add every site to a single proxy? There will be requests to make the feature available for all proxies as per original request of this topic.

  1. Can’t the pattern that is generated be saved directly to storage?

That is possible. The UI would be simpler but each add generates a lot of processes, PAC to be rewritten and applied, rules updated, in addition to storage read/writes since it has to be performed from the background service worker or event page in MV3.

While doing it from Options page involves a lot less processes.

Furthermore, opening the Options page enables user to:

Comparison

There is a lot of code & processing plus 2 UI involved to replace a simple copy/paste.

erosman commented 2 years ago

I have thought of an idea.... lets see how it works out.

erosman commented 2 years ago

"Add Host Pattern to ..." context-menu feature added in FoxyProxy v8.0 (once released). Only top 10 proxies are listed (not practical to list 100s).

ericjung commented 2 years ago

Nice work!