A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/gorhill/uBlock/commit/23f08f027460b5d0c0436357f866d6c48b8df701 below:

Add support for blocklist of filter lists · gorhill/uBlock@23f08f0 · GitHub

File tree Expand file treeCollapse file tree 3 files changed

+39

-9

lines changed

Filter options

Expand file treeCollapse file tree 3 files changed

+39

-9

lines changed Original file line number Diff line number Diff line change

@@ -16,6 +16,14 @@

16 16

"assets/thirdparties/publicsuffix.org/list/effective_tld_names.dat"

17 17

]

18 18

},

19 +

"ublock-badlists": {

20 +

"content": "internal",

21 +

"updateAfter": 13,

22 +

"contentURL": [

23 +

"https://raw.githubusercontent.com/uBlockOrigin/uAssets/master/filters/badlists.txt",

24 +

"assets/ublock/badlists.txt"

25 +

]

26 +

},

19 27

"ublock-filters": {

20 28

"content": "filters",

21 29

"group": "default",

Original file line number Diff line number Diff line change

@@ -171,6 +171,7 @@ const µBlock = (( ) => { // jshint ignore:line

171 171 172 172

selectedFilterLists: [],

173 173

availableFilterLists: {},

174 +

badLists: new Set(),

174 175 175 176

// https://github.com/uBlockOrigin/uBlock-issues/issues/974

176 177

// This can be used to defer filtering decision-making.

Original file line number Diff line number Diff line change

@@ -481,6 +481,15 @@ self.addEventListener('hiddenSettingsChanged', ( ) => {

481 481

let oldAvailableLists = {},

482 482

newAvailableLists = {};

483 483 484 +

if ( this.badLists.size === 0 ) {

485 +

const details = await this.assets.get('ublock-badlists');

486 +

this.badLists = new Set(

487 +

details.content.split(/\s*[\n\r]+\s*/).filter(a => {

488 +

return a !== '' && a.startsWith('#') === false;

489 +

})

490 +

);

491 +

}

492 + 484 493

// User filter list.

485 494

newAvailableLists[this.userFiltersPath] = {

486 495

group: 'user',

@@ -498,7 +507,7 @@ self.addEventListener('hiddenSettingsChanged', ( ) => {

498 507

external: true,

499 508

group: 'custom',

500 509

submitter: 'user',

501 -

title: ''

510 +

title: '',

502 511

};

503 512

newAvailableLists[listKey] = entry;

504 513

this.assets.registerAssetSource(listKey, entry);

@@ -705,7 +714,10 @@ self.addEventListener('hiddenSettingsChanged', ( ) => {

705 714

µBlock.getCompiledFilterList = async function(assetKey) {

706 715

const compiledPath = 'compiled/' + assetKey;

707 716 708 -

if ( this.compiledFormatChanged === false ) {

717 +

if (

718 +

this.compiledFormatChanged === false &&

719 +

this.badLists.has(assetKey) === false

720 +

) {

709 721

let compiledDetails = await this.assets.get(compiledPath);

710 722

if ( compiledDetails.content !== '' ) {

711 723

compiledDetails.assetKey = assetKey;

@@ -722,6 +734,11 @@ self.addEventListener('hiddenSettingsChanged', ( ) => {

722 734 723 735

this.extractFilterListMetadata(assetKey, rawDetails.content);

724 736 737 +

// Skip compiling bad lists.

738 +

if ( this.badLists.has(assetKey) ) {

739 +

return { assetKey, content: '' };

740 +

}

741 + 725 742

// Fetching the raw content may cause the compiled content to be

726 743

// generated somewhere else in uBO, hence we try one last time to

727 744

// fetch the compiled content in case it has become available.

@@ -1339,13 +1356,15 @@ self.addEventListener('hiddenSettingsChanged', ( ) => {

1339 1356

details.assetKey,

1340 1357

details.content

1341 1358

);

1342 -

this.assets.put(

1343 -

'compiled/' + details.assetKey,

1344 -

this.compileFilters(

1345 -

details.content,

1346 -

{ assetKey: details.assetKey }

1347 -

)

1348 -

);

1359 +

if ( this.badLists.has(details.assetKey) === false ) {

1360 +

this.assets.put(

1361 +

'compiled/' + details.assetKey,

1362 +

this.compileFilters(

1363 +

details.content,

1364 +

{ assetKey: details.assetKey }

1365 +

)

1366 +

);

1367 +

}

1349 1368

}

1350 1369

} else {

1351 1370

this.removeCompiledFilterList(details.assetKey);

@@ -1354,6 +1373,8 @@ self.addEventListener('hiddenSettingsChanged', ( ) => {

1354 1373

if ( cached ) {

1355 1374

this.compilePublicSuffixList(details.content);

1356 1375

}

1376 +

} else if ( details.assetKey === 'ublock-badlists' ) {

1377 +

this.badLists = new Set();

1357 1378

}

1358 1379

vAPI.messaging.broadcast({

1359 1380

what: 'assetUpdated',

You can’t perform that action at this time.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4