Expand description
§Cleaner
A Cleaner is the bulk configuration unit for URL Cleaner Engine. It contains all the logic for how to clean URLs as well as documentation about itself.
The following cleaner always removes the utm_source query parameter and, if the https_upgrade flag is enabled, upgrades HTTP URLs to HTTPS.
{
"docs": {
"name": "Example cleaner",
"description": [
"An example cleaner"
],
"flags": {
"https_upgrade": "Upgrade HTTP URLs to HTTPS"
}
},
"actions": [
{"RemoveQueryParam": "utm_source"},
{"If": {
"if": {"All": [
{"FlagIsSet": "https_upgrade"},
{"SchemeIs": "http"}
]},
"then": {"SetScheme": "https"}
}}
]
}The docs field contains the CleanerDocs. It’s optional but polite to add.
The omitted params field contains the Params used to store configuration data.
The omitted commons field contains the Commons used to store components used in multiple places.
The actions field contains a list of Actions to do. The first action, written as RemoveQueryParam removes any “utm_source” query param found in the URL.
The second action, the If action, applies the action in its then field if and only if the condition in its if field is “satisfied”.
In this case, the condition is satisfied if the “https_upgrade” flag is set and the URL’s scheme is “http”.
Unlike AdGuard/uBlock Origin filters, URL Cleaner actions are applied in order of declaration. This has the benefit of letting you build far more complex operations out of far simpler building blocks, but has the downside of being very easy to write slow cleaners.