Skip to content

ghostery/urlfilter2dnr

Repository files navigation

@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 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

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

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published