-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* easylist experiment * update easylist * Tweak easylist hack * delay easylist detection * increase the easylist timeout * update easylist * Use fanboy-cookiemonster in the test extension * Initialize and apply cosmetic filters together with prehide rules * Fall back to filterist when no pop-up is found * Remove easylist rule * WIP * WIP: add perf metrics * add performance metrics * Allow disabling autoconsent per site (in the test extension) * Use uBO version of easylist cookie * remove the perf metrics code * Use constructed stylesheets for cosmetic styles * minify the extension content script * filterlist experiment * Add filterlist overrides * Update bundled filterlist * minor filterlist changes * Logging tweaks * Tweak logs * Add a rule for wise.com * add a rule for nike * Add a rule for dan.com * Remove generic-cosmetic rule (too many false positives) * add rule for medium.com * Add a rule for abc.net.au * Lint fix * removed unused file * support mobile aliexpress * Update rule for temu * Add rule for american airlines * Add rule for tesla * Wrap filterlist code in try catch * Add a rule for admiral GDPR popups * Tweak ensighten rule for britishairways.com * Address minor PR comments * comment overrides * update the adblocker library and use the provided style override * Bundle filterlist in JS * Update filterlist on every release * Tweak watch command * Remove outdated comments * Disable filterlist by default * Move log to a more appropriate place * remove unused ignore * Lint fix in auto-generated file * Update filterlist * Remove autogenerated filterlist from git index * Do not commit changes to filterlist * Update the build scripts to update filterlist when necessary * Regenerate package-lock (see npm/cli#4828) * remove performance marks * Produce separate builds with and without filterlist * Avoid generating filterlist twice in ci * Export json rules * Do not commit filterlist file during release * Build filterlist from easylist source * Update readme * add link to DDG download page * cliqz/adblocker is renamed to ghostery/adblocker * Address minor PR comments * Track the resulting filterlist in git * Add a ci job to update EasyList
- Loading branch information
Showing
21 changed files
with
31,350 additions
and
1,581 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
name: Update filterlist | ||
|
||
on: | ||
workflow_dispatch: | ||
|
||
schedule: | ||
- cron: '0 3 * * SUN' # run every Sunday at 3:00 | ||
|
||
jobs: | ||
update_filterlist: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Use Node.js 18.x | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 18.x | ||
|
||
- name: Install dependencies | ||
run: npm ci | ||
|
||
- name: Update EasyList | ||
run: | | ||
npm run update-easylist | ||
- name: Read EasyList revision | ||
id: read-revision | ||
run: echo "revision=`cat rules/filterlists/easylist_revision.txt`"" >> "$GITHUB_OUTPUT" | ||
|
||
- name: Create Pull Request | ||
uses: peter-evans/create-pull-request@v7 | ||
with: | ||
title: Update filterlist to ${{ steps.read-revision.outputs.revision }} | ||
commit-message: Update filterlist to ${{ steps.read-revision.outputs.revision }} | ||
labels: | | ||
minor | ||
dependencies | ||
reviewers: muodov,sammacbeth |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,3 +11,5 @@ addon/*.js | |
.vscode/ | ||
.env | ||
.DS_Store | ||
rules/filterlists/easylist_*.txt | ||
lib/filterlist-engine.ts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import { FiltersEngine } from '@ghostery/adblocker'; | ||
import { extractFeaturesFromDOM } from '@ghostery/adblocker-content'; | ||
import { parse as tldtsParse } from 'tldts-experimental'; | ||
import { getHidingStyle } from './utils'; | ||
|
||
export function deserializeFilterList(serializedEngine: Uint8Array) { | ||
return FiltersEngine.deserialize(serializedEngine) | ||
} | ||
|
||
export function getCosmeticStylesheet(engine: FiltersEngine): string { | ||
try { | ||
const parsed = tldtsParse(location.href); | ||
const hostname = parsed.hostname || ''; | ||
const domain = parsed.domain || ''; | ||
|
||
const cosmetics = engine.getCosmeticsFilters({ | ||
url: location.href, | ||
hostname, | ||
domain, | ||
|
||
// this extracts current ids, classes and attributes (depends on the current DOM state) | ||
...extractFeaturesFromDOM([document.documentElement]), | ||
|
||
getBaseRules: true, | ||
getInjectionRules: false, // we don't inject scripts atm | ||
getExtendedRules: true, | ||
getRulesFromDOM: true, | ||
getRulesFromHostname: true, | ||
|
||
hidingStyle: getHidingStyle('opacity'), | ||
}); | ||
return cosmetics.styles; | ||
} catch (e) { | ||
console.error('Error getting cosmetic rules', e); | ||
return ''; | ||
} | ||
} | ||
|
||
export function getFilterlistSelectors(styles: string): string { | ||
if (styles) { | ||
const selectorsOnly = styles.replace(/\s*{[^\\}]*}\s*/g, ',').replace(/,$/, ''); | ||
return selectorsOnly; | ||
} | ||
return ''; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.