+20
-6
lines changedFilter options
+20
-6
lines changed Original file line number Diff line number Diff line change
@@ -191,7 +191,7 @@ export async function benchmarkStaticNetFiltering(options = {}) {
191
191
removeparamCount += 1;
192
192
}
193
193
}
194
-
if ( sfne.urlSkip(fctxt) ) {
194
+
if ( sfne.urlSkip(fctxt, false) ) {
195
195
urlskipCount += 1;
196
196
}
197
197
if ( fctxt.isDocument() ) {
@@ -210,7 +210,7 @@ export async function benchmarkStaticNetFiltering(options = {}) {
210
210
if ( sfne.redirectRequest(redirectEngine, fctxt) ) {
211
211
redirectCount += 1;
212
212
}
213
-
if ( fctxt.isRootDocument() && sfne.urlSkip(fctxt) ) {
213
+
if ( fctxt.isRootDocument() && sfne.urlSkip(fctxt, true) ) {
214
214
urlskipCount += 1;
215
215
}
216
216
}
Original file line number Diff line number Diff line change
@@ -943,7 +943,7 @@ const PageStore = class {
943
943
staticNetFilteringEngine.filterQuery(fctxt, directives);
944
944
}
945
945
if ( this.urlSkippableResources.has(fctxt.itype) ) {
946
-
staticNetFilteringEngine.urlSkip(fctxt, directives);
946
+
staticNetFilteringEngine.urlSkip(fctxt, false, directives);
947
947
}
948
948
if ( directives.length === 0 ) { return; }
949
949
if ( logger.enabled !== true ) { return; }
Original file line number Diff line number Diff line change
@@ -5405,6 +5405,9 @@ StaticNetFilteringEngine.prototype.transformRequest = function(fctxt, out = [])
5405
5405
*
5406
5406
* `-uricomponent`: decode the current string as a URI encoded string.
5407
5407
*
5408
+
* `-blocked`: allow the redirection of blocked requests. By default, blocked
5409
+
* requests can't by urlskip'ed.
5410
+
*
5408
5411
* At any given step, the currently extracted string may not necessarily be
5409
5412
* a valid URL, and more transformation steps may be needed to obtain a valid
5410
5413
* URL once all the steps are applied.
@@ -5423,7 +5426,11 @@ StaticNetFilteringEngine.prototype.transformRequest = function(fctxt, out = [])
5423
5426
*
5424
5427
* */
5425
5428
5426
-
StaticNetFilteringEngine.prototype.urlSkip = function(fctxt, out = []) {
5429
+
StaticNetFilteringEngine.prototype.urlSkip = function(
5430
+
fctxt,
5431
+
blocked,
5432
+
out = []
5433
+
) {
5427
5434
if ( fctxt.redirectURL !== undefined ) { return; }
5428
5435
const directives = this.matchAndFetchModifiers(fctxt, 'urlskip');
5429
5436
if ( directives === undefined ) { return; }
@@ -5435,7 +5442,7 @@ StaticNetFilteringEngine.prototype.urlSkip = function(fctxt, out = []) {
5435
5442
const urlin = fctxt.url;
5436
5443
const value = directive.value;
5437
5444
const steps = value.includes(' ') && value.split(/ +/) || [ value ];
5438
-
const urlout = urlSkip(directive, urlin, steps);
5445
+
const urlout = urlSkip(directive, urlin, blocked, steps);
5439
5446
if ( urlout === undefined ) { continue; }
5440
5447
if ( urlout === urlin ) { continue; }
5441
5448
fctxt.redirectURL = urlout;
@@ -5446,8 +5453,9 @@ StaticNetFilteringEngine.prototype.urlSkip = function(fctxt, out = []) {
5446
5453
return out;
5447
5454
};
5448
5455
5449
-
function urlSkip(directive, url, steps) {
5456
+
function urlSkip(directive, url, blocked, steps) {
5450
5457
try {
5458
+
let redirectBlocked = false;
5451
5459
let urlout = url;
5452
5460
for ( const step of steps ) {
5453
5461
const urlin = urlout;
@@ -5481,6 +5489,11 @@ function urlSkip(directive, url, steps) {
5481
5489
urlout = self.decodeURIComponent(urlin);
5482
5490
continue;
5483
5491
}
5492
+
// Enable skip of blocked requests
5493
+
if ( step === '-blocked' ) {
5494
+
redirectBlocked = true;
5495
+
continue;
5496
+
}
5484
5497
}
5485
5498
// Regex extraction from first capture group
5486
5499
if ( c0 === 0x2F ) { // /
@@ -5507,6 +5520,7 @@ function urlSkip(directive, url, steps) {
5507
5520
}
5508
5521
const urlfinal = new URL(urlout);
5509
5522
if ( urlfinal.protocol !== 'https:' ) { return; }
5523
+
if ( blocked && redirectBlocked !== true ) { return; }
5510
5524
return urlout;
5511
5525
} catch(x) {
5512
5526
}
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