all: sync with master; upd chlog
This commit is contained in:
@@ -53,7 +53,7 @@ export const STATUS_COLORS = {
|
||||
export const REPOSITORY = {
|
||||
URL: 'https://github.com/AdguardTeam/AdGuardHome',
|
||||
TRACKERS_DB:
|
||||
'https://github.com/AdguardTeam/AdGuardHome/tree/master/client/src/helpers/trackers/adguard.json',
|
||||
'https://github.com/AdguardTeam/AdGuardHome/tree/master/client/src/helpers/trackers/trackers.json',
|
||||
ISSUES: 'https://github.com/AdguardTeam/AdGuardHome/issues/new/choose',
|
||||
};
|
||||
|
||||
|
||||
@@ -160,12 +160,6 @@ export default {
|
||||
"homepage": "https://github.com/DandelionSprout/adfilt",
|
||||
"source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_6.txt"
|
||||
},
|
||||
"energized_spark": {
|
||||
"name": "Energized Spark",
|
||||
"categoryId": "general",
|
||||
"homepage": "https://energized.pro/",
|
||||
"source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_28.txt"
|
||||
},
|
||||
"hagezi_personal": {
|
||||
"name": "HaGeZi Personal Black \u0026 White",
|
||||
"categoryId": "general",
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import whotracksmeDb from './whotracksme.json';
|
||||
import whotracksmeWebsites from './whotracksme_web.json';
|
||||
import adguardDb from './adguard.json';
|
||||
import trackersDb from './trackers.json';
|
||||
import { REPOSITORY } from '../constants';
|
||||
|
||||
/**
|
||||
@@ -39,6 +38,7 @@ const getWhotracksmeUrl = (trackerId) => {
|
||||
|
||||
/**
|
||||
* Gets the source metadata for the specified tracker
|
||||
*
|
||||
* @param {TrackerData} trackerData tracker data
|
||||
* @returns {source} source metadata or null if no matching tracker found
|
||||
*/
|
||||
@@ -64,14 +64,26 @@ export const getSourceData = (trackerData) => {
|
||||
};
|
||||
|
||||
/**
|
||||
* Gets tracker data in the specified database
|
||||
* Converts the JSON string source into numeric source for AdGuard Home
|
||||
*
|
||||
* @param {TrackerData} trackerData tracker data
|
||||
* @returns {number} source number
|
||||
*/
|
||||
const convertSource = (sourceStr) => {
|
||||
if (!sourceStr || sourceStr !== 'AdGuard') {
|
||||
return sources.WHOTRACKSME;
|
||||
}
|
||||
|
||||
return sources.ADGUARD;
|
||||
};
|
||||
|
||||
/**
|
||||
* Gets tracker data from the trackers database
|
||||
*
|
||||
* @param {String} domainName domain name to check
|
||||
* @param {*} trackersDb trackers database
|
||||
* @param {number} source source ID
|
||||
* @returns {TrackerData} tracker data or null if no matching tracker found
|
||||
*/
|
||||
const getTrackerDataFromDb = (domainName, trackersDb, source) => {
|
||||
export const getTrackerData = (domainName) => {
|
||||
if (!domainName) {
|
||||
return null;
|
||||
}
|
||||
@@ -88,7 +100,7 @@ const getTrackerDataFromDb = (domainName, trackersDb, source) => {
|
||||
if (trackerId) {
|
||||
const trackerData = trackersDb.trackers[trackerId];
|
||||
const categoryName = trackersDb.categories[trackerData.categoryId];
|
||||
trackerData.source = source;
|
||||
const source = convertSource(trackerData.source);
|
||||
const sourceData = getSourceData(trackerData);
|
||||
|
||||
return {
|
||||
@@ -105,22 +117,3 @@ const getTrackerDataFromDb = (domainName, trackersDb, source) => {
|
||||
// No tracker found for the specified domain
|
||||
return null;
|
||||
};
|
||||
|
||||
/**
|
||||
* Gets tracker data from the trackers database
|
||||
*
|
||||
* @param {String} domainName domain name to check
|
||||
* @returns {TrackerData} tracker data or null if no matching tracker found
|
||||
*/
|
||||
export const getTrackerData = (domainName) => {
|
||||
if (!domainName) {
|
||||
return null;
|
||||
}
|
||||
|
||||
let data = getTrackerDataFromDb(domainName, adguardDb, sources.ADGUARD);
|
||||
if (!data) {
|
||||
data = getTrackerDataFromDb(domainName, whotracksmeDb, sources.WHOTRACKSME);
|
||||
}
|
||||
|
||||
return data;
|
||||
};
|
||||
|
||||
23750
client/src/helpers/trackers/trackers.json
Normal file
23750
client/src/helpers/trackers/trackers.json
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user