Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 751ab0f9 authored by Guillaume Jacquart's avatar Guillaume Jacquart
Browse files

Merge branch '7084-whitelist_ms_sso' into 'main'

7084: remove microsoft SSO from trackers list.

See merge request !10
parents 7df9ef85 89628a69
Loading
Loading
Loading
Loading
Loading
+18 −6
Original line number Diff line number Diff line
@@ -3,6 +3,9 @@ const outputFile = "list/e_trackers.json"
const adawayUri = "https://adaway.org/hosts.txt"
const exodusUri = "https://reports.exodus-privacy.eu.org/api/trackers"

const whitelistedDomains = [
    "login.microsoftonline.com",
]

const https = require('https')
const fs = require('fs')
@@ -31,9 +34,6 @@ let trackers = []
console.log("Starting list update")

fetch(adawayUri)
//.then(response => {
//    return response.text()
//})
.then(text => {
    adawayText = text
    hostnames = parseHostToHostnames(text)
@@ -41,7 +41,6 @@ fetch(adawayUri)
}).then(toto => {
    return fetch(exodusUri)
})
//.then(response => { return response.json()})
.then(response => { return JSON.parse(response) })
.then(json => {
    exoduxJson = json
@@ -54,6 +53,9 @@ fetch(adawayUri)
    hostnames = enrichExodusWithAdaway(trackers, hostnames)
    console.log("enrich exodus OK")
    hostnames = createdLevel2Trackers(trackers, hostnames)
    console.log("define adaway trackers OK")
    removeWhitelistedHostnames(trackers)
    console.log("remove whitelisted hostnames OK")
    console.log("Trackers list finished")
})
.then(toto => {
@@ -93,7 +95,7 @@ function exodusToETrackers(exodusTrackers) {
    .map(tracker => {
        const id = "exodus_" + tracker.id
        const hostnames = tracker.network_signature
            .replaceAll("\\", "")
            .replace(/\\/g, "")
            .split("|")
        return {
            id: id,
@@ -157,6 +159,16 @@ function toLevel2Domain(hostname) {
    }
}

function removeWhitelistedHostnames(trackersList) {
   var emptyTrackersIndexes = []
   trackersList.forEach((tracker, index) => { 
   	tracker.hostnames = tracker.hostnames.filter(host => whitelistedDomains.indexOf(host) < 0)
   	if (tracker.hostnames.length == 0) {
            emptyTrackersIndexes.unshift(index)
        }    
   })
   emptyTrackersIndexes.forEach(index => trackersList.splice(index, 1))
}

function listHasNoChanges() {
    // Compare actual list with the builded one (without the createdAt field!)
+1 −1

File changed.

Preview size limit exceeded, changes collapsed.