Skip to content

Commit f9b9f3a

Browse files
authored
Add Usage and API sections to README
1 parent d4f5888 commit f9b9f3a

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed

README.md

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,28 @@
11
# adblock-rust-server
22
Server wrapper for the [adblock crate](https://crates.io/crates/adblock) using Unix domain sockets.
33

4-
Created for [blockit](https://github.com/dudik/blockit), but can be used in any program that support Unix domain sockets. Basic documentation will be added soon.
4+
Created for [blockit](https://github.com/dudik/blockit), but can be used in any program that supports Unix domain sockets.
5+
6+
## Usage
7+
Add urls of filter lists (e.g. https://easylist.to/easylist/easylist.txt) to `~/.config/ars/urls`.
8+
Custom rules (e.g. ###customAd) should be added to `~/.config/ars/lists/custom`.
9+
10+
## API
11+
After launching adblock-rust-server connect to `/tmp/ars` socket file to start communicating.
12+
Every request and response message have to end with a new line character `\n`. Two request types are supported:
13+
14+
### Network request
15+
`n <request_url> <source_url> <request_type>`
16+
17+
For example:
18+
`n https://duckduckgo.com/p103.js https://duckduckgo.com/ script`
19+
20+
Checks if the request should be blocked. Returns `1` if it should and `0` if not.
21+
22+
### Cosmetic request
23+
`c <website_url> <ids> <classes>`
24+
25+
For example:
26+
`c https://duckduckgo.com/ pg-index wedonttrack content_homepage logo_homepage_link`
27+
28+
Returns a CSS rule that hides unwanted elements. `<ids>` and `<classes>` are lists of id/class names separated by the tab character `\t`.

0 commit comments

Comments
 (0)