Very simple macOS and iOS apps for debugging Safari content blocking rules.
This is also a showcase of how to use SafariConverterLib to build a Safari content blocker.
- XCode 16.3 or newer is required to build it.
- Change "Development Team" in the Project settings.
- Change bundle IDs of each target and app groups, i.e. replace all
occurrences in all files:
dev.ameshkov->dev.yourname. - Edit the file
filters/filter.txtand put the rules you'd like to test there.
If you want to use local version of SafariConverterLib, please do the following:
-
Clone the SafariConverterLib project to
/safari-converter-lib:git clone https://github.com/AdguardTeam/SafariConverterLib.git safari-converter-lib
-
Change path to converter JS library in extensions/appext/package.json and in extensions/webext/package.json:
"dependencies": { "@adguard/safari-extension": "file:../../safari-converter-lib/Extension" }
-
Run
make js-buildto rebuild the extensions. -
Open XCode, open
safari-blockerproject, go toPackage dependencies, removeContentBlockerConverterpackage and add its local version instead. Add the library to targetcontent-blocker-service.
- In order to use the app on macOS, enable developer mode in Safari and allow unsigned extensions in Developer Options.
- Build and run the app, target
safari-blocker.
- If you use a Simulator, it will be enough to build and run
safari-blocker-ios.
- Swift 6 or newer.
- Install Node.js: recommend to use nvm for that.
- Install pnpm:
brew install pnpm. - Install SwiftLint:
brew install swiftlint. - Install xcbeautify:
brew install xcbeautify. - Install markdownlint-cli:
npm install -g markdownlint-cli.
Run make init to setup pre-commit hooks.
Use XCode 16.3 or newer to build and run the apps.
safari-blocker- the macOS version.safari-blocker-ios- the iOS version.
To build the browser extensions code, run make js-build.
Please refer to ./DEVELOPMENT.md for developer documentation and guidelines.
If you're using an AI-enabled IDE (Windsurf/Cursor/Copilot/etc), use this document as a rules file, for example:
ln -s ./DEVELOPMENT.md .windsurfrulesFor the browser extensions, please refer to their respective README files: