From 82af43039c78b49908151c09175a5161dd911601 Mon Sep 17 00:00:00 2001 From: Dimitry Kolyshev Date: Tue, 19 Apr 2022 16:07:57 +0300 Subject: [PATCH] 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 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 Date: Tue Apr 19 14:08:10 2022 +0200 whotracksme tracker links --- client/src/helpers/trackers/trackers.js | 19 ++++++++++++++++++- .../src/helpers/trackers/whotracksme_web.json | 6 ++++++ 2 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 client/src/helpers/trackers/whotracksme_web.json diff --git a/client/src/helpers/trackers/trackers.js b/client/src/helpers/trackers/trackers.js index 7af6dcb4..5327d18e 100644 --- a/client/src/helpers/trackers/trackers.js +++ b/client/src/helpers/trackers/trackers.js @@ -1,4 +1,5 @@ import whotracksmeDb from './whotracksme.json'; +import whotracksmeWebsites from './whotracksme_web.json'; import adguardDb from './adguard.json'; import { REPOSITORY } from '../constants'; @@ -20,6 +21,22 @@ export const sources = { 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 * @param {TrackerData} trackerData tracker data @@ -33,7 +50,7 @@ export const getSourceData = (trackerData) => { if (trackerData.source === sources.WHOTRACKSME) { return { name: 'Whotracks.me', - url: `https://whotracks.me/trackers/${trackerData.id}.html`, + url: getWhotracksmeUrl(trackerData.id), }; } if (trackerData.source === sources.ADGUARD) { diff --git a/client/src/helpers/trackers/whotracksme_web.json b/client/src/helpers/trackers/whotracksme_web.json new file mode 100644 index 00000000..8123fe1b --- /dev/null +++ b/client/src/helpers/trackers/whotracksme_web.json @@ -0,0 +1,6 @@ +{ + "timeUpdated": "2021-12-19T13:50:00.512Z", + "websites": { + "netflix": "netflix.com" + } +}