eyedeekay / I2P-in-Private-Browsing-Mode-Firefox

I2P in Private Browsing mode for Firefox, built using Webextensions and Contextual Identities
https://eyedeekay.github.io/I2P-in-Private-Browsing-Mode-Firefox/
MIT License
63 stars 10 forks source link

Option to disable in normal windows #133

Closed 5HT2 closed 1 year ago

5HT2 commented 2 years ago

I'd like to be able to leave this extension enabled in only private browsing, as when I re-enable it, it refreshes all my tabs and for some reason un-associates cookies from them temporarily? Meaning, I either have to sign back into my sites, or disable the extension and manually refresh all the tabs I had opened

Alternatively, one of these would be great:

eyedeekay commented 2 years ago

Unfortunately not, both of those phenomena are actually Mozilla-related and not me-related. It happens when you load or unload an extension that changes cookie settings. When the extension is disabled, the cookie settings are restored to whatever they were before it was installed. When it's re-enabled, stricter rules are once again applied and everything gets refreshed.

The best way to work around this that I know of is to put the extension into it's own profile and launch that profile with a wrapper script, i.e. a directory structure like this:

./i2p-profile-dir/user.js
./i2p-profile-dir/extensions/i2ppb@eyedeekay.github.io.xpi

and a launcher like:

#! /usr/bin/env sh
firefox --profile ./i2p-profile-dir --private-window $@

That will prevent the extension from being used in a regular profile and automatically launch you into a private window. BUT you'll also need to add at least:

user_pref("extensions.allowPrivateBrowsingByDefault", true);
user_pref("extensions.PrivateBrowsing.notification", false);

To the user.js to enable the extension to be loaded on the first run.

The good news is that if you want it to be, that elaboration can all be moot. I needed such a wrapper on several occasions and have 2 really excellent versions of it, one in Java and one in Go, both of which will do all of the above for you:

Both of these will isolate I2P Browsing to a single profile, thereby containing the extension and preventing the problem where disabling and re-enabling it on your main profile will log you out of web sites.

5HT2 commented 2 years ago

Okay! That solution is more than fantastic, thank you for the reply :)