mirror of
https://github.com/AdguardTeam/AdGuardHome.git
synced 2024-11-29 10:28:53 +03:00
Merge: + client: handle rewrite auto
Closes #1478 * commit 'c7f8f20aada3e339b82434fab3d1b02c52bdd4e1': + client: handle rewrite auto
This commit is contained in:
commit
fc03ca4bb8
5 changed files with 29 additions and 3 deletions
|
@ -386,7 +386,8 @@
|
||||||
"rewrite_not_found": "No DNS rewrites found",
|
"rewrite_not_found": "No DNS rewrites found",
|
||||||
"rewrite_confirm_delete": "Are you sure you want to delete DNS rewrite for \"{{key}}\"?",
|
"rewrite_confirm_delete": "Are you sure you want to delete DNS rewrite for \"{{key}}\"?",
|
||||||
"rewrite_desc": "Allows to easily configure custom DNS response for a specific domain name.",
|
"rewrite_desc": "Allows to easily configure custom DNS response for a specific domain name.",
|
||||||
"rewrite_applied": "Applied Rewrite rule",
|
"rewrite_applied": "Rewrite rule is applied",
|
||||||
|
"rewrite_hosts_applied": "Rewritten by the hosts file rule",
|
||||||
"dns_rewrites": "DNS rewrites",
|
"dns_rewrites": "DNS rewrites",
|
||||||
"form_domain": "Enter domain name or wildcard",
|
"form_domain": "Enter domain name or wildcard",
|
||||||
"form_answer": "Enter IP address or domain name",
|
"form_answer": "Enter IP address or domain name",
|
||||||
|
|
|
@ -5,6 +5,7 @@ import { withNamespaces } from 'react-i18next';
|
||||||
import {
|
import {
|
||||||
checkFiltered,
|
checkFiltered,
|
||||||
checkRewrite,
|
checkRewrite,
|
||||||
|
checkRewriteHosts,
|
||||||
checkBlackList,
|
checkBlackList,
|
||||||
checkNotFilteredNotFound,
|
checkNotFilteredNotFound,
|
||||||
checkWhiteList,
|
checkWhiteList,
|
||||||
|
@ -38,6 +39,10 @@ const getTitle = (reason, filterName, t, onlyFiltered) => {
|
||||||
return t('rewrite_applied');
|
return t('rewrite_applied');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (checkRewriteHosts(reason)) {
|
||||||
|
return t('rewrite_hosts_applied');
|
||||||
|
}
|
||||||
|
|
||||||
if (checkBlackList(reason)) {
|
if (checkBlackList(reason)) {
|
||||||
return filterName;
|
return filterName;
|
||||||
}
|
}
|
||||||
|
@ -75,7 +80,7 @@ const getTitle = (reason, filterName, t, onlyFiltered) => {
|
||||||
const getColor = (reason) => {
|
const getColor = (reason) => {
|
||||||
if (checkFiltered(reason)) {
|
if (checkFiltered(reason)) {
|
||||||
return 'red';
|
return 'red';
|
||||||
} else if (checkRewrite(reason)) {
|
} else if (checkRewrite(reason) || checkRewriteHosts(reason)) {
|
||||||
return 'blue';
|
return 'blue';
|
||||||
} else if (checkWhiteList(reason)) {
|
} else if (checkWhiteList(reason)) {
|
||||||
return 'green';
|
return 'green';
|
||||||
|
|
|
@ -12,6 +12,7 @@ import {
|
||||||
isToday,
|
isToday,
|
||||||
checkFiltered,
|
checkFiltered,
|
||||||
checkRewrite,
|
checkRewrite,
|
||||||
|
checkRewriteHosts,
|
||||||
checkWhiteList,
|
checkWhiteList,
|
||||||
checkBlackList,
|
checkBlackList,
|
||||||
checkBlockedService,
|
checkBlockedService,
|
||||||
|
@ -170,6 +171,7 @@ class Logs extends Component {
|
||||||
const isFiltered = checkFiltered(reason);
|
const isFiltered = checkFiltered(reason);
|
||||||
const isBlackList = checkBlackList(reason);
|
const isBlackList = checkBlackList(reason);
|
||||||
const isRewrite = checkRewrite(reason);
|
const isRewrite = checkRewrite(reason);
|
||||||
|
const isRewriteAuto = checkRewriteHosts(reason);
|
||||||
const isWhiteList = checkWhiteList(reason);
|
const isWhiteList = checkWhiteList(reason);
|
||||||
const isBlockedService = checkBlockedService(reason);
|
const isBlockedService = checkBlockedService(reason);
|
||||||
const isBlockedCnameIp = originalAnswer;
|
const isBlockedCnameIp = originalAnswer;
|
||||||
|
@ -221,6 +223,13 @@ class Logs extends Component {
|
||||||
<Trans>rewrite_applied</Trans>
|
<Trans>rewrite_applied</Trans>
|
||||||
</strong>
|
</strong>
|
||||||
)}
|
)}
|
||||||
|
{isRewriteAuto && (
|
||||||
|
<span className="logs__text">
|
||||||
|
<strong>
|
||||||
|
<Trans>rewrite_hosts_applied</Trans>
|
||||||
|
</strong>
|
||||||
|
</span>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
<div className="logs__list-wrap">
|
<div className="logs__list-wrap">
|
||||||
{this.renderResponseList(responses, status)}
|
{this.renderResponseList(responses, status)}
|
||||||
|
@ -236,6 +245,15 @@ class Logs extends Component {
|
||||||
const { reason, domain } = original;
|
const { reason, domain } = original;
|
||||||
const isFiltered = checkFiltered(reason);
|
const isFiltered = checkFiltered(reason);
|
||||||
const isRewrite = checkRewrite(reason);
|
const isRewrite = checkRewrite(reason);
|
||||||
|
const isAutoRewrite = checkRewriteHosts(reason);
|
||||||
|
|
||||||
|
if (isAutoRewrite) {
|
||||||
|
return (
|
||||||
|
<div className="logs__row logs__row--overflow logs__row--column">
|
||||||
|
{formatClientCell(row, t)}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Fragment>
|
<Fragment>
|
||||||
|
@ -364,7 +382,7 @@ class Logs extends Component {
|
||||||
return {
|
return {
|
||||||
className: 'green',
|
className: 'green',
|
||||||
};
|
};
|
||||||
} else if (checkRewrite(reason)) {
|
} else if (checkRewrite(reason) || checkRewriteHosts(reason)) {
|
||||||
return {
|
return {
|
||||||
className: 'blue',
|
className: 'blue',
|
||||||
};
|
};
|
||||||
|
|
|
@ -257,6 +257,7 @@ export const FILTERED_STATUS = {
|
||||||
NOT_FILTERED_NOT_FOUND: 'NotFilteredNotFound',
|
NOT_FILTERED_NOT_FOUND: 'NotFilteredNotFound',
|
||||||
FILTERED_BLOCKED_SERVICE: 'FilteredBlockedService',
|
FILTERED_BLOCKED_SERVICE: 'FilteredBlockedService',
|
||||||
REWRITE: 'Rewrite',
|
REWRITE: 'Rewrite',
|
||||||
|
REWRITE_HOSTS: 'RewriteEtcHosts',
|
||||||
FILTERED_SAFE_SEARCH: 'FilteredSafeSearch',
|
FILTERED_SAFE_SEARCH: 'FilteredSafeSearch',
|
||||||
FILTERED_SAFE_BROWSING: 'FilteredSafeBrowsing',
|
FILTERED_SAFE_BROWSING: 'FilteredSafeBrowsing',
|
||||||
FILTERED_PARENTAL: 'FilteredParental',
|
FILTERED_PARENTAL: 'FilteredParental',
|
||||||
|
|
|
@ -431,6 +431,7 @@ export const createOnBlurHandler = (event, input, normalizeOnBlur) => (
|
||||||
|
|
||||||
export const checkFiltered = reason => reason.indexOf(FILTERED) === 0;
|
export const checkFiltered = reason => reason.indexOf(FILTERED) === 0;
|
||||||
export const checkRewrite = reason => reason === FILTERED_STATUS.REWRITE;
|
export const checkRewrite = reason => reason === FILTERED_STATUS.REWRITE;
|
||||||
|
export const checkRewriteHosts = reason => reason === FILTERED_STATUS.REWRITE_HOSTS;
|
||||||
export const checkBlackList = reason => reason === FILTERED_STATUS.FILTERED_BLACK_LIST;
|
export const checkBlackList = reason => reason === FILTERED_STATUS.FILTERED_BLACK_LIST;
|
||||||
export const checkWhiteList = reason => reason === FILTERED_STATUS.NOT_FILTERED_WHITE_LIST;
|
export const checkWhiteList = reason => reason === FILTERED_STATUS.NOT_FILTERED_WHITE_LIST;
|
||||||
export const checkNotFilteredNotFound = reason => reason === FILTERED_STATUS.NOT_FILTERED_NOT_FOUND;
|
export const checkNotFilteredNotFound = reason => reason === FILTERED_STATUS.NOT_FILTERED_NOT_FOUND;
|
||||||
|
|
Loading…
Reference in a new issue