Pull request: whotracksme tracker links

Merge in DNS/adguard-home from 4416-ui-tracker-href to master

Squashed commit of the following:

commit 979ea82a3b4d2c2a895b81aacd613fb7e5bec586
Merge: 4fe6328b 12ee287d
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date:   Tue Apr 19 15:03:13 2022 +0200

    Merge remote-tracking branch 'origin/master' into 4416-ui-tracker-href

commit 4fe6328b276e697a2aa351c6543d2efe6d2dc2e1
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date:   Tue Apr 19 14:08:10 2022 +0200

    whotracksme tracker links
This commit is contained in:
Dimitry Kolyshev 2022-04-19 16:07:57 +03:00
parent 12ee287d0b
commit 82af43039c
2 changed files with 24 additions and 1 deletions

View File

@ -1,4 +1,5 @@
import whotracksmeDb from './whotracksme.json'; import whotracksmeDb from './whotracksme.json';
import whotracksmeWebsites from './whotracksme_web.json';
import adguardDb from './adguard.json'; import adguardDb from './adguard.json';
import { REPOSITORY } from '../constants'; import { REPOSITORY } from '../constants';
@ -20,6 +21,22 @@ export const sources = {
ADGUARD: 2, ADGUARD: 2,
}; };
/**
* Gets link to tracker page on whotracks.me.
*
* @param trackerId
* @return {string}
*/
const getWhotracksmeUrl = (trackerId) => {
const websiteId = whotracksmeWebsites.websites[trackerId];
if (websiteId) {
// Overrides links to websites.
return `https://whotracks.me/websites/${websiteId}.html`;
}
return `https://whotracks.me/trackers/${trackerId}.html`;
};
/** /**
* Gets the source metadata for the specified tracker * Gets the source metadata for the specified tracker
* @param {TrackerData} trackerData tracker data * @param {TrackerData} trackerData tracker data
@ -33,7 +50,7 @@ export const getSourceData = (trackerData) => {
if (trackerData.source === sources.WHOTRACKSME) { if (trackerData.source === sources.WHOTRACKSME) {
return { return {
name: 'Whotracks.me', name: 'Whotracks.me',
url: `https://whotracks.me/trackers/${trackerData.id}.html`, url: getWhotracksmeUrl(trackerData.id),
}; };
} }
if (trackerData.source === sources.ADGUARD) { if (trackerData.source === sources.ADGUARD) {

View File

@ -0,0 +1,6 @@
{
"timeUpdated": "2021-12-19T13:50:00.512Z",
"websites": {
"netflix": "netflix.com"
}
}