如何集成 Firefox 同步?

发布于 2024-10-02 13:01:32 字数 580 浏览 3 评论 0原文

Firefox 4 即将推出(好吧,明年;))并且有一个 Firefox 插件可以将您的书签等与 Firefox 3 同步。

我想知道是否有人有一个全面的、最新的教程来将 Firefox Sync 集成到您自己的插件中?或者对此有什么想法吗?

我主要遵循这个官方“教程”以及这篇博文,但信息似乎有点过时。
例如,该对象不再称为 Weave,而是 Engines,并且 weave.engines. 首选项变为 services.sync.engines。。我对所有提到的选项进行了一些尝试,但它似乎不起作用(并且我的插件没有显示在您可以选择同步内容的列表中)。

我认为 Tracker 和 Store 类都很好,主要问题是注册引擎...

Firefox 4 comes soon (ok, next year ;)) and there is a Firefox plugin to sync your bookmarks etc. with Firefox 3.whatever .

I would like to know if anyone has a comprehensive, up-to-date tutorial to integrate Firefox Sync into your own plugin? Or any idea regarding this?

I mainly followed this official "tutorial" and also this blog post, but the information seems to be slightly outdated.
For example, the object is not called Weave anymore but Engines and the weave.engines. preference became services.sync.engines.. I played a little with all the mentioned options, but it does not seems to work (and my plugin does not show up in list where you can select what to sync).

I assume that the Tracker and Store classes are fine, the main problem is to register the engine...

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

匿名。 2024-10-09 13:01:32

您提到的 ClientAPI 教程绝对是正确的选择。我最近更新了它,所以如果有问题,请告诉我们,以便我可以在文档中修复它。弗拉基米尔 (Wladimir) 的博文确实相当古老,并且包含一些过时的信息。我们还将在即将发布的测试版中对 API 的某些部分进行更改,因此请做好应对变化的准备...

Weave 命名空间仍然是从 UI 代码访问 Sync 相关 API 的规范方式。它公开了诸如 Weave.ServiceWeave.Engines 之类的组件。您可以通过 Components.utils.import("resource://services-sync/main.js") 导入它。如果您想实现自己的引擎,则必须导入实际的底层模块(所有这些都在 ClientAPI 教程中列出)。本教程还介绍了如何注册自定义引擎实现。不过,一旦注册,它就不会自动显示在首选项用户界面中。我建议构建您自己的 UI,以翻转附加组件首选项中的 services.sync.engine.YOURENGINE 首选项。

出于好奇,您想要同步什么样的数据?

The ClientAPI tutorial you mention is definitely the way to go. I updated it recently so if something's not working, please let us know so I can fix it in the docs. Wladimir's blogpost is definitely quite old and contains some outdated information. We will also make changes to some parts of the API in the upcoming beta releases, so be prepared for some flux...

The Weave namespace is still the canonical way to access Sync related APIs from UI code. It exposes components such as Weave.Service and Weave.Engines. You can import it via Components.utils.import("resource://services-sync/main.js"). If you want to implement your own engine, you'll have to import the actual underlying modules, though (all listed in the ClientAPI tutorial). The tutorial also describes how to register your custom engine implementation. Once it's registered, it won't automatically show up in the preferences UI, though. I suggest building your own UI that flips the services.sync.engine.YOURENGINE pref in your add-on's preferences.

Out of curiosity, what kind of data are you trying to sync?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文