在 Windows 和 Android Firefox 之间共享 greasemonkey 脚本和数据库

Share greasemonkey script and database between Windows and Android Firefox

我在我的笔记本电脑 Firefox 上使用自制的 greasemonkey 脚本已经很久了。它包括使用 GM.setValue.

存储数据

现在我刚买了一个 Android 平板电脑,并且希望能够使用这个脚本并更新值,而我正在使用笔记本电脑或平板电脑。

希望 Firefox Sync 能处理这个问题,但连脚本都没有同步。

我想同步脚本 dans 数据库文件(Google 驱动器、保管箱等),但我意识到自从 v4 以来,曾经在 gm_scripts 中的数据库已经消失,我不知道 Greasemonkey 现在在哪里存储脚本或它们的关联数据库。

我正在寻找任何可能让它发挥作用的东西。

1) 有没有办法用 Firefox Sync 来处理这个问题?

2) 替代方案(Tampermonkey、Violentmonkey、?)会更好地处理吗?

3) 我在哪里可以找到新的 Greasemonkey 系统中的 scripts/database?

4) 我可以通过 Google 驱动器同步它们吗? (似乎有一些技巧可以在机器之间同步文件)

5) 是否有一个简单、免费的替代方案可以让我在机器之间同步一个非常小的文件?

============================================= == 更新:

我尝试了 TamperMonkey,它有一个同步功能,但即使在不同的笔记本电脑或我的 phone 上看起来没问题,同步在平板电脑上最多也是随机的。

还意识到只有脚本被同步,而不是它们的数据。脚本几乎从不更改,但数据每天更新几次,所以无论如何都不是真正的解决方案。

数据不再以可读文件格式存在,因此在外部同步数据文件时也不走运。

TamperMonkey 还有一个 import/export 功能,这确实考虑到了数据。所以我现在能做的最好的事情就是在每次切换设备时考虑导出然后导入。不理想所以仍在寻找更好的解决方案。

storage.sync

Represents the sync storage area. Items in sync storage are synced by the browser, and are available across all instances of that browser that the user is logged into (e.g. via Firefox sync, or a Google account), across different devices.

同步有限制。

  • 同步需要登录
  • 最多可以同步 100kb,超过 100kb 将失败
  • 存储同步通常同步整个扩展存储,如果是用户脚本管理器,它们通常大于 100kb,因为它们也包括用户脚本
  • 数据存储在别处(不在您的计算机上)可能会引起 security/privacy 担忧
  • 存储 read/write 由于远程数据存储需要互联网访问和更长的时间
  • 扩展必须有同步选项

1) Is there a way to handle that with Firefox Sync ?

是,但取决于上述情况。而 Firefox sync doesn't appear to have the 100kb limit, syncing the entire Firefox takes longer (How do I set up Sync on my computer?).

2) Would an alternative (Tampermonkey, Violentmonkey, ?) handle that better ?

Greasemonkey:没有同步功能
Tampermonkey:同步到 Dropbox、Google Drive 或 WebDAV 服务
Violentmonkey:同步到 Dropbox、OneDrive、Google Drive 或 WebDAV 服务
Firemonkey:没有同步功能

TM/VM 第 3 方存储同步允许存储超过 100KB。但是,使用第 3 方存储允许第 3 方跟踪,这是一种隐私考虑。存储read/write操作也慢了很多。

3) Where can I find the scripts/database in the new Greasemonkey system ?

从Firefox 57开始,扩展程序不能保存文件到硬盘,唯一的存储区域是扩展程序存储区,像以前一样不能访问。

4) Could I synchronize them via Google drive ? (There seem to be some hacks to sync a file between machines)

参考上文

5) Would there be a simple, free alternative that would allow me to synchronize a very small file between machines ?

这取决于设置和数据更改的频率。

例如,如果数据不经常更改,尤其是数据隐私是必不可少的,则有备份export/import选项(脚本+数据)。因此,扩展数据可以保存到U盘并在任何地方加载(适用于共享环境)。

结论: 1-2) 我切换到 TamperMonkey,在那里我可以轻松地从 Google 驱动器(或其他)up/download 脚本。

3-4-5) 新的浏览器扩展架构意味着您基本上无法访问文件系统上的数据

唯一的解决办法是 store/retrieve 别处的数据,而不是 GM 方法。我将我的存储在一个 airtable base 中,因为它提供了一个非常易于使用的 API,可以从用户脚本调用。