重新打包 Mozilla Addon Builder 扩展文件时出现问题

发布于 2024-12-08 13:00:39 字数 632 浏览 0 评论 0原文

在我寻找 Mozilla 扩展平台的过程中已经取得了相当大的进展,但我仍然在一些问题上苦苦挣扎。希望这里有人能再次为我指出正确的方向:)

好吧,这就是问题。 ..我一直在这里摆弄在线插件构建器应用程序: https://builder.addons.mozilla.org /

太棒了,这对于测试简单的插件来说似乎可以正常工作。但它包含了很多额外的垃圾——我没有使用并且不需要的东西。

现在,当我下载 .xpi 文件,将其重命名为 .zip,并将其解压以处理文件时,当我将其重新打包为 zip 时 -> xpi,当我尝试安装时,Firefox 告诉我软件包已损坏。

我推断这是因为包被“签名”或其他原因,当我自己重新打包它时,这种情况没有发生。

任何。这太荒谬了......

所以我想使用SDK在本地工作,然后以某种方式将SDK包含在目录中。但看起来我需要安装 python 并运行一些东西才能首先生成一些文件等等等等......你在开玩笑吗?我不能只编写应用程序代码,然后包含 SDK 文件吗?

问题:

如何使用在线插件生成器创建基本插件/扩展,然后在本地编辑文件,重新打包并使用它?

Have made quite a bit of progress in my quest to figuring out the Mozilla extension platform, but am still struggling with a few issues.. Hoping someone here can point me in the right direction once again :)

Ok, so here is the issue... I have been messing around with the online addon builder app here: https://builder.addons.mozilla.org/

Great, this seems to be working ok for testing simple addons. But it includes so much extra junk - stuff I am not using and don't need there.

Now when I download the .xpi file, rename it to .zip, and extract it to work on the files, when I repackage it to a zip -> xpi, Firefox tells me the package is corrupt when I try to install.

I have deduced that this is because the package is "signed" or something, and when I repackage it myself this is not happening.

Whatever. This is getting ridiculous...

So I want to use the SDK to work locally, and then just include the SDK in the directory somehow. But it looks like I need to install python and run something in order to generate some files first blah blah blah.... are you joking me? I can't just code my app, then include the SDK files?

QUESTION:

How can I create my basic addon/extension with the online Addon Builder, then edit the files locally, repackage it, and use it?

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

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

发布评论

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

评论(1

浮萍、无处依 2024-12-15 13:00:39

使用 SDK 创建的附加组件目前尚未签名(请参阅错误 613618) 。包清单中有一堆 SHA256 校验和,但没有任何内容来验证它们(也许它们是为了通过外部工具进行验证,我不知道)。所以这不是您遇到的问题。

最可能的问题是,当您重新打包 ZIP 文件时,您没有保留目录结构。 install.rdf 文件需要位于包的顶层,而不是位于某个子目录中。您可以使用 unzip -l mypackage.xpi 检查它 - 它应该列出 install.rdf ,不带任何目录名称。

一般来说,我建议不要操作 XPI 文件。通过删除未使用的模块,您可能可以节省 100 kB 的下载大小,很可能更少 - 安装您的附加组件的人甚至不会注意到下载大小的差异。未使用的模块对附加组件的性能影响为零。但是你可能会冒着删除实际使用的东西的风险,也许是以一种不明显的方式。一旦 AMO 启动自动重新打包 SDK 附加组件 无论如何,他们都会用标准包替换您的附加组件。

Add-ons created with the SDK currently aren't signed (see bug 613618). There are a bunch of SHA256 checksums in the package manifest but nothing is verifying them (maybe they are meant for verification by external tools, I don't know). So this is not the problem you are experiencing.

Most likely issue is that when you repacked the ZIP file you didn't keep the directory structure. The install.rdf file needs to be at the top level of the package, not in some subdirectory. You can check it with the unzip -l mypackage.xpi - it should list install.rdf without any directory name.

Generally, I would advise against manipulating the XPI files. By removing unused modules you might be able to save 100 kB in download size, most likely less - somebody installing your add-on will not even notice the difference in download size. Modules that aren't used have zero impact on performance of your add-on. But you risk removing something that is actually used, maybe in a non-obvious way. And once AMO starts repacking SDK add-ons automatically they will replace your add-on by the standard package anyway.

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