Rob--W / cookie-manager

Cookie Manager for Firefox (Desktop/Android), Chrome. Supports viewing and editing of cookies and private cookies.
Mozilla Public License 2.0
105 stars 24 forks source link

preserving cookies #3

Open rbro opened 6 years ago

rbro commented 6 years ago

Thanks for a nice extension. Prior to Firefox 57, I used an extension called biscuit that supported preserving certain cookies, so when you cleared your browser history, you could delete all your cookies except certain ones that you flagged - https://addons.mozilla.org/en-US/firefox/addon/biscuit-220876. I don't know what's involved in supporting that or even if it's possible with the WebExtensions API, but I just wanted to see if it was possible to add into Cookie Manager? Thanks for your help.

Rob--W commented 6 years ago

I added a new feature to 1.4 called "whitelist". It can support your workflow as follows:

First, you need to add all cookies that you want to preserve to the whitelist in the Cookie Manager.

Then, when you want to clean cookies:

  1. Open the Cookie Manager
  2. Change the filter "whitelist = any" to "whitelist = no"
  3. Click the search button
  4. Click select all.
  5. Click on "Remove selected" and confirm.

If you forget step 2, then the whitelisted cookies appear in the search result. But the cookie manager will refuse to delete the whiteisted cookies (and show a prompt where you can unlock the ability to modify whitelisted cookies if you wish).

Please give it a try and let me know whether this solves your use case.

(the update also includes an import/export feature, you can also use that to create a backup of your cookies before experimentation.)

rbro commented 6 years ago

This is great, thanks so much for implementing it. One question - and this may not be possible due to how WebExtensions work - but using that biscuit extension I mentioned above, I was able to go to History - Clear Recent History, and even though I deleted all my cookies, biscuit was able to capture that event and either not delete the whitelisted cookies, or perhaps it let Firefox delete them and then restored them after (I'm not sure which). Do you know of any way to hook into that event in Firefox?

Rob--W commented 6 years ago

There is the cookies.onChanged event, but I have never used it (and don't know if it is reliable / bug-free): https://developer.mozilla.org/en-US/Add-ons/WebExtensions/API/cookies/onChanged

I am willing to introduce an optional feature to automatically restore deleted cookies. I just need to be careful to not end in an infinite loop when managing cookies through the cookie manager. What is your expectation about expired cookies? What about an edited cookie (e.g. a different value)? When do you want to automatically restore a cookie?

rbro commented 6 years ago

Thanks, that's interesting they have a cookies.onChanged event, so maybe it could work.

I'm thinking that expired cookies should not be restored even if they are marked to be whitelisted. Edited cookies should keep their current value when restored. For when to automatically restore a cookie, I was thinking either prevent the browser from deleting a whitelisted cookie, or if that's not possible, then automatically restore the whitelisted cookie right after it's been deleted when you go to History - Clear Recent History.

Grossdm commented 6 years ago

@Rob--W, This would be a great feature if it could be implemented. Actually, reading this thread/issue made me think of a few different features that would be awesome, but perhaps they would have to be long-term goals for the project.

Have you had any success trying to achieve what you and @rbro have discussed here?

Thanks,

Doug®

Rob--W commented 6 years ago

@Grossdm I haven't worked on the cookie manager lately. The UI is still not as good as I'd like.

Grossdm commented 6 years ago

@Rob--W, I understand limited time for everything in your life. Take care of yourself, and perhaps put this at least somewhere on the to-do list.

Thanks, Doug®