mozilla firefox插件设置

时间:2016-01-15 11:45:00

标签: firefox firefox-addon

我认为有一个文件存储了每个插件的设置。我在哪里可以找到它? 我需要扩展名,版本,状态(启用,禁用,卸载)和扩展ID。

2 个答案:

答案 0 :(得分:1)

您寻求的所有信息都在$profD / extensions.json

电子。克。

{
    "schemaVersion": 17,
    "addons": [
        {
            "id": "addon@example.org",
            "syncGUID": "-3yoR7F-ml47",
            "location": "app-profile",
            "version": "0.0.1.34",
            "type": "extension",
            "internalName": null,
            "updateURL": null,
            "updateKey": null,
            "optionsURL": null,
            "optionsType": null,
            "aboutURL": null,
            "icons": {

            },
            "iconURL": null,
            "icon64URL": null,
            "defaultLocale": {
                "name": "My addon",
                "description": "Addon description",
                "creator": "me",
                "homepageURL": null,
                "developers": [
                    "me"
                ]
            },
            "visible": true,
            "active": false,
            "userDisabled": true,
            "appDisabled": false,
            "descriptor": "/home/user/.mozilla/firefox/w7svh0gr.ffnightly/extensions/addon@example.org",
            "installDate": 1452014720000,
            "updateDate": 1452015546000,
            "applyBackgroundUpdates": 1,
            "bootstrap": true,
            "skinnable": false,
            "size": 147533,
            "sourceURI": "file:///home/user/addon.xpi",
            "releaseNotesURI": null,
            "softDisabled": false,
            "foreignInstall": false,
            "hasBinaryComponents": false,
            "strictCompatibility": false,
            "locales": [

            ],
            "targetApplications": [
                {
                    "id": "{ec8030f7-c20a-464f-9b0e-13a3a9e97384}",
                    "minVersion": "24.0a1",
                    "maxVersion": "37.0a1"
                },
                {
                    "id": "{aa3c5121-dab2-40e2-81ca-7ea25febc110}",
                    "minVersion": "25.0a1",
                    "maxVersion": "37.0a1"
                }
            ],
            "targetPlatforms": [

            ],
            "multiprocessCompatible": false,
            "signedState": 0
        },
...
}

答案 1 :(得分:0)

不需要找出附加文件。只需使用AddonManager.jsm服务:

const { Cu } = require("chrome");

let AddonManager = Cu.import("resource://gre/modules/AddonManager.jsm").AddonManager;

AddonManager.getAddonsByTypes(["extension"], function(addons) {
    var addonData = [];

    for (let i in addons) {
        let cur = addons[i];
        addonData.push({
            id: cur.id.toString(),
            name: cur.name,
            version: cur.version,
            active: cur.isActive
        });
    };
    console.log(JSON.stringify(addonData, null, '   '));
});

有关详细信息,请阅读这些two docs