A RetroSearch Logo

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

Search Query:

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

Fine tune hostname uncloaking through CNAME-lookup · gorhill/uBlock@a16e416 · GitHub

@@ -157,9 +157,12 @@ const regexFromURLFilteringResult = function(result) {

157 157 158 158

const nodeFromURL = function(parent, url, re) {

159 159

const fragment = document.createDocumentFragment();

160 -

if ( re instanceof RegExp === false ) {

160 +

if ( re === undefined ) {

161 161

fragment.textContent = url;

162 162

} else {

163 +

if ( typeof re === 'string' ) {

164 +

re = new RegExp(re.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'), 'g');

165 +

}

163 166

const matches = re.exec(url);

164 167

if ( matches === null || matches[0].length === 0 ) {

165 168

fragment.textContent = url;

@@ -211,6 +214,9 @@ const LogEntry = function(details) {

211 214

this[prop] = details[prop];

212 215

}

213 216

}

217 +

if ( details.aliasURL !== undefined ) {

218 +

this.aliased = true;

219 +

}

214 220

if ( this.tabDomain === '' ) {

215 221

this.tabDomain = this.tabHostname || '';

216 222

}

@@ -222,12 +228,13 @@ const LogEntry = function(details) {

222 228

}

223 229

};

224 230

LogEntry.prototype = {

225 -

cnameOf: '',

231 +

aliased: false,

226 232

dead: false,

227 233

docDomain: '',

228 234

docHostname: '',

229 235

domain: '',

230 236

filter: undefined,

237 +

id: '',

231 238

realm: '',

232 239

tabDomain: '',

233 240

tabHostname: '',

@@ -294,7 +301,7 @@ const processLoggerEntries = function(response) {

294 301

if ( autoDeleteVoidedRows ) { continue; }

295 302

parsed.voided = true;

296 303

}

297 -

if ( parsed.type === 'main_frame' && parsed.cnameOf === '' ) {

304 +

if ( parsed.type === 'main_frame' && parsed.aliased === false ) {

298 305

const separator = createLogSeparator(parsed, unboxed.url);

299 306

loggerEntries.unshift(separator);

300 307

if ( rowFilterer.filterOne(separator) ) {

@@ -304,7 +311,7 @@ const processLoggerEntries = function(response) {

304 311

}

305 312

}

306 313

}

307 -

if ( cnameOfEnabled === false && parsed.cnameOf !== '' ) {

314 +

if ( cnameOfEnabled === false && parsed.aliased ) {

308 315

uDom.nodeFromId('filterExprCnameOf').style.display = '';

309 316

cnameOfEnabled = true;

310 317

}

@@ -405,8 +412,10 @@ const parseLogEntry = function(details) {

405 412

textContent.push(normalizeToStr(details.url));

406 413 407 414

// Hidden cells -- useful for row-filtering purpose

408 -

if ( entry.cnameOf !== '' ) {

409 -

textContent.push(`cnameOf=${entry.cnameOf}`);

415 + 416 +

// Cell 7

417 +

if ( entry.aliased ) {

418 +

textContent.push(`aliasURL=${details.aliasURL}`);

410 419

}

411 420 412 421

entry.textContent = textContent.join('\t');

@@ -723,17 +732,20 @@ const viewPort = (( ) => {

723 732

span.textContent = cells[5];

724 733 725 734

// URL

726 -

let re = null;

735 +

let re;

727 736

if ( filteringType === 'static' ) {

728 737

re = new RegExp(filter.regex, 'gi');

729 738

} else if ( filteringType === 'dynamicUrl' ) {

730 739

re = regexFromURLFilteringResult(filter.rule.join(' '));

731 740

}

732 741

nodeFromURL(div.children[6], cells[6], re);

733 742 734 -

// Cname

735 -

if ( details.cnameOf !== '' ) {

736 -

div.setAttribute('data-cnameof', details.cnameOf);

743 +

// Alias URL (CNAME, etc.)

744 +

if ( cells.length > 7 ) {

745 +

const pos = details.textContent.lastIndexOf('\taliasURL=');

746 +

if ( pos !== -1 ) {

747 +

div.setAttribute('data-aliasid', details.id);

748 +

}

737 749

}

738 750 739 751

return div;

@@ -1452,6 +1464,16 @@ const reloadTab = function(ev) {

1452 1464

return targetRow.children[1].textContent;

1453 1465

};

1454 1466 1467 +

const aliasURLFromID = function(id) {

1468 +

if ( id === '' ) { return ''; }

1469 +

for ( const entry of loggerEntries ) {

1470 +

if ( entry.id !== id || entry.aliased ) { continue; }

1471 +

const fields = entry.textContent.split('\t');

1472 +

return fields[6] || '';

1473 +

}

1474 +

return '';

1475 +

};

1476 + 1455 1477

const toSummaryPaneFilterNode = async function(receiver, filter) {

1456 1478

receiver.children[1].textContent = filter;

1457 1479

if ( filterAuthorMode !== true ) { return; }

@@ -1613,8 +1635,8 @@ const reloadTab = function(ev) {

1613 1635

rows[6].style.display = 'none';

1614 1636

}

1615 1637

// URL

1616 -

text = trch[6].textContent;

1617 -

if ( text !== '' ) {

1638 +

const canonicalURL = trch[6].textContent;

1639 +

if ( canonicalURL !== '' ) {

1618 1640

const attr = tr.getAttribute('data-status') || '';

1619 1641

if ( attr !== '' ) {

1620 1642

rows[7].setAttribute('data-status', attr);

@@ -1623,12 +1645,17 @@ const reloadTab = function(ev) {

1623 1645

} else {

1624 1646

rows[7].style.display = 'none';

1625 1647

}

1626 -

// CNAME of

1627 -

text = tr.getAttribute('data-cnameof') || '';

1628 -

if ( text !== '' ) {

1629 -

rows[8].children[1].textContent = text;

1648 +

// Alias URL

1649 +

text = tr.getAttribute('data-aliasid');

1650 +

const aliasURL = text ? aliasURLFromID(text) : '';

1651 +

if ( aliasURL !== '' ) {

1652 +

rows[8].children[1].textContent =

1653 +

vAPI.hostnameFromURI(aliasURL) + ' \u21d2\n\u2003' +

1654 +

vAPI.hostnameFromURI(canonicalURL);

1655 +

rows[9].children[1].textContent = aliasURL;

1630 1656

} else {

1631 1657

rows[8].style.display = 'none';

1658 +

rows[9].style.display = 'none';

1632 1659

}

1633 1660

};

1634 1661

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