Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Firefox and Cloud Sync (GitHub Gist) support #291

Open
alessiosacco opened this issue Nov 17, 2018 · 58 comments
Open

Add Firefox and Cloud Sync (GitHub Gist) support #291

alessiosacco opened this issue Nov 17, 2018 · 58 comments

Comments

@alessiosacco
Copy link

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?

@devurandom
Copy link

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).

@ghost
Copy link

ghost commented Dec 17, 2018

+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.

@Drive4ik
Copy link
Owner

Drive4ik commented Jan 4, 2019

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 ...

@ghost
Copy link

ghost commented Jan 9, 2019

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.

@Xima
Copy link

Xima commented Jan 11, 2019

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

@GonzRon
Copy link

GonzRon commented Feb 21, 2019

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.

@Drive4ik
Copy link
Owner

Hi all! I added option to export groups to bookmarks, you can sync groups/bookmarks this way
#328 (comment)

@ghost
Copy link

ghost commented Feb 28, 2019

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?

@GonzRon
Copy link

GonzRon commented Feb 28, 2019

@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.

@Drive4ik
Copy link
Owner

Didn't I already do it?
screenshot_1
screenshot_2

@GonzRon
Copy link

GonzRon commented Feb 28, 2019

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

@Drive4ik
Copy link
Owner

@GonzRon
default

@GonzRon
Copy link

GonzRon commented Feb 28, 2019

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

@Drive4ik
Copy link
Owner

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

@jbmorgado
Copy link

jbmorgado commented Mar 12, 2019

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

@Drive4ik
Copy link
Owner

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

@jbmorgado
Copy link

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

@lx0n2acl
Copy link

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?

@Drive4ik
Copy link
Owner

@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)

@JackSlaterIV
Copy link

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.

@jbmorgado
Copy link

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.

@Drive4ik
Copy link
Owner

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)

@JackSlaterIV
Copy link

@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?

@Drive4ik
Copy link
Owner

@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.

@whatsnewsisyphus
Copy link

whatsnewsisyphus commented Sep 24, 2020

@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.

This was referenced Oct 7, 2020
@julie777
Copy link

I added #911 use bookmarks to store groups instead of localstorage. This would automatically add sync support.

@ttonin33
Copy link

For the beginning an automatic syncronisation with a file would be possible.
So automatic export to the backup file and when starting Firefox simply import it again. Then you could at least with Drive or Syncthing get this automatically on the other PC.

@mihalt
Copy link

mihalt commented Dec 7, 2022

Yeah, feature of automatical synchronization (import and export both) is so demanded... It would be nice to see tab closed if it was closed on this group of tabs on another PC. Are any news how to realize it? Or any plans when it will be ready?

This was referenced Apr 22, 2023
@Drive4ik
Copy link
Owner

I'm working on this task now.

@Drive4ik Drive4ik reopened this Apr 22, 2023
@Drive4ik Drive4ik changed the title Add Firefox Sync support Add Firefox and Cloud Sync (GitHub Gist) support Apr 22, 2023
Drive4ik pushed a commit that referenced this issue Apr 25, 2023
@Shirkit
Copy link

Shirkit commented Jun 13, 2023

Hi @Drive4ik I see you're using Github Gists to implement the sync feature, an alternative solution to the problem indeed.

  1. Another alternative solution would be to remove favicons from the cloud sync all together, compress and split the file into chunks of 8KB to be stored by Mozilla Sync. I don't know if you considered this way or even if it's a good idea, but it's an idea I had, and it indeed does not sound like a good one as the information is not obfuscated and harder to be dealt with.

  2. But by just by removing the favicons from the cloud sync, my estimate is that the average user would be able to store anything from 200-1000 tabs, which should (?) be enough for most people. And you could always show for users who has sync enabled a progress bar to show how much data it's being used on the cloud sync.

  3. Also, by making the default values not to be sync into the cloud (like most bool values, empty arrays, null values) you could save around 100-400 bytes per tab group. Other thing to minimize usage would be to shorten those key values for the tab groups options.

With all that, my estimate is that the average user can use the Sync without any major impacts.

Anyways, this is the best extension out there for tab management! I hope you continue to work on it. If you think my suggestions combined are a good way to do the Mozilla Sync I can try to submit a PR for it.

1 seems bad, but 2+3 seems simpler and would solve the problem.

@nlupus
Copy link

nlupus commented Jul 5, 2023

Just discovered the addon and wow, I've been missing out! Integration with containers is amazing!
Set it up on two pcs and for some reason thought it would sync everything automagically, but alas. Glad to see the project is active and you are working on this issue 🥳 I would even pay for total sync, something that Speed Dial 2 does very well https://addons.mozilla.org/en-US/firefox/addon/new-tab-speed-dial/. Thanks for the amazing way to deal with tabs in firefox!

@Quintasan
Copy link

@Shirkit I don't think you can split it into 8KB chunks since it's a key-value storage. Here's my proposal

Storage quotas

We can have 512 items in the store. Each item can have 8192 bytes and the total storage is 102400 bytes.

Proposal

My idea goes as follows:

  1. Extension preferences go to preferences key and we store only values that are different from the defaults. This leaves us with 511 items in the store and (102400 - size of preferences) of total storage.
  2. Each group is stored as a separate key, this gives us the ability to store up to 511 groups (or less, depending on the total space left)
  3. Value for each group key should have the following structure:
{
        "id": "integer",
        "iconColor": "string",
        "iconUrl": "string",
        "iconViewType": "string",
        "tabs": [
                {
                        "id": "integer",
                        "url": "string",
                        "cookieStoreId": "string (optional)",
                }
        ]
}

I stripped the title attribute since IMO it's not really useful during sync (your newly synced device will have to reload the tab anyway) and it contributes 2.6K in my dump:

quintasan@demonbane:~$ ls -alh
-rwxr-xr-x 1 quintasan quintasan  11K Aug  1 21:57 manual-stg-backup-2023-08-01@drive4ik.json
-rwxr-xr-x 1 quintasan quintasan 8.4K Aug  1 22:12 manual-stg-backup-2023-08-01@drive4ik.json.title_stripped

I removed all the extension preferences, title keys, and removed all the whitespace so my 24 tab group dump is 2.7K

quintasan@demonbane:~$ ls -alh group_payload_minimized.json.compressed
-rw-r--r-- 1 quintasan quintasan 2.7K Aug  1 22:20 group_payload_minimized.json.compressed

By compressed I mean I used jq -c . < input.json to remove whitespace.

I believe that cookieStoreId is a name of Container in which the cookies are kept so we must retain this key. I am not sure if openerTabId is mandatory to keep.

Downsides

Calculating the total storage is going to require N+1 calls to https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/storage/StorageArea/getBytesInUse where N is the number of groups and the +1 comes from the preferences key.

Alternatively we could store everything under one key in which case we would be complicating the logic to update the tabs in groups. I belive that N+1 calls for storage calculation is the lesser problem.

What do you think @Drive4ik ?

@Shirkit
Copy link

Shirkit commented Aug 14, 2023

@Quintasan your proposal makes more sense and it's simpler than mine in some regards. I did not want to change much the config file, so your idea is just better than mine in that regard.

And one can adapt your solution to split into 2 or more items if a group exceeds the 8KB, which can be stored the values for it on the preferences item if such thing is really needed (I have one group with 60 tabs that reaches just over 7KB with your proposed solution without the cookieStoreId as I do not have it on my config file

Drive4ik pushed a commit that referenced this issue Aug 26, 2023
@karypid
Copy link

karypid commented Sep 3, 2023

I'm sorry to take this thread a bit of track, but has the UI described in the comment above changed?

comment with UI above

I've enabled "Allow access to bookmarks" (and replied "Allow" to the Firefox popup asking whether to allow access). I've selected "Other Bookmarks" as the folder, but I do not see anything being created there...

There is no "Export groups to STG bookmakrs folder" checkbox underneath those settings...

This is what my settings look like:

image

@ekasprzak
Copy link

@karypid it should be available when you right click on the extension (STG) icon.

@karypid
Copy link

karypid commented Sep 6, 2023

@karypid it should be available when you right click on the extension (STG) icon.

I have a few questions about this feature:

  1. How will you pick which data to use when the feature becomes available? Currently my desktop/laptop have slightly different tab groups as they do not get synced automatically. If I turn on the cloud sync, would one overwrite the other? How would you "control" which one should "win"? For example, if I want to keep the setup of my laptop and discard the one from my desktop, how would one go about turning that on?

  2. Would you be able to set the location where tabs are saved in cloud? Like some key name if firefox sync storage is used, or some folder name if gist/gdrive is used? This way if you use multiple profiles via firefox - ProfileManager you can configure a different location for each profile. In the bookmarks case you seem to be limited unable to 3 locations (Bookmarks Toolbar, Bookmarks Meni, and Other Bookmarks):

image

The way (1) is related to (2) is that I chose "Other bookmarks" in both my laptop and my desktop and I've ended up with two entries (one from each machine):

image

I am not sure how to get STG to restore the state saved in the bookmarks. Is this the second option that reads "Reopen tabs with temporary containers in new"?:

image

@brian163
Copy link

brian163 commented Mar 18, 2024

I feel like I've read this thread about 500 times. As @karypid noted, I enabled access to bookmarks and set the default bookmark location to "Other Bookmarks". After enabling backups (once a minute to test) and checking the Other Bookmarks folder, I now have multiple "Simple Tab Groups" folders for each computer. Is this the intended behavior? Because that doesn't really provide a way to keep the groups in sync. And I just can't tell if that is the shortcoming this thread keeps referring to at different stages of the implementation over time or if it just isn't working properly? (What I thought would happen is that there was one "Simple Tabs Groups" folder in Other Bookmarks and each browser would simply use the same folder.

Can someone please clarify? And if this is the shortcoming, do you simply keep "re-importing" your groups into new groups and manually deleting the previous ones? It will also get progressively challenging to keep track of what folder is from which computer with them all named the same. Which is why I have the feeling this isn't actually working as intended.

Signed,
Confused. (brian) :-)

@vvirtues
Copy link

vvirtues commented Mar 21, 2024

I feel like I've read this thread about 500 times. As @karypid noted, I enabled access to bookmarks and set the default bookmark location to "Other Bookmarks". After enabling backups (once a minute to test) and checking the Other Bookmarks folder, I now have multiple "Simple Tab Groups" folders for each computer. Is this the intended behavior? Because that doesn't really provide a way to keep the groups in sync. And I just can't tell if that is the shortcoming this thread keeps referring to at different stages of the implementation over time or if it just isn't working properly? (What I thought would happen is that there was one "Simple Tabs Groups" folder in Other Bookmarks and each browser would simply use the same folder.

Can someone please clarify? And if this is the shortcoming, do you simply keep "re-importing" your groups into new groups and manually deleting the previous ones? It will also get progressively challenging to keep track of what folder is from which computer with them all named the same. Which is why I have the feeling this isn't actually working as intended.

Signed, Confused. (brian) :-)

#291 (comment)
All we can do is wait (or contribute/donate). Yes, that behaviour is intended (well, not really) but the developer is doing their best to create an alternative sync solution that will be more usable

@vvirtues
Copy link

Actually, I'm not sure if the developer is active right now. The previous commits are showing a "ghost author" (maybe just me) but seems like there's a problem with the account

@brian163
Copy link

#291 (comment) All we can do is wait (or contribute/donate). Yes, that behaviour is intended (well, not really) but the developer is doing their best to create an alternative sync solution that will be more usable

Thanks for the confirmation. Sadly, I'm stumbling across too may great add-on projects that seem to be dying a slow death.

@Shirkit
Copy link

Shirkit commented Mar 23, 2024

#291 (comment) All we can do is wait (or contribute/donate). Yes, that behaviour is intended (well, not really) but the developer is doing their best to create an alternative sync solution that will be more usable

Thanks for the confirmation. Sadly, I'm stumbling across too may great add-on projects that seem to be dying a slow death.

Yeah, it's not trivial to keep projects alive for long periods of time. This project seems to be maybe on the stage of security fixes only, we'll see on next big Firefox update with breaking changes if it will vanish.

Drive4ik pushed a commit that referenced this issue Mar 24, 2024
@Drive4ik
Copy link
Owner

Unfortunately, I'm going to have to switch to a more important task - migrating to manifest v3.
I know that this task is very important, but I didn't have time to work on the addon.
I'm still in Ukraine and we still have rocket attacks every 2-3 days. (https://alerts.in.ua/en) I was a bit busy with other things. Now I will try to migrate the addon to manifest v3, otherwise the addon will stop working at all in the summer. Please understand. Thank you.

@Shirkit
Copy link

Shirkit commented Mar 24, 2024

Unfortunately, I'm going to have to switch to a more important task - migrating to manifest v3. I know that this task is very important, but I didn't have time to work on the addon. I'm still in Ukraine and we still have rocket attacks every 2-3 days. (https://alerts.in.ua/en) I was a bit busy with other things. Now I will try to migrate the addon to manifest v3, otherwise the addon will stop working at all in the summer. Please understand. Thank you.

I never wanted to criticize anything, as I've learned that people have their lives, and we can clearly see (since you live in Ukraine) that it's well understood why the work on the addon has halted.

The incredible only part here is you wanting to resume the work. At least now we know that, at least if this issue or other things in this addon does not get implemented, you'll at least try to keep it functional.

Thank you for using your time working in this great addon. Sync is the only thing missing for me to optimize my workflow.

@Drive4ik
Copy link
Owner

I totally missed it:
https://blog.mozilla.org/addons/2024/03/13/manifest-v3-manifest-v2-march-2024-update/

That's very good news.
Probably will continue to work on the current task.

@brian163
Copy link

@Drive4ik Very sorry you have to deal with that every day. I actually took note that your profile mentioned Ukraine and wondered to myself if that was a factor. But I appreciate you taking the time to respond and for any work you are able to continue on this great add-on. The sync issue was a bit of a show stopper for my personal needs at the moment but I'm more than interested in re-evaluating if it comes about at some point.

Thanks again for your contributions to improving the Firefox user experience!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests