Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support cosmetic filterlists #466

Merged
merged 85 commits into from
Nov 7, 2024
Merged

Support cosmetic filterlists #466

merged 85 commits into from
Nov 7, 2024

Conversation

muodov
Copy link
Member

@muodov muodov commented Jul 24, 2024

This PR adds the optional support for cosmetic filterlist rules. Note that they are only used as a fallback, when autoconsent rules are not available for the given site. Autoconsent rules are still preferred as they can actively click reject buttons.

  • Currently, we are using Easylist Cookie list, and it's bundled into the source code for performance reasons. Building with another filterlist is fairly simple, but we don't provide an official API for this at the moment.
  • The test browser extension bundles the filterlist by default. To use the filterlist in the library, you need to use the correct import path (see below), and set enableFilterList config to true.

Breaking changes:

  • the exports of the npm package are now limited to the following endpoints:
    • import AutoConsent from '@duckduckgo/autoconsent' will import the main library class. This was the main use-case before, so most likely your code will not break.
    • import AutoConsent from '@duckduckgo/autoconsent/extra' will import the same class with a bundled filterlist. While it will increase the site coverage, it will also significantly increase the bundle size.
    • import rules from '@duckduckgo/autoconsent/rules/rules.json' will import the JSON rules. This is added mainly for backward compatibility.
  • All exports support CommonJS and ESM, so you can use require() too.
  • If you need to import another source file directly, you can still do it by the full path, e.g. import DomActions from './node_modules/@duckduckgo/autoconsent/lib/dom-actions.ts'

@muodov muodov requested a review from sammacbeth July 24, 2024 10:45
@muodov muodov added major Increment the major version when merged release Create a release when this pr is merged labels Oct 17, 2024
@muodov muodov marked this pull request as ready for review October 22, 2024 13:29
Copy link
Collaborator

@sammacbeth sammacbeth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good - just a couple of minor changes I think would improve it.

package.json Outdated Show resolved Hide resolved
lib/types.ts Outdated Show resolved Hide resolved
package.json Outdated Show resolved Hide resolved
rules/filterlists/overrides.txt Outdated Show resolved Hide resolved
@muodov muodov merged commit 23fc31e into main Nov 7, 2024
11 checks passed
@muodov muodov deleted the cosmetic-easylist branch November 7, 2024 10:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
major Increment the major version when merged release Create a release when this pr is merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants