Skip to content

Latest commit

 

History

History
143 lines (115 loc) · 5.69 KB

README_en.md

File metadata and controls

143 lines (115 loc) · 5.69 KB

AD Filter Subscriber

Ad Filter Rule Subscriber, integrating rules from various sources to help you quickly build your own rule set~

last update forks stars open issues license


English | 中文

📔 Introduction

This project aims to aggregate ad filtering rules from different sources and in various formats, allowing for flexible conversion and integration.

⚠️ Note: The new version is not compatible with the original configuration format, so please be cautious before migrating.

Supported Rule Formats

  • easylist
  • dnsmasq
  • clash
  • smartdns
  • hosts

Important Notes

  1. Only basic rule conversions are supported, specifically rules consisting of domain names and wildcard domains. Rules such as ||example.org^$popup cannot be converted (merging and deduplication are not affected).
  2. Accept unavoidable limitations. For example, ||example.org^ will block example.org and all its subdomains, but when converted to hosts format, it will not match subdomains.
  3. Rule validity check is based on domain resolution, so it only supports basic rules.

🛠️ Quick Start

Example Configuration

application:
  rule:
    # Remote rule subscription, path is http/https address
    remote:
      - name: 'Subscription 1'               # Optional parameter: Rule name, if no name is provided, the path will be used as the name.
        path: 'https://example.org/rule.txt' # Required parameter: Rule url. Only support http/https. 
        type: easylist                      # Optional parameter: Rule type: easylist (default)、dnsmasq、clash、smartdns、hosts

    # Local rule, path is absolute or relative path
    local:
      - name: 'private rule'
        path: '/rule/private.txt'

  output:
    # File header configuration, which will be automatically added as comments at the beginning of each rule file.
    # You can use placeholders like ${name}, ${type}, ${desc}, and ${date} (current date).
    file_header: |
      ADFS Adblock List
      Title: ${name}
      Last Modified: ${date}
      Homepage: https://github.com/fordes123/ad-filters-subscriber/
    path: rule   # Output rule file path. Support absolute or relative path.
    files:
      - name: easylist.txt     # Required parameter: File name
        type: EASYLIST         # Required parameter: File type: easylist、dnsmasq、clash、smartdns、hosts
        desc: 'ADFS EasyList'  # Optional parameter: File description, which can be used within ${} in the file_header.
        filter:                # Optional parameter: Types of included rules, all selected by default.
          - basic              # Basic rules: Do not contain any control or matching symbols, can be converted to hosts.
          - wildcard           # Wildcard rules: Only use wildcard symbols.
          - unknown            # Other rules: Such as those using regex or advanced modifiers, cannot be converted at present.

This program is written in Java 21 and built using Maven. You can refer to the example configuration, edit src/main/resources/application.yml, and quickly get started using any of the following methods:

Local Debugging

git clone https://github.com/fordes123/ad-filters-subscriber.git
cd ad-filters-subscriber
mvn clean
mvn spring-boot:run

Github Action

  • Fork this project
  • Customize rule subscriptions
    • Refer to the example configuration and modify the configuration file: src/main/resources/application.yml
  • Open the GitHub Actions page, select Update Filters on the left side, and authorize the workflow for scheduled execution (⚠ important step)
  • Click Run workflow or wait for automatic execution. Once completed, the corresponding rules will be generated in the directory specified in the configuration.

Codespaces

  • Log in to GitHub, click the Code button in the upper right corner of this repository, and select and create a new Codespace.
  • Wait for Codespaces to start, and you can directly debug this project.

How to Update

When the source code is updated, your repository's home page will display a prompt like the one shown below:

At this point, select Sync fork and then choose Update branch to sync the updates.
(If you have modified the source code, there may be merge conflicts. Please handle them carefully.)


🎯 Rule Subscription

⚠ This repository no longer provides rule subscriptions. We highly recommend forking this project to build your own rule set.

Below are rule repositories built using this project. You can find suitable rule subscriptions in them:

Click to view

💬 Feedback