Reputation: 183
I think there's a file where settings of every addon installed are stored. Where can I find it? I need the name of the extensions, the version, the state(enabled,disabled,uninstalled) and the extensions ID.
Upvotes: 1
Views: 296
Reputation: 2188
All the information you seek is in $profD/extensions.json
E. g.
{
"schemaVersion": 17,
"addons": [
{
"id": "[email protected]",
"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/[email protected]",
"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
},
...
}
Upvotes: 1
Reputation: 6206
Don't need to find out the add-on files. Just use the AddonManager.jsm service:
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, ' '));
});
For more detail on this just read these two docs.
Upvotes: 0