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" + } +}