httpswitchboard icon indicating copy to clipboard operation
httpswitchboard copied to clipboard

[Feature] Sync Chrome settings

Open PxlBuzzard opened this issue 10 years ago • 14 comments

I would love to have my settings follow me across different machines. Chrome has some documentation on how to do this.

PxlBuzzard avatar May 21 '14 17:05 PxlBuzzard

This has been asked before in #201: unfortunately the cloud storage is rather small (along with other limitations), and although an installation HTTP Switchboard without too much customization would work, the allocated cloud space would quickly become insufficient with more customization (for instance, mine wouldn't fit). Having a feature that works in some cases and not in other cases is not an option -- it would turn into a nightmare for users (and me).

The only thing close to a workaround is to use the save all/restore all feature in the About tab, and saving to/restoring from your own cloud space (even better if encrypted)/

gorhill avatar May 21 '14 17:05 gorhill

I'm using the personal cloud implementation right now and it works, but it could be better. If Chrome syncing won't work, what about a setting that pings a URL at an interval and runs a restore all with the result? You could even sync that URL across browsers so that the same effect as the OP is achieved.

PxlBuzzard avatar May 21 '14 17:05 PxlBuzzard

Are the settings files stored in a specific location by the extension, and if so, is there a way to tell the extension to reload them? I'd be happy to do some symlinkmagic so the settings would live in dropbox and be picked up by multiple computers

akerl avatar May 23 '14 12:05 akerl

Are the settings files stored in a specific location by the extension

The extension relies on chrome.storage.local and the File API, and these are sandboxed storages, can't be seen by the outside world.

gorhill avatar May 23 '14 12:05 gorhill

The most crippling limit in chrome.storage.sync is QUOTA_BYTES_PER_ITEM, set at 4196 bytes. This limit would be hit quite fast in HTTPSB.

I guess at this point the URL idea is what would work, but I am not fan of loading all the settings automatically (and trashing the current ones) without user intervention.

gorhill avatar May 23 '14 12:05 gorhill

For what it's worth, it appears to store the content in LevelDB files located here:

~/Library/Application Support/Google/Chrome/Default/Local Extension Settings/{extension-id}/

I can grab the extension ID with the following:

grep HTTPSB ~/Library/Application\ Support/Google/Chrome/Default/Extensions/*/*/manifest.json | sed 's|.*/Extensions/\([a-z]*\)/.*|\1|'

akerl avatar May 23 '14 13:05 akerl

Some sync automation would be great. Hope it can be achieved!

ohrly avatar May 24 '14 14:05 ohrly

it's too bad they didn't use a single huge storage like the local. I guess they did this to reduce the size of the stuff to sync.

As for the 4k limit per item, you could store each scoped rules in an item, limited to 512 items. If an item is too big or you reach the limit, just add a little icon next to the rule, but keep using the local storage, just you the sync storage to "sync".

edit: I may have some time this week-end, I could try to make it work in a fork and send a pull request if it does...

srouquette avatar May 28 '14 11:05 srouquette

Well, ultimately if I want to address it this way I would go the simpler path of just streaming the whole save data and chunkifying it into suitably-sized chunks. But as usual, more code, more works, more feature requests as a result of more feature added, more bugs as a result of more code, etc. Little time.

gorhill avatar May 28 '14 13:05 gorhill

not sure if streaming it would be easier, since you'd have to update everything if only one item changes, and you can only update 10 items per minute...

srouquette avatar May 28 '14 13:05 srouquette

Well this can be addressed still by quantizing block size in which each scopes are saved to leave space for changes. Point is there is more than the scoped rules which suffer from sync limitations. Someone can easily enter thousands of custom rules in the ubiquitous text area. User agents strings, etc.

gorhill avatar May 28 '14 13:05 gorhill

I've never written a chrome extension so I don't know the extent of things they can access. Could you allow linking a dropbox/google drive/etc account for storage of these settings?

RobotCaleb avatar Jun 30 '14 17:06 RobotCaleb

This could be implemented using a replication event log like databases use. See MySQL binary log for an example.

The extension already has temporary/unsaved/uncommitted changes. Once they are committed, store them in chrome.sync in a single giant indexed queue, like a changelog. On every client, keep a counter of events it has seen and if the queue overflows and a client misses a counter, simply request the user to export/import anew, this would only happen if the user did not use a client in a while, so not often.

denis-sokolov avatar Jul 04 '14 10:07 denis-sokolov

I think automatic import-export to a user defined path would suffice. One big file could cause a lot of conflicts but a separate file for each scope could work pretty well. The synchronization of this directory is up to everyone's favorite tool.

ghost avatar Oct 20 '14 03:10 ghost