This project aims to provide a utility to convert urlfilters (in Easylist syntaxt) to the DNR (declarative net request) format, in a browser. It uses 3rd party libraries for the conversions.
The tool is publicaly available on a github page.
- AdGuard - @adguard/tsurlfilter licenses under GPLv3
- AdBlockPlus - @eyeo/abp2dnr licenses under GPLv3
Install bunjs
with a tool like asdf
or rtx
, eg.:
rtx install
Install node modules
bun install --frozen-lockfile
Build static page:
bun run build
Start development server:
bun run serve
Running tests:
bun run test.unit
bun run test.e2e
NOTE: to run e2e tests playwright needs to install instumented browser. To do that run:
bunx playwright install --with-deps
The conversion tool can be used in any page or web-extension when embeded in an iframe.
Example:
<iframe id="urlfilter2dnr" src="https://ghostery.github.io/urlfilter2dnr/" height="0" width="0"></iframe>
window.addEventListener("message", (event) => {
console.log('DNR rules', event.data.rules);
});
document.getElementById("urlfilter2dnr").contentWindow.postMessage({
action: 'convert',
converter: 'adguard',
filters: ['||test.com'],
}, "*");