recipecleaner icon indicating copy to clipboard operation
recipecleaner copied to clipboard

Recipe Manager Sidebar Proof of Concept

Open emdash opened this issue 1 year ago • 2 comments

I got a bit carried away working on the sidebar, and now it's almost done. But I wasn't very disciplined with the changes, and so it needs a pretty thorough review at the very least. But if you want to see what it would be like to have a searchable sidebar for recipes, you can try this branch.

So there's some differences here, vs master:

  • recipes are automatically saved to the local storage area upon detection
    • this really speeds up populating the database for testing
  • clicking on the page action opens the recipe in a new page
  • recipe ids are now computed as the hash of the original URL.
    • this prevents duplicate entries when the same page is visited multiple times.
    • older entries are left alone, and will still appear in the recipe manager. but they will be duplicated if you visit the page again.

Upon loading the plugin, you'll see the sidebar -- which will be empty at first. As you browse pages with detectable recipes, the sidebar will populate itself.

You can search within recipes using the filter box, choosing any subset of name, description, or ingredients to limit the search results to. You can select recipes to delete or export them. Or you can export the entire local storage area to migrate to another browser / app.

I did my best with this PR to not break compatibility with the existing local storage schema.

Another enhancement would be to use browser.storage.sync instead of browser.storage.local and then all your recipes will be automatically synchronized across devices via the browser's native data sync mechanism.

TBD: recipe import -- shouldn't be too hard to implement, but wasn't a top priority.

2023-06-25T13:58:59,679304795-07:00 2023-06-25T16:09:12,806318117-07:00

emdash avatar Jun 25 '23 23:06 emdash

This is super cool! I wanted to build something like this originally but never got around to it. Definitely on board with this change.

Any thoughts on how we could handle expiring entries automatically? AFAIK the extension will only be able to write 5MB or to browser.storage.local, and browser.storage.sync is limited even further, apparently just 100kb on firefox.

erik avatar Jul 23 '23 04:07 erik

Ahh, was unaware of those limitations! But now that you mention it, I feel like there is a permission to request "unlimited" storage. Maybe there's a way to make that optional...

5MB is still potentially a lot of recipes.

Bummer about the sync storage limit, but it makes total sense to me.

I guess you can give the user a preference option:

  • nag the user as we approach the storage limit (default)
  • evict the older recipes, and don't save
  • evict the older recipes, but save to downloads folder
  • only save the recipes you tell it to

There is also IndexedDB, as an alternative to local storage. I forget what the storage limit is for this.

So far I have about 60 bookmarks tagged as recipes. I should see how large this is.

emdash avatar Jul 23 '23 05:07 emdash