firefox extensions: support more manifest formats
This commit is contained in:
@@ -47,8 +47,12 @@ let
|
||||
|
||||
# firefox requires addons to have an id field when sideloading:
|
||||
# - <https://extensionworkshop.com/documentation/publish/distribute-sideloading/>
|
||||
NEW_MANIFEST=$(jq '. + {"applications": { "gecko": { "id": "${extid}" }}, "browser_specific_settings":{"gecko":{"id": "${extid}"}}}' manifest.json)
|
||||
echo "$NEW_MANIFEST" > manifest.json
|
||||
for m in manifest.json manifest_v2.json manifest_v3.json; do
|
||||
if test -e "$m"; then
|
||||
NEW_MANIFEST=$(jq '. + {"applications": { "gecko": { "id": "${extid}" }}, "browser_specific_settings":{"gecko":{"id": "${extid}"}}}' "$m")
|
||||
echo "$NEW_MANIFEST" > "$m"
|
||||
fi
|
||||
done
|
||||
|
||||
runHook postPatch
|
||||
'';
|
||||
@@ -70,8 +74,12 @@ let
|
||||
withPostPatch = postPatch: final.passthru.withAttrs { inherit postPatch; };
|
||||
# given an addon, repackage it without some `perm`ission
|
||||
withoutPermission = perm: final.passthru.withPostPatch ''
|
||||
NEW_MANIFEST=$(jq 'del(.permissions[] | select(. == "${perm}"))' manifest.json)
|
||||
echo "$NEW_MANIFEST" > manifest.json
|
||||
for m in manifest.json manifest_v2.json manifest_v3.json; do
|
||||
if test -e "$m"; then
|
||||
NEW_MANIFEST=$(jq 'del(.permissions[] | select(. == "${perm}"))' "$m")
|
||||
echo "$NEW_MANIFEST" > "$m"
|
||||
fi
|
||||
done
|
||||
'';
|
||||
};
|
||||
});
|
||||
|
Reference in New Issue
Block a user