1.2.0 • Published 6 months ago

@ghostery/urlfilter2dnr v1.2.0

Weekly downloads
-
License
GPL-3.0
Repository
github
Last release
6 months ago

@ghostery/urlfilter2dnr

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.

Converters

Local development

Install nodejs with a tool like asdf, rtx or mise, eg.:

rtx install

Install node modules

npm ci

Build static page:

npm run build:page

Start development server:

npm run serve

Running tests:

npm run test.unit
npm run test.e2e

NOTE: to run e2e tests playwright needs to install instumented browser. To do that run:

npx playwright install --with-deps

postMessage API

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'],
}, "*");
1.2.0

6 months ago

1.1.0

6 months ago

1.0.5

6 months ago

1.0.4

6 months ago

1.0.3

6 months ago

1.0.2

6 months ago

1.0.1

6 months ago

1.0.0

6 months ago