simple-tab-groups icon indicating copy to clipboard operation
simple-tab-groups copied to clipboard

Add Firefox and Cloud Sync (GitHub Gist) support

Open alessiosacco opened this issue 6 years ago • 62 comments

The automatic backup of the tab groups is a very useful feature, but currently it is only usable in a single PC configuration, due to the fact that the backups are saved in the Downloads folder. Would it be possible to add the same functionality using Firefox Sync?

alessiosacco avatar Nov 17 '18 13:11 alessiosacco

I was wondering whether it would be possible to synchronise tab groups using Firefox Sync, too. My idea was to sync them as bookmarks (loosing history, but that is OK for me), potentially storing the group names in tags (allows having the same tab belong to multiple groups) or using bookmark folders (allowing just one group per tab, if that is more desirable from a design / implementation perspective).

devurandom avatar Dec 16 '18 12:12 devurandom

+1 Alternatively, if someone would figure out if/how we can sync hiddent tabs, that might solve this issue. But native support by the extension would be ace, I use sync a lot - opening work content at home, and vice versa.

ghost avatar Dec 17 '18 12:12 ghost

Hi all, I have been trying to implement this for a long time, but there is a restriction: https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/storage/sync

You can store up to 100KB of data using this API. If you try to store more than this, the call will fail with an error message.

If you have a lot of tabs, the data size will be more than 100KB. And then the problem, the solution of which adds only more problems ...

Drive4ik avatar Jan 04 '19 18:01 Drive4ik

Is there any way to make us see the total of all tabs in Firefox sync? Because when I move tabs to groups, on my other device I only see tabs which are in the open group, tabs from other groups are not shown and hence inaccessible.

As a use case, I use groups at work to group my work-related tabs into logical parts. When I get home and want to come back to some of my work tabs, I only see the active group tabs in my synced tabs, and other tabs are only accessible from my work device.

ghost avatar Jan 09 '19 13:01 ghost

I understand that synchronizing all tabs seems difficult, but it would be nice if at least we can synchronize groups and settings

Xima avatar Jan 11 '19 16:01 Xima

The solution is to allow backup of groups to bookmarks as in #328, that way you have 100KB data in firefox sync to store configuration.

GonzRon avatar Feb 21 '19 01:02 GonzRon

Hi all! I added option to export groups to bookmarks, you can sync groups/bookmarks this way https://github.com/Drive4ik/simple-tab-groups/issues/328#issuecomment-466117650

Drive4ik avatar Feb 25 '19 11:02 Drive4ik

Sorry, maybe I'm dumb, but I don't understand how I should use the new bookmark export to resolve syncing use cases. Can I set it up so that all my groups are periodically automatically bookmarked? Or can I only do it manually for each group?

ghost avatar Feb 28 '19 11:02 ghost

@hluposti you're quite right in that, this is not an automatic process.

Can I set it up so that all my groups are periodically automatically bookmarked?

Not currently, but maybe the author is working on some magic here :)

Or can I only do it manually for each group?

Currently this is the case.

The current implementation in #328 is not fully automatic. It can backup automatically, but not restore automatically. So it's not really a sync though it can kind of be used that way in a manual process. To implement sync functionality using #328, the author would need to use the functionality implemented in #328 a little bit differently.

One potential design approach would be to create a "SimpleTabGroupsSync" BookMark Folder, which STG would then automatically write all current STG Window groups. Second he would need to read this group if it exists on startup to make sure that the sync'ed bookmarks and the the current STG window groups match. To do this requires solving several hard computer science problems, something similar to a "cache invalidation" problem. He would have to keep a hash of every item in each STG window group to make sure existing items are updated and only new items are created, and vice versa. Or he can just start from scratch each time. It gets into the weeds quickly to try to implement this. He could potentially calculate a hash on the STGSync Bookmarks folder, or perhaps access a last sync'ed timestamp to know when he needs to update groups in STG from newly sync'ed bookmarks. The point is that this new implementation would require a private "STGSync BookMark Folder" which wouldn't be meant for any manual user interaction, which is how the current sync feature in #328 is implemented.

In other words, the facility to backup window groups using firefox sync has been accomplished via bookmarks (which works around firefox sync data size limitations), ~but that currently is a manual process, i.e. one that allows you to backup existing window groups individually.~

GonzRon avatar Feb 28 '19 11:02 GonzRon

Didn't I already do it? screenshot_1 screenshot_2

Drive4ik avatar Feb 28 '19 11:02 Drive4ik

Ah yes I didn't see that one! But how to import automatically from backup to new browser?

GonzRon avatar Feb 28 '19 12:02 GonzRon

@GonzRon default

Drive4ik avatar Feb 28 '19 12:02 Drive4ik

Yes of course, I see that one. But I think this feature request is asking for automatic import from bookmark folders to groups. In other works automatic synchronization of window groups between browsers by using Firefox bookmarks to transfer the data.

Computer 1 --> Browser 1 --> STG Window Groups >>>> Automatic STG BookMarks Folder Backup Computer 1 --> Browser 2 --> STG Window Groups <<<< Automatic STG BookMarks Folder Import

GonzRon avatar Feb 28 '19 12:02 GonzRon

Automatic import is not yet possible due to technical reasons of the browser.

Drive4ik avatar Feb 28 '19 12:02 Drive4ik

What about a one click loading of some specific backup file from the drop down menu?

The steps could be:

  • machine A: automatically create a backup named "machineA" (for instance) every hour (it already does that) in a shared folder (Dropbox, Syncthing or whatever the user has setup)
  • machine B: click the simple tab groups toolbar icon and hit the load icon in that menu (next to the "create new group" or something like that) and automatically import the new session from file (something that this extension already does)
  • machine B: automatically create a backup named "machineB" (for instance) every hour, allowing the same thing to be done on machine A when getting back to it

jbmorgado avatar Mar 12 '19 17:03 jbmorgado

Automatically save the file is only possible in the download folder. And adding it to Dropbox is unlikely.

Drive4ik avatar Mar 12 '19 17:03 Drive4ik

Any savvy user could do a symlink or a small script to copy that automatically to Dropbox/Syncthing/etc

jbmorgado avatar Mar 12 '19 18:03 jbmorgado

I have a question about the backup to bookmark folder - it seems that when i close tabs from a tab group, they still remain in the backup and accumulate (i believe with a separator in between them). This might be the intended behavior for backups, but I tend to use this as a "sync" feature between browsers on different PCs. Therefore, it would be nice to have the option that the tabs are saved to the bookmarks "as is" - thereby replacing all the bookmarks in the previous backup. In other words, when i close a tab in the tab group, it will no longer appear in the backup, and this feature would operate as a true sync between browsers.

Is this possible as an option?

lx0n2acl avatar Nov 21 '19 16:11 lx0n2acl

@lx0n2acl Yes, I thought to make this functionality customizable, but for some reason I didn’t)) in the near future I will make an option in the settings for the controllability of this behavior (bookmarks without tabs that are closed)

Drive4ik avatar Jan 22 '20 12:01 Drive4ik

Automatic import is not yet possible due to technical reasons of the browser.

Hi Drive4ik, sorry if I reopen this old discussion. I wonder if this could be of help, to create an auto sync from bookmarks functionality: https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/bookmarks From what I see there, it looks like it can be done. Am I missing something else? Thanks.

JackSlaterIV avatar Mar 23 '20 09:03 JackSlaterIV

I have been using Workona now. They just - finally - launched their plugin to Firefox. Works great so far, allows you to create groups much in the same manner as STG and automatically syncs across all your machines.

I had some sync problems with it on Chrome, but now on Firefox they are gone.

jbmorgado avatar Mar 23 '20 09:03 jbmorgado

Hi @JackSlaterIV Nothing to worry about

Bookmark sync already implemented enable bookmark permission изображение

and then you can change auto backup folder name изображение

manually create backup of all groups изображение

or any group of your choice изображение

изображение

Then bookmarks will be synchronized between devices (if bookmark synchronization is enabled in the settings in the browser)

Drive4ik avatar Mar 23 '20 10:03 Drive4ik

@Drive4ik Thanks, but it does not automatically import from the bookmark folder, after the browser starts up. Can you add this automatic import? In one message above, you wrote that there was a technical issue in FF which blocked you from implementing this automatic import. Can you tell me more about it?

JackSlaterIV avatar Mar 23 '20 13:03 JackSlaterIV

@JackSlaterIV Bookmarks do not have attachment to FF containers, and are unlikely to have it. Therefore, you cannot restore the bookmark in the desired container. Some users have 3000+ tabs, you can imagine how much synchronization will take. Also, one of the main problems - the addon cannot know when FF has finished its synchronization (bookmarks, settings, passwords, etc. that you have chosen in the browser settings) and this can take a lot of time (5+ min) and it is difficult for the addon to understand when to start synchronization, and this is very important, because you need to have the most recent "snapshot" of data, but bookmarks do not have this ... When the FF increases the capacity https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/storage/sync at least to 10 MB, then I will start to think how to implement this. It’s just what immediately comes to mind, there are more minor problems. But so far this is not feasible.

Drive4ik avatar Mar 23 '20 14:03 Drive4ik

@JackSlaterIV Bookmarks do not have attachment to FF containers, and are unlikely to have it. Therefore, you cannot restore the bookmark in the desired container. Some users have 3000+ tabs, you can imagine how much synchronization will take. Also, one of the main problems - the addon cannot know when FF has finished its synchronization (bookmarks, settings, passwords, etc. that you have chosen in the browser settings) and this can take a lot of time (5+ min) and it is difficult for the addon to understand when to start synchronization, and this is very important, because you need to have the most recent "snapshot" of data, but bookmarks do not have this ... When the FF increases the capacity https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/storage/sync at least to 10 MB, then I will start to think how to implement this. It’s just what immediately comes to mind, there are more minor problems. But so far this is not feasible.

Hello @Drive4ik Thanks for the extension. Firefox will never have, and shouldn't have MB sync limits for the reasons you mentioned in terms of sync start-complete delays.

I do have a solution suggestion. A majority of the users are not having 3000+ tabs, and those who do should really look into using bookmarks, for the rest (and the majority of us) the following would work.

Apply simple lookup of current tab numbers and use firefox sync if they are under a safe margin (let's say 500). If they are above the safe margin, show a little alert on the top of the simple tab group window that says "Tabs Exceed Firefox Sync limits".

The sync issue is whats keeping me from adopting the plugin fully as others offer syncing. The groups really are most useful as a medium term management solution that is ideal for a desk to laptop workflow.

Let me know if I can help with UX suggestions, I am mostly a designer.

whatsnewsisyphus avatar Sep 24 '20 15:09 whatsnewsisyphus

I'm also interested in this feature and I'd be willing to help implement it.

I currently have about 300 tabs in 21 groups and the latest save file in my downloads folder has 92.3kB. If I read the documentation correctly, an extension can save up to 100kB of data to Firefox Sync. That's obviously not sufficient if the data is stored in plain JSON, but I think it could be made to work: Compressing the file with gzip --best results in a file that's just 19.5kB. With brotli it's only 16.5kB. I don't think storage.sync can store binary data, so the data would have to be encoded somehow. Using base64 it's still only 26kB with gzip and 22kB with brotli. Assuming the number of tabs per kB can be extrapolated linearly, it'd be possible to store 1360 tabs with brotli + base64 in Firefox Sync.

Now, that might still not be enough for some people, but I feel it's not the majority and the extension could show an error in this case. Maybe an option to disable or only enable sync for some tab groups might be a possibility too.

Another option might be to think up some kind of binary format that's less verbose than JSON, although I'm not sure if that has a significant advantage over the compression approach while at the same time making debugging and adding new features a lot harder.

What do you think @Drive4ik ?

maxkl avatar Oct 17 '20 10:10 maxkl

@maxkl there’s custom JSON encoders that can reduce the size dramatically (can’t remember the names right now)

FlorianWendelborn avatar Oct 17 '20 12:10 FlorianWendelborn

@maxkl this is one of the ones I was thinking about: https://github.com/KilledByAPixel/JSONCrush although it’s URI-optimized, so maybe not the best match.

FlorianWendelborn avatar Oct 17 '20 12:10 FlorianWendelborn

Now, that might still not be enough for some people, but I feel it's not the majority and the extension could show an error in this case.

uBlock Origin for example shows the amount of sync data used in relation to the totally available space using a simple bar below the cloud buttons in the settings UI (sorry it's in German):

Bildschirmfoto von 2020-10-17 15-04-11

(The light grey bar is the total space; the dark grey bar is the used space; the purple bar is the space used by my rules as a part of all synced settings.)

If FF sync support gets implemented for STG, it would be cool to indicate the fraction used of the total available space (100KiB) in the UI. So the user could reduce the number of open tabs some time ahead of running into the hard storage limit which would probably help reduce frustration when hitting the limit.

salim-b avatar Oct 17 '20 13:10 salim-b

@maxkl this is one of the ones I was thinking about: https://github.com/KilledByAPixel/JSONCrush although it’s URI-optimized, so maybe not the best match.

That's a nice find! I just tried it on my 90kB file, and the result is still 51kB big, probably because of the URI encoding. But another, similar content-aware compression algorithm might work nicely. I'll try to look into that some more...

Edit: I forgot to add that compressing the JSONCrushed file with brotli results in 18kB, so it's still bigger than just brotli without the intermediate step

maxkl avatar Oct 17 '20 15:10 maxkl