从命令行在Firefox上安装WebExtensions [英] Install WebExtensions on Firefox from the command line

查看:214
本文介绍了从命令行在Firefox上安装WebExtensions的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我发现如何安装Firefox插件从脚本中的命令行?,似乎适用于Firefox扩展(即与一个 install.rdf 文件),但WebExtensions(扩展与一个 manifest.json em> file)?

解决方案

请参阅:



您在askubuntu上链接的问题:如何从脚本中的命令行安装Firefox插件是几年过时了,但确实有一些很好的信息。



此时,大多数Mozilla插件(包括所有的Firefox WebExtension插件)都是通过将插件的 .xpi 文件放在相应的目录中以正确的名称手动安装的对于没有解包(解压缩)内容的扩展。你也可以通过在Firefox中下载它们,将 .xpi 拖放到Firefox / Thunderbird等等来安装它们。]

您可以通过解压附件的 .xpi 文件并查看 install.rdf 文件来查看它是否具有 < em:unpack> true< / em:unpack> 。所有的WebExtensions都没有这个文件,并且安装时没有解包。


$ b .xpi 文件必须被称为 [extensionID]的.xpi 。您可以从 install.rdf 文件(非WebExtension附加组件)中找到扩展标识。在该文件中,您正在寻找 < em:id> ThisEntireStringIsTheAddOnsID< / em:id>

对于WebExtension,ID位于 manifest.json 文件在< a href =https://developer.mozilla.org/en-US/Add-ons/WebExtensions/manifest.json/applications =nofollow noreferrer>应用程序属性:

 applications:{
gecko:{
id:ThisEntireStringIsTheAddOnsID
}



$ b $ p
$ b

对于上面的两个例子, .xpi 文件必须重命名为 ThisEntireStringIsTheAddOnsID.xpi



如果 install.rdf 文件包含< ; em:unpack> true< / em:unpack> ,然后在 .xpi 文件解压缩(解压缩)并放置在extensions目录下的子目录中。在上面的 install.rdf 示例中(WebExtensions的不是解压缩),该目录将被命名为: ThisEntireStringIsTheAddOnsID



扩展目录:



放置 .xpi 文件或解包目录的扩展目录是从MDN复制):



对于运行特定版本的Firefox的所有用户:

[Firefox安装目录] / browser / extensions /

Firefox将询问用户在运行该版本的Firefox时确认加载项的安装。用户将无法删除扩展名,只能将其禁用。对于运行特定版本Firefox的所有用户:

[Firefox安装目录] /分发/ extensions

首次使用该版本的Firefox运行配置文件时,将为所有用户/配置文件安装扩展。该扩展程序将被复制到配置文件的扩展名目录中,用户将能够除去禁用它。用户不会被要求确认安装。复制到每个配置文件的扩展名将随同为该配置文件安装的所有其他扩展名一起自动更新。您应不要解压缩此目录中的任何 .xpi 文件。如果文件需要解压缩,当扩展程序安装在每个配置文件中时,它将由Firefox自动完成。



对于特定用户的特定配置文件:

[profile directory] ​​/ extensions /



在Windows上:

全部特定用户的配置文件:

%appdata%\Mozilla\Extensions\ {ec8030f7-c20a-464f-9b0e-13a3a9e97384} \



个人档案目录位于:
\Mozilla\Firefox\Profiles\ *



OSX:

对于所有用户:

/ Library / Application Support / Mozilla / Extensions / {ec8030f7-c20a -464f-9b0e-13a3a9e97384} /



仅针对特定用户,将其置于该用户的库文件夹层次结构中:

< 〜/ Library / Application Support / Mozilla / Extensions / {ec8030f7-c20a-464f-9b0e-13a3a9e97384} /

$ b

Linux:

对于所有用户:





/ emr / lib64 / Mozilla / extensions / {ec8030f7-c20a-464f-9b0e-13a3a9e97384} /



/ emr / share / Mozilla / extensions / {ec8030f7- c20a-464f-9b0e-13a3a9e97384} /



仅针对特定用户:

〜/ .Mozilla / extensions / {ec8030f7-c20a-464f-9b0e-13a3a9e97384} /



注意:



在你连接的问题/答案中提到的 -install-global-extension 选项是从Gecko 1.9.2(从前很久以前)从Firefox中删除。


I found the question How to install Firefox addon from command line in scripts? that seems to work for Firefox extensions (i.e. ones with an install.rdf file) but what about WebExtensions (extension with a manifest.json file instead)?

解决方案

Please see:

The question you link on askubuntu: How to install Firefox addon from command line in scripts? is several years out of date, but does have some good information.

At this point, most Mozilla add-ons, including all Firefox WebExtension add-ons, are installed manually by placing the add-on's .xpi file in the appropriate directory with the correct name for the extension without unpacking (unzipping) the contents. [You can also install them by downloading them in Firefox, drag-and-drop the .xpi onto Firefox/Thunderbird, etc.]

You can determine those add-ons that must be unpacked by unpacking the add-on's .xpi file and looking at the install.rdf file to see if it has <em:unpack>true</em:unpack>. All WebExtensions don't have this file, and are installed without unpacking.

The .xpi file must be called [extensionID].xpi. You can find the extension ID from either the install.rdf file (non-WebExtension add-ons). In that file, you are looking for <em:id>ThisEntireStringIsTheAddOnsID</em:id>

For a WebExtension, the ID is in the manifest.json file under the applications property:

"applications": {
    "gecko": {
        "id": "ThisEntireStringIsTheAddOnsID"
    }
},

For both of the above examples the .xpi file must be renamed to ThisEntireStringIsTheAddOnsID.xpi

If the install.rdf file includes <em:unpack>true</em:unpack>, then the files in the .xpi must be unpacked (unzipped) and placed in a subdirectory under the extensions directory. In the above install.rdf example (again WebExtensions are not unpacked), the directory would be named: ThisEntireStringIsTheAddOnsID

Extension directories:

The extension directories where you put the .xpi file or unpacked directory are (information partially copied from MDN):

For all users running a particular version of Firefox:
[Firefox install directory]/browser/extensions/
Firefox will ask the user to confirm installation of the add-on when that version of Firefox is run. The user will not have the ability to remove the extension, only disable it. The extension will not be automatically updated.

For all users running a particular version of Firefox:
[Firefox install directory]/distribution/extensions
The extension will be installed for all users/profiles the first time the profile is run with that version of Firefox. The extension will be copied into the profile's extensions directory and the user will be able to remove it in addition to disabling it. The user will not be asked to confirm installation. The extension copied to each profile will be automatically updated along with all other extensions installed for that profile. You should not unpack any .xpi files in this directory. If the file needs to be unpacked, it will be done automatically by Firefox when the extension is installed in each profile.

For a particular User's specific profile:
[profile directory]/extensions/

On Windows:
All profiles for a specific user:
%appdata%\Mozilla\Extensions\{ec8030f7-c20a-464f-9b0e-13a3a9e97384}\

Profile directories are located at:
\Mozilla\Firefox\Profiles\*

OSX:
For all users:
/Library/Application Support/Mozilla/Extensions/{ec8030f7-c20a-464f-9b0e-13a3a9e97384}/

Just for a specific user, place it in that user's library folder hierarchy:
~/Library/Application Support/Mozilla/Extensions/{ec8030f7-c20a-464f-9b0e-13a3a9e97384}/

Linux:
For all users:
/usr/lib/Mozilla/extensions/{ec8030f7-c20a-464f-9b0e-13a3a9e97384}/
or
/usr/lib64/Mozilla/extensions/{ec8030f7-c20a-464f-9b0e-13a3a9e97384}/
or
/usr/share/Mozilla/extensions/{ec8030f7-c20a-464f-9b0e-13a3a9e97384}/

Just for a specific user:
~/.Mozilla/extensions/{ec8030f7-c20a-464f-9b0e-13a3a9e97384}/

NOTE:

The -install-global-extension option mentioned in the question/answer you linked was removed from Firefox as of Gecko 1.9.2 ( a long time ago).

这篇关于从命令行在Firefox上安装WebExtensions的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆