xiMatrix

filter net requests according to source, destination and type  https://addons.mozilla.org/firefox/addon/ximatrix/
git clone https://git.ce9e.org/xiMatrix.git

commit
ef4665ce0e8e537361cd1a29d5ab5848dad9599f
parent
4114fc00694b0cff0de40580623f6dccb3606792
Author
Tobias Bengfort <tobias.bengfort@posteo.de>
Date
2022-08-01 20:17
fix hostname sorting for first party subdomains

Diffstat

M src/popup.js 14 ++++++++++----

1 files changed, 10 insertions, 4 deletions


diff --git a/src/popup.js b/src/popup.js

@@ -32,12 +32,18 @@ var getHostnames = function() {
   32    32         addSubdomains(hostname);
   33    33     }
   34    34 
   -1    35     addSubdomains(context);
   -1    36 
   -1    37     var contextRoot = context.split('.').slice(-2).join('.');
   35    38     hostnames = hostnames
   36    -1         .map(h => h.split('.').reverse())
   -1    39         .map(h => {
   -1    40             var parts = h.split('.');
   -1    41             var root = parts.slice(-2).join('.');
   -1    42             var isContext = root === contextRoot ? 0 : 1;
   -1    43             return [isContext, parts.reverse()];
   -1    44         })
   37    45         .sort()
   38    -1         .map(h => h.reverse().join('.'));
   39    -1 
   40    -1     addSubdomains(context);
   -1    46         .map(a => a[1].reverse().join('.'));
   41    47 
   42    48     return hostnames.filter((value, i) => hostnames.indexOf(value) === i);
   43    49 };