我的情况是这样的:我已经编写了一些Chrome用户脚本供我个人使用。以前,我只有一台机器上有一个Chrome示例,所以我非常乐意将任何持久数据转储到localStorage中。
然而,我现在有多台机器,我想在所有机器上使用Chrome上的用户脚本,我的持久数据也沿着而来。同步用户脚本代码本身很简单,虽然有点繁琐(把它放在Bitbucket repo中,然后拉取并手动安装),但我不知道如何在机器之间同步我的localStorage数据。
我曾考虑过将我的用户脚本转换成合适的Chrome扩展并使用chrome.storage API(如果你有一个Google账户连接到你的Chrome示例,使用chrome.storage.sync存储的数据显然可以同步,我就是这样做的)。
- 为了同步您的数据,您似乎必须将您的扩展发布到Chrome商店。
- 我不希望我的扩展在Chrome商店公开可见,因为1)这要花钱;以及2)一些扩展本质上是“敏感的”。
- 即使我花钱解决了(1.),我发现在Chrome商店上放置私人扩展的唯一方法是使用Google Apps for Work或Education(参见"Publish a private Chrome app"),而我显然没有Google Apps的个人示例。
那么:有没有什么方法可以让我1.)直接在机器之间同步localStorage,或者2.)在没有公开发布的Chrome扩展的情况下使用chrome.storage.sync API?
2条答案
按热度按时间weylhg0b1#
这并没有真正回答我最初提出的问题,但这是我最终解决上述问题的方法,所以不管怎样。
"unlimitedStorage"
权限来授予它无限的存储空间。(免费的版本跟踪,一个有文档记录的同步协议,而不是chrome.storage.sync做的任何巫毒,等等),和缺点(额外的依赖性,需要一个单独的远程服务器[见下文],等等)对我来说不是一个大问题。hmmo2u0o2#
A Google account comes with 15Gb of storage. Gmail, Google Docs, Google Tasks, Google Calendar, Google-Drive and chrome.storage ALL get packed into that 15Gb of Google Bucket space. More than 15Gb, if go big with Google One :) .
Extensions like "Tabs Outliner" stores a significant amount of data (on my desk, 10,000+ nested HTML lists/href list items) in ?localStorage? ... and up to 1000 backups in a Google-Drive folder, which appears private to the extension. i.e It is essentially a bottomless private folder for the Extension.
The downside: Tabs Outliner requires you to login to Google to sync the account on each machine you deploy to ... and (I think) each time there is an extension update. But publishing your extension (even privately) on CWS means that the publically registered Extension ID is recognised in your Google profile; and automatically deployed/updated from the CWS to ANY Chrome Browser where you've logged in with your Google Account. The Sync with Google-Drive is just a login away, but there may even be answers for that. (No promises ... the guy that wrote Tabs Outliner is pretty savy).
Apologies, I know this is lacking in detail. I'm considering picking up Tabs Outliner if it's Ukraine developer doesn't come back anytime soon (tumbleweeds for a few years to a paid community, but perhaps he has more pressing problems). I'm fumbling in the dark a little myself, but there area MANY good extensions - most with github source that you can view freely - which offer a model for the things we try to do.
HTH.