+ client: Add choosing filter lists
Fix #1325 Squashed commit of the following: commit d8f7de72226855a961051e09b4b78f4dd71baadd Merge: f9bbe86136f3218bAuthor: Andrey Meshkov <am@adguard.com> Date: Mon Jul 6 19:34:53 2020 +0300 Merge branch 'master' into feature/1325 commit f9bbe861c9dbd631b5708f8eb073270b83a3f70f Merge: 99710fef4f8138bdAuthor: Andrey Meshkov <am@adguard.com> Date: Mon Jul 6 19:33:53 2020 +0300 Merge branch 'master' into feature/1325 commit 99710fef0825966b224e4a30a979e4d45f929af1 Merge: 8329326d a5380ead Author: ArtemBaskal <a.baskal@adguard.com> Date: Mon Jul 6 18:04:32 2020 +0300 Merge branch 'feature/1325' of ssh://bit.adguard.com:7999/dns/adguard-home into feature/1325 commit 8329326d6470dfcf2cdc4479e0290f7cc56ddca4 Author: ArtemBaskal <a.baskal@adguard.com> Date: Mon Jul 6 18:03:56 2020 +0300 Update locales, add title for select modal commit a5380ead56d15eba3f36c38f8fc0eedc89c2c57a Author: Andrey Meshkov <am@adguard.com> Date: Mon Jul 6 17:26:37 2020 +0300 Update readme commit dfe6e254d909ee6994cacef53d417bb073dfd802 Author: ArtemBaskal <a.baskal@adguard.com> Date: Mon Jul 6 13:44:19 2020 +0300 Change info icon width commit 06120cf3da9065fc9cc3a2864b976563d4cfe06a Author: ArtemBaskal <a.baskal@adguard.com> Date: Mon Jul 6 13:38:58 2020 +0300 Review changes commit ae3c6cacc5610a0f95bec2f6ef8a63e90041e4dd Merge: dd56a3bb73c5d9eaAuthor: ArtemBaskal <a.baskal@adguard.com> Date: Mon Jul 6 12:01:57 2020 +0300 Merge branch 'master' into feature/1325 commit dd56a3bbb851687823242fa653cc3bb63dedf5e4 Author: Andrey Meshkov <am@adguard.com> Date: Fri Jul 3 15:52:01 2020 +0300 Added blocklists commit f08f0eb0cdd8cd488d3a8f1182854b72775cf06e Merge: 854d4f8821dfb5ffAuthor: Andrey Meshkov <am@adguard.com> Date: Fri Jul 3 14:06:19 2020 +0300 Merge branch 'master' into feature/1325 commit 854d4f88017a33dc7f788835dc98591cec9b213f Merge: 239462662c47053cAuthor: ArtemBaskal <a.baskal@adguard.com> Date: Mon Jun 22 14:09:31 2020 +0300 Merge branch 'master' into feature/1325 commit 23946266d4913479bcecfcb7702a096983d20685 Author: ArtemBaskal <a.baskal@adguard.com> Date: Tue May 26 19:00:26 2020 +0300 Math filters by url commit 661e0482f01ffea0d0f5aa81b3b253143d0ca112 Author: ArtemBaskal <a.baskal@adguard.com> Date: Mon May 25 21:07:21 2020 +0300 Change data format commit ac4ff483b6b06ec0be49a41b5ddd3329f4ae2bbb Author: ArtemBaskal <a.baskal@adguard.com> Date: Thu May 14 19:52:45 2020 +0300 + client: Add choosing filter lists
This commit is contained in:
@@ -58,6 +58,7 @@ export const CHECK_TIMEOUT = 1000;
|
||||
export const SUCCESS_TOAST_TIMEOUT = 5000;
|
||||
export const FAILURE_TOAST_TIMEOUT = 30000;
|
||||
export const HIDE_TOOLTIP_DELAY = 300;
|
||||
export const MODAL_OPEN_TIMEOUT = 150;
|
||||
|
||||
export const UNSAFE_PORTS = [
|
||||
1,
|
||||
@@ -135,8 +136,10 @@ export const DHCP_STATUS_RESPONSE = {
|
||||
};
|
||||
|
||||
export const MODAL_TYPE = {
|
||||
ADD: 'add',
|
||||
EDIT: 'edit',
|
||||
SELECT_MODAL_TYPE: 'SELECT_MODAL_TYPE',
|
||||
ADD_FILTERS: 'ADD_FILTERS',
|
||||
EDIT_FILTERS: 'EDIT_FILTERS',
|
||||
CHOOSE_FILTERING_LIST: 'CHOOSE_FILTERING_LIST',
|
||||
};
|
||||
|
||||
export const CLIENT_ID = {
|
||||
|
||||
154
client/src/helpers/filters/filters.json
Normal file
154
client/src/helpers/filters/filters.json
Normal file
@@ -0,0 +1,154 @@
|
||||
{
|
||||
"categories": {
|
||||
"general": {
|
||||
"name": "filter_category_general",
|
||||
"description": "filter_category_general_desc"
|
||||
},
|
||||
"security": {
|
||||
"name": "filter_category_security",
|
||||
"description": "filter_category_security_desc"
|
||||
},
|
||||
"regional": {
|
||||
"name": "filter_category_regional",
|
||||
"description": "filter_category_regional_desc"
|
||||
},
|
||||
"other": {
|
||||
"name": "filter_category_other",
|
||||
"description": "filter_category_other_desc"
|
||||
}
|
||||
},
|
||||
"filters": {
|
||||
"adguard-dns-filter": {
|
||||
"name": "AdGuard DNS filter",
|
||||
"categoryId": "general",
|
||||
"homepage": "https://github.com/AdguardTeam/AdGuardSDNSFilter",
|
||||
"source": "https://adguardteam.github.io/AdGuardSDNSFilter/Filters/filter.txt"
|
||||
},
|
||||
"adaway-default-blocklist": {
|
||||
"name": "AdAway default blocklist",
|
||||
"categoryId": "general",
|
||||
"homepage": "https://github.com/AdAway/adaway.github.io/",
|
||||
"source": "https://raw.githubusercontent.com/AdAway/adaway.github.io/master/hosts.txt"
|
||||
},
|
||||
"peter-lowe-list": {
|
||||
"name": "Peter Lowe's List",
|
||||
"categoryId": "general",
|
||||
"homepage": "https://pgl.yoyo.org/adservers/",
|
||||
"source": "https://pgl.yoyo.org/adservers/serverlist.php?hostformat=adblockplus&showintro=1&mimetype=plaintext"
|
||||
},
|
||||
"dan-pollock-list": {
|
||||
"name": "Dan Pollock's List",
|
||||
"categoryId": "general",
|
||||
"homepage": "https://someonewhocares.org/",
|
||||
"source": "https://someonewhocares.org/hosts/zero/hosts"
|
||||
},
|
||||
"game-console-adblock-list": {
|
||||
"name": "Game Console Adblock List",
|
||||
"categoryId": "general",
|
||||
"homepage": "https://github.com/DandelionSprout/adfilt",
|
||||
"source": "https://raw.githubusercontent.com/DandelionSprout/adfilt/master/GameConsoleAdblockList.txt"
|
||||
},
|
||||
"perflyst-dandelion-sprout-smart-tv-blocklist-for-adguard-home": {
|
||||
"name": "Perflyst and Dandelion Sprout's Smart-TV Blocklist",
|
||||
"categoryId": "general",
|
||||
"homepage": "https://github.com/Perflyst/PiHoleBlocklist",
|
||||
"source": "https://raw.githubusercontent.com/Perflyst/PiHoleBlocklist/master/SmartTV-AGH.txt"
|
||||
},
|
||||
"malwaredomainlist-com-hosts-list": {
|
||||
"name": "MalwareDomainList.com Hosts List",
|
||||
"categoryId": "security",
|
||||
"homepage": "https://www.malwaredomainlist.com/",
|
||||
"source": "https://www.malwaredomainlist.com/hostslist/hosts.txt"
|
||||
},
|
||||
"spam404": {
|
||||
"name": "Spam404",
|
||||
"categoryId": "security",
|
||||
"homepage": "https://github.com/Spam404/lists",
|
||||
"source": "https://raw.githubusercontent.com/Spam404/lists/master/main-blacklist.txt"
|
||||
},
|
||||
"nocoin-filter-list": {
|
||||
"name": "NoCoin Filter List",
|
||||
"categoryId": "security",
|
||||
"homepage": "https://github.com/hoshsadiq/adblock-nocoin-list/",
|
||||
"source": "https://raw.githubusercontent.com/hoshsadiq/adblock-nocoin-list/master/nocoin.txt"
|
||||
},
|
||||
"the-big-list-of-hacked-malware-web-sites": {
|
||||
"name": "The Big List of Hacked Malware Web Sites",
|
||||
"categoryId": "security",
|
||||
"homepage": "https://github.com/hoshsadiq/adblock-nocoin-list/",
|
||||
"source": "https://raw.githubusercontent.com/mitchellkrogza/The-Big-List-of-Hacked-Malware-Web-Sites/master/hacked-domains.list"
|
||||
},
|
||||
"scam-blocklist-by-durable-napkin": {
|
||||
"name": "Scam Blocklist by DurableNapkin",
|
||||
"categoryId": "security",
|
||||
"homepage": "https://github.com/durablenapkin/scamblocklist",
|
||||
"source": "https://raw.githubusercontent.com/durablenapkin/scamblocklist/master/adguard.txt"
|
||||
},
|
||||
"NOR-dandelion-sprouts-nordiske-filtre": {
|
||||
"name": "NOR: Dandelion Sprouts nordiske filtre",
|
||||
"categoryId": "regional",
|
||||
"homepage": "https://github.com/DandelionSprout/adfilt",
|
||||
"source": "https://raw.githubusercontent.com/DandelionSprout/adfilt/master/NorwegianExperimentalList%20alternate%20versions/NordicFiltersAdGuardHome.txt"
|
||||
},
|
||||
"TUR-nurcan-turk-ad-list": {
|
||||
"name": "TUR: nurcan Türk ad-list",
|
||||
"categoryId": "regional",
|
||||
"homepage": "https://github.com/DandelionSprout/adfilt",
|
||||
"source": "https://raw.githubusercontent.com/xorcan/hosts/master/xhosts.txt"
|
||||
},
|
||||
"POL-polish-filters-for-pihole": {
|
||||
"name": "POL: Polish filters for Pi hole",
|
||||
"categoryId": "regional",
|
||||
"homepage": "https://www.certyficate.it/",
|
||||
"source": "https://raw.githubusercontent.com/MajkiIT/polish-ads-filter/master/polish-pihole-filters/hostfile.txt"
|
||||
},
|
||||
"KOR-youslist": {
|
||||
"name": "KOR: YousList",
|
||||
"categoryId": "regional",
|
||||
"homepage": "https://github.com/yous/YousList",
|
||||
"source": "https://raw.githubusercontent.com/yous/YousList/master/hosts.txt"
|
||||
},
|
||||
"VNM-abpvn-list": {
|
||||
"name": "VNM: ABPVN List",
|
||||
"categoryId": "regional",
|
||||
"homepage": "http://abpvn.com/",
|
||||
"source": "https://abpvn.com/android/abpvn.txt"
|
||||
},
|
||||
"SWE-frellwit-swedish-hosts-file": {
|
||||
"name": "SWE: Frellwit's Swedish Hosts File",
|
||||
"categoryId": "regional",
|
||||
"homepage": "https://github.com/lassekongo83/Frellwits-filter-lists/",
|
||||
"source": "https://raw.githubusercontent.com/lassekongo83/Frellwits-filter-lists/master/Frellwits-Swedish-Hosts-File.txt"
|
||||
},
|
||||
"ITA-filtri-dns": {
|
||||
"name": "ITA: Filtri-DNS",
|
||||
"categoryId": "regional",
|
||||
"homepage": "https://filtri-dns.ga/",
|
||||
"source": "https://filtri-dns.ga/filtri.txt"
|
||||
},
|
||||
"JPN-280blocker": {
|
||||
"name": "JPN: 280blocker adblock domain lists",
|
||||
"categoryId": "regional",
|
||||
"homepage": "https://280blocker.net/",
|
||||
"source": "https://280blocker.net/files/280blocker_domain.txt"
|
||||
},
|
||||
"IRN-unwanted-iranian-domains": {
|
||||
"name": "IRN: Unwanted Iranian domains",
|
||||
"categoryId": "regional",
|
||||
"homepage": "https://github.com/DRSDavidSoft/additional-hosts",
|
||||
"source": "https://raw.githubusercontent.com/DRSDavidSoft/additional-hosts/master/domains/blacklist/unwanted-iranian.txt"
|
||||
},
|
||||
"MKD-macedonian-pi-hole-blocklist": {
|
||||
"name": "MKD: Macedonian Pi-hole Blocklist",
|
||||
"categoryId": "regional",
|
||||
"homepage": "https://github.com/cchevy/macedonian-pi-hole-blocklist",
|
||||
"source": "https://raw.githubusercontent.com/cchevy/macedonian-pi-hole-blocklist/master/hosts.txt"
|
||||
},
|
||||
"BarbBlock": {
|
||||
"name": "BarbBlock",
|
||||
"categoryId": "other",
|
||||
"homepage": "https://ssl.bblck.me/",
|
||||
"source": "https://ssl.bblck.me/blacklists/ublock-origin.txt"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -158,25 +158,28 @@ export const renderSelectField = ({
|
||||
disabled,
|
||||
onClick,
|
||||
modifier = 'checkbox--form',
|
||||
checked,
|
||||
meta: { touched, error },
|
||||
}) => <Fragment>
|
||||
}) => <>
|
||||
<label className={`checkbox ${modifier}`} onClick={onClick}>
|
||||
<span className="checkbox__marker" />
|
||||
<input {...input} type="checkbox" className="checkbox__input" disabled={disabled} />
|
||||
<input {...input} type="checkbox" className="checkbox__input" disabled={disabled} checked={input.checked || checked}/>
|
||||
<span className="checkbox__label">
|
||||
<span className="checkbox__label-text checkbox__label-text--long">
|
||||
<span className="checkbox__label-title">{placeholder}</span>
|
||||
{subtitle && <span
|
||||
className="checkbox__label-subtitle"
|
||||
dangerouslySetInnerHTML={{ __html: subtitle }}
|
||||
/>}
|
||||
<span className="checkbox__label-text checkbox__label-text--long">
|
||||
<span className="checkbox__label-title">{placeholder}</span>
|
||||
{subtitle
|
||||
&& <span
|
||||
className="checkbox__label-subtitle"
|
||||
dangerouslySetInnerHTML={{ __html: subtitle }}
|
||||
|
||||
/>}
|
||||
</span>
|
||||
</span>
|
||||
</span>
|
||||
</label>
|
||||
{!disabled
|
||||
&& touched
|
||||
&& error && <span className="form__message form__message--error">{error}</span>}
|
||||
</Fragment>;
|
||||
</>;
|
||||
|
||||
renderSelectField.propTypes = {
|
||||
input: PropTypes.object.isRequired,
|
||||
@@ -185,6 +188,7 @@ renderSelectField.propTypes = {
|
||||
disabled: PropTypes.bool,
|
||||
onClick: PropTypes.func,
|
||||
modifier: PropTypes.string,
|
||||
checked: PropTypes.bool,
|
||||
meta: PropTypes.shape({
|
||||
touched: PropTypes.bool,
|
||||
error: PropTypes.object,
|
||||
|
||||
@@ -501,8 +501,8 @@ export const getCurrentFilter = (url, filters) => {
|
||||
};
|
||||
|
||||
/**
|
||||
* @param initialValues {object}
|
||||
* @param values {object}
|
||||
* @param {object} initialValues
|
||||
* @param {object} values
|
||||
* @returns {object} Returns different values of objects
|
||||
*/
|
||||
export const getObjDiff = (initialValues, values) => Object.entries(values)
|
||||
@@ -522,6 +522,17 @@ export const formatNumber = (num) => {
|
||||
return num.toLocaleString(currentLanguage);
|
||||
};
|
||||
|
||||
/**
|
||||
* @param arr {array}
|
||||
* @param key {string}
|
||||
* @param value {string}
|
||||
* @returns {object}
|
||||
*/
|
||||
export const getMap = (arr, key, value) => arr.reduce((acc, curr) => {
|
||||
acc[curr[key]] = curr[value];
|
||||
return acc;
|
||||
}, {});
|
||||
|
||||
export const normalizeMultiline = (multiline) => `${normalizeTextarea(multiline)
|
||||
.map((line) => line.trim())
|
||||
.join('\n')}\n`;
|
||||
|
||||
Reference in New Issue
Block a user