Modify scripts to use ids instead of urls to allow for mapping between subscriptions and rulesets
Background
We need to have a mapping between the supported subscriptions as they're provided in the scripting/preparation phase of building an MV3 extension.
Important language:
- "Index of supported subscriptions" - https://filter-delivery-staging.eyeo.com/v3/index.json
- "Subscription" - as defined by Eyeo and the SDK. A list of request and content filters.
- "preparation scripts" - The "subs-*" scripts. Init, Merge, Fetch, Convert, Generate currently.
Use case
This is needed in order to understand the relationship between the subscriptions in the SDK and their generated rulesets made by the preparation scripts.
What to change
-
(Subscriptions) Replace return subscription.url.replace(/[^a-z0-9]/gi, "_").toLowerCase();
in thefetchSubscriptions.js
script withreturn subscription.id
-
(Rulesets) Rulesets as ultimately generated in rulesets.json.tpl
should also use the subscription id as above. -
What proof will we have that this works? -
Move the current preparation scripts to the SDK. Keep in mind that updateSubscriptions
in core should still work for MV2 (See core issue: adblockpluscore#448 (closed)) -
Consider how we handle rulesets.json.tpl
if the ruleset files are also named after their ids. -
Consider what should happen with non DNR convertible filters inside of subscriptions
Integration notes
- Breaking changes:
- Scripts names changed in
npm exec ...
to what is used innpm run ...
:- from
updateSubscriptions
tosubs-init
- from
mergeSubscriptions
tosubs-merge
- from
fetchSubscriptions
tosubs-fetch
- from
convertSubscriptions
tosubs-convert
- from
generateSubscriptionsFragment
tosubs-generate
- from
- Scripts names changed in
Edited by Rowan Deysel