Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Simple app for iOS/macOS to test Safari content blocking

ameshkov/safari-blocker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Safari Content Blocker

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.

safari-blocker

Prepare

  1. XCode 16.3 or newer is required to build it.
  2. Change "Development Team" in the Project settings.
  3. Change bundle IDs of each target and app groups, i.e. replace all occurrences in all files: dev.ameshkov -> dev.yourname.
  4. Edit the file filters/filter.txt and put the rules you'd like to test there.

Using local SafariConverterLib

If you want to use local version of SafariConverterLib, please do the following:

  1. Clone the SafariConverterLib project to /safari-converter-lib:

    git clone https://github.com/AdguardTeam/SafariConverterLib.git safari-converter-lib
  2. 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"
    }
  3. Run make js-build to rebuild the extensions.

  4. Open XCode, open safari-blocker project, go to Package dependencies, remove ContentBlockerConverter package and add its local version instead. Add the library to target content-blocker-service.

macOS app

  1. In order to use the app on macOS, enable developer mode in Safari and allow unsigned extensions in Developer Options.
  2. Build and run the app, target safari-blocker.

iOS app

  1. If you use a Simulator, it will be enough to build and run safari-blocker-ios.

Development

Prerequisites

  • 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.

Building

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.

Developer documentation

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 .windsurfrules

For the browser extensions, please refer to their respective README files:

About

Simple app for iOS/macOS to test Safari content blocking

Resources

Stars

Watchers

Forks