kintesh / containerise

Firefox extension to automatically open websites in a container
MIT License
414 stars 53 forks source link

Allow 'default' as a possible host name to specify the default contai… #20

Open lisdude opened 6 years ago

lisdude commented 6 years ago

…ner that external links open in.

OmenWild commented 6 years ago

+1 for this feature. I like to stuff services into their own container, but want anything not specified to fall back to a default container (that I can occasionally delete to remove cookies).

kintesh commented 5 years ago

The no container options already opens it in a default container. Am I missing something?

NomDeMorte commented 5 years ago

I think you are missing something...but I'm not sure this PR fully addresses the issue.

Firstly, what you are missing is this - I will use an example. I go to google.com. I have a rule to use the Google container for google.com. Containerise switches to the Google container as expected. In this Google container, I click a link to reddit.com. I have a rule to switch to the Reddit container when visiting reddit.com. Containerise switches to the Reddit container as expected. In this Reddit container, I click a link to imgur.com. I have NO rule for imgur. com. I stay in the Reddit container. Now, my reddit information is spread around the internet. This defeats the purpose of using containers.

What you are missing, is that *When there is no rule in Containerise, the current container is retained. It should go to the 'No Container'.

I tried to work around this by making a rule of , No Container. It is ignored. Whatever container I'm in, it stays in that container if there is no matching rule otherwise. Rules specifying as the hostname are not used, if you are already in a container.

So, it seems simple - allow links which do not match any rule, to open in the 'No container' container - However, this does not match some use cases, such as people who use containers to separate identities on the same website for example https://github.com/kintesh/containerise/issues/53

What is needed here, is a different approach to the rule set for assigning containers. We need a ruleset for ENTERING a container, and another ruleset for EXITING a container. Intuitively, the way to do this is to have a list of containers, and for each of them, a list of URLs/masks/regexs (like we have now) which will cause the browser to switch to that container.... and then a set of the same style (masks/regexes) which should be applied to links followed from within that container.

For ease of use, the 'No container' should be selected by default for any link not matching the entry rules (ie, respect the ' asterisk ' wildcard URL rule), and people who have the edge case of using multiple containers should use the exit ruleset to perform actions such as staying in the same container regardless of the link (again, respecting the '*' URL rule, and assigning it to the same container for which they are editing the exit rules.

I'm very happy to contribute code for this, because TBH, without it, both this addon and the entire container feature of FF are useless (as mentioning in other comments - we containerise our identity and then it spreads outside of that website that is contained. Why bother?!

Such an implementation (entry AND exit rulesets, both of which respect * as an 'anything not matching the other rules' rule, ) would resolve:

https://github.com/kintesh/containerise/issues/24 https://github.com/kintesh/containerise/issues/10 https://github.com/kintesh/containerise/issues/13 https://github.com/kintesh/containerise/pull/20

And actually make FF's containers feature functionally useful.

As I said, I will be very happy to contribute code here. I am a retired dev and time-rich and have the experience to do it and I'm motivated. I just need to work out the goals before I start cutting a PR that might be rejected. Let me know how you want me to go and I'll get to work.

Edits: Typos and formatting

NomDeMorte commented 5 years ago
An example of what I mean by the above - just throwing ideas out there, to help illustrate what I mean. Please feel free to come up with better implementations!

Legend:
Container Name: (entry mask) ; (exit mask) , Exit ruleset
 _explanation comment would not be in rules_

No Container: * ; * , Default
Reddit: *.reddit.com, ; * , Default
Google: *.google.com, *.google.com.* ; * , Default
Google Work: ; * ,  Google Work

No Container: * ; * , Default
_Any address not matching other entry mask (*) would open in the 'No Container' container. When clicking a link/typing any address (*), the default ruleset would be applied - including this rule, maintaining the 'No Container' container until a rule is matched._

Reddit: *.reddit.com, ; * , Default
_Any address matching *.reddit.com mask, would open in the 'Reddit' container. Once in the 'Reddit' container, any link clicked (* mask) would follow the default rules, so if you opened a link to reddit.com, it would stay in the Reddit container, if you opened a link to google.com, then it would go to the 'Google' container, but if you opened one to imgur.com (which has no matching rules), it would open in the 'No Container' container._

Google: *.google.com, *.google.com.* ; * , Default
_In the 'Google' container, any link not matching the entry rules (*) would use the Default ruleset, so if you opened a link to reddit.com, it would open in the 'Reddit container, but if you opened a link to imgur.com, it would not match any rules, and the first rule would apply and it would be opened in the 'No Container' container._

Google Work: ; * ,  Google Work
_This ruleset has no entry mask (note the : ; with no entry mask between them) and would never be automatically used - The user would open this container manually, in order to login to Google with a separate account for Work. Any link opened (*) would open in the 'Google Work' container, thus keeping this identity contained._
NomDeMorte commented 5 years ago

Meanwhile I have a workaround which covers some use-cases: https://addons.mozilla.org/en-GB/firefox/addon/container-outgoing-links/ This addon causes an 'exit rule' which forces all external links to open in no container (the default container). At this point, the containerise addon pulls the tab into the appropriate container.

This works so long as I do not need to have a certain container remain within that container (eg the Google Work container example given above)

sojusnik commented 5 years ago

@NomDeMorte thanks for this workaround! Still, this feature should be part of Containerise itself.

doronbehar commented 5 years ago

Hey guys, question: If this PR would have been merged, do you think it could it close #10?

ghost commented 5 years ago

The idea is nice, but imo it'd be better to add this to the UI using a dropdown-list. That would make it possible to add more options in the future e.g "random container" and make the feature immediately visible to users.

kintesh commented 5 years ago

@NomDeMorte, @lisdude Can you please checkout master and see how the recent change works. It will open any unmapped urls in firefox-default when visiting from withing a container.

NomDeMorte commented 5 years ago

@NomDeMorte, @lisdude Can you please checkout master and see how the recent change works. It will open any unmapped urls in firefox-default when visiting from withing a container.

Sorry I'm too late, for some reason I don't get any notifications on github any more :( I came here in a panic when I got automatically updated. I think there may be a bug.

When I open a link in a new tab, I get an empty tab in the origin container with the destination address in the URL bar, and then the same address is opened in another new tab in the appropriate container. I then need to close the empty, uncontainerised tab, manually.

The good news is, that opening a link from a containerised tab, which has no matching rule, does open in no container. So that's nice :)

NomDeMorte commented 5 years ago

I see you have rolled back, thanks for that.... But I hope you haven't given up on this, as it was nice to have links opening in the default container :)