multi-account-containers icon indicating copy to clipboard operation
multi-account-containers copied to clipboard

Manually add URLs to a container

Open kurahaupo opened this issue 2 years ago • 17 comments

This PR is a repeat of PR #1688 by @sherry13131, but rebased on top of today's master.

In addition I have:

  • included some small tweaks to the style tags to bring it into line with other changes made to the same block.
  • cleaned up trailing whitespace on introduced code.
  • fixed a latent bug in the verification code when adding a new URL.

The original code allowed any text containing any URL to be added, which I'm pretty sure would result in entries that would never be matched, so I added my own commit that trims any provided URL so that they are just http(s)://dom.ain (with any username, password, port, path, query string and/or anchor removed).

Because I've rebased the code, a number of merge commits in the original PR have vanished, but they were purely between internal development branches in the same repo, not part of the main PR.

kurahaupo avatar Aug 29 '21 14:08 kurahaupo

Somebody please review and merge this! PLEEEEEEEEEEEEEEEEEEASE!

robsonsobral avatar Sep 09 '21 12:09 robsonsobral

Can we get this moving again? Can I help? I have a lot of containers setup and I can't log into or use a lot of websites that do quick redirects at certain stages.

ryanseddon avatar Nov 22 '21 00:11 ryanseddon

While it'd be preferable to have a proper solution like this PR, in the mean time I've resorted to generating javascript to paste into the extension's console. I've documented the steps at https://github.com/phy1729/container-config in case that's useful for you too.

phy1729 avatar Nov 22 '21 00:11 phy1729

This is extremely helpful, thanks for sharing

ryanseddon avatar Nov 22 '21 00:11 ryanseddon

@phy1729 thank you for your hack! I use your code in this function (hope it can help others):

// open: about:devtools-toolbox?id=%40testpilot-containers&type=extension
//
// adapted from: https://github.com/phy1729/container-config
async function addUrl(container, url) {
  const identities = await browser.contextualIdentities.query({ name: container });
  if (identities.length > 1) throw new Error("too many container with the same name");
  if (identities.length == 0) throw new Error("container not found");

  const cookieStoreId = identities[0].cookieStoreId;
  const userContextId = backgroundLogic.getUserContextIdFromCookieStoreId(cookieStoreId);
  console.log("user context: ", userContextId);

  const assignManager = window.assignManager;

  await assignManager._setOrRemoveAssignment(false, url, userContextId, false);
}

To use it:

  1. open about:devtools-toolbox?id=%40testpilot-containers&type=extension
  2. paste and run the function in the console panel
  3. still in the console panel call the function with the name of the container and the url to add, for example: addUrl("search", "https://domain.to.add")

dvd0101 avatar Jan 03 '22 12:01 dvd0101

@dvd0101 Thanks for that snippet, however when I type

addUrl('Google','earth.google.com')

I get

Uncaught (in promise) `ReferenceError`: `browser` is not defined

Any idea what I need to do to make browser accessible to the dev tools console? (I'm using Firefox 95.0.2 on x86_64)

kurahaupo avatar Jan 04 '22 04:01 kurahaupo

@kurahaupo Tested right now and the "browser" symbol is visible (FF 96b10 and the mac extension up-to-date).

Are you sure you have opened the about:devtools-toolbox?id=%40testpilot-containers&type=extension url and pasted the code in the console of that page (not in the inspector console)?

dvd0101 avatar Jan 04 '22 10:01 dvd0101

@dvd0101 -

Are you sure you have opened the about:devtools-toolbox?id=%40testpilot-containers&type=extension URL

That was it, thanks.

kurahaupo avatar Jan 07 '22 10:01 kurahaupo

Please implement this feature soon - we're dying for it :-) btw the title "Always Open This Site in..." is not correct (imho) cause most ppl will assume it will always open a link/url in a specific container, which is not the case!

Because: https://outlook.live.com/owa/[email protected] is different compared to https://outlook.live.com/owa/[email protected]

wolfferine avatar Jan 13 '22 15:01 wolfferine

LGTM

swiffer avatar Jan 16 '23 20:01 swiffer

@mozilla @ctbmozilla-admin @dannycolin PLEASE slap anyone needed to get this merged already, what's holding this off for so many years?

TriMoon avatar Nov 13 '23 10:11 TriMoon

@mozilla @ctbmozilla-admin @dannycolin PLEASE slap anyone needed to get this merged already, what's holding this off for so many years?

Yes, for the love of god, merge this so containers is a useful extension for modern web sites!

9000cats avatar Nov 13 '23 18:11 9000cats

Rebased to current main again. (It was a clean rebase; there were no conflicting changes.)

kurahaupo avatar Nov 15 '23 02:11 kurahaupo

PLEASE slap anyone needed to get this merged already, what's holding this off for so many years?

@TriMoon It won't get things to move faster. I'm pretty much the only person who contributed to anything containers lately. However, I'm not a paid staff and lack the free time to do a good review at the moment.

I can't promise anything but my University semester ends in ~1 month. Hopefully, I'll have time to look at it more closely.

dannycolin avatar Nov 17 '23 03:11 dannycolin

@dannycolin i understand but the rest of us are unable to merge even if we would create PR's, so it's up to the ones with permissions to do it...

TriMoon avatar Nov 17 '23 06:11 TriMoon

I can't promise anything but my University semester ends in ~1 month. Hopefully, I'll have time to look at it more closely.

Hope you had a good holiday! I know you didn't promise anything, but I'm curious if this is still on your to-do list. Totally understandable if you have more pressing things to address, but I wanted to let you guys know there's still those of us who would love this feature! Thank you for your contributions, regardless of if you're able to do this or not. Your voluntary contributions have helped many

Bazoogle avatar Jan 04 '24 04:01 Bazoogle

Website redirects are causing me a lot of problems (live.com, outlook.com, microsoft.com, etc). Being able to manually add websites/URL's to the container site list would presumably solve the problem of redirects going in and out of containers.

Snake883 avatar Jan 24 '24 22:01 Snake883