What's the proper way to create whitelists when using Safari content blocker API? https://developer.apple.com/library/archive/documentation/General/Conceptual/ExtensibilityPG/ContentBlocker.html
Imagine I have an adult content blocker like this one, but instead of 3 domains, 50000. (I already did it and it works)
[
{
"action": {
"type": "block"
},
"trigger": {
"url-filter": ".*",
"if-domain": ["*xvideos.com", "*pornhub.com", "*xxx.com"]
}
}
]
How should I add a whitelist? Do I have to create a second blocker with other rules or do I have to modify my adult content blocker to remove the whitelisted domains programmatically in real time, generate another JSON and reloading it?
You start by blocking everything:
than you whitelist (for example) the website "Google.com":
Here I approve "Google.com" and everything down his hierarchy, for example "Google.com/shop" or "Google.com/account".
Edit: it seems I was wrong, and not the first one to fall into it, to white list a website, This is how it's done:
You can see full list of commands here: https://developer.apple.com/documentation/safariservices/creating_a_content_blocker
Also check this question: iOS Content Blocker Whitelist Website