docstring_tokens stringlengths 0 76.5k | code_tokens stringlengths 75 1.81M | label_window listlengths 4 2.12k | html_url stringlengths 74 116 | file_name stringlengths 3 311 |
|---|---|---|---|---|
<mask> try {
<mask> const {
<mask> allowed_clients, disallowed_clients, blocked_hosts,
<mask> } = await apiClient.getAccessList();
<mask> let updatedDisallowedClients = disallowed_clients || [];
<mask>
<mask> if (type === BLOCK_ACTIONS.UNBLOCK && updatedDisallowedClients.includes(ip)) {
<mask> updatedDisallowedClients = updatedDisallowedClients.filter((client) => client !== ip);
<mask> } else if (type === BLOCK_ACTIONS.BLOCK && !updatedDisallowedClients.includes(ip)) {
<mask> updatedDisallowedClients.push(ip);
</s> + client: Move the client access check to the server-side
Squashed commit of the following:
commit 1aab0f62e94ce665a1b996552fac41dc4e769b4d
Merge: cdf5eb6e c1f5fdae
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 24 15:36:05 2020 +0300
Merge branch '1920-client-find' into feature/1925
commit cdf5eb6ea67a665d21a3155d8cf89bba9a5a9948
Merge: b6c20b1c 10f67bd3
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 23 20:28:51 2020 +0300
Merge branch 'master' into feature/1925
commit b6c20b1c7359a0e5902405b0551712f936848a80
Merge: 97d388ef 96512433
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 15 10:44:25 2020 +0300
Merge branch 'master' into feature/1925
commit 97d388ef6571d590f21da00f86d889e881ca0c3d
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 15 10:30:50 2020 +0300
Extract buttons
commit ca45fde11fc2b2812ff2b84dbd67aff0b5341be1
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 10 12:46:09 2020 +0300
Handle errors in updateLogs
commit f15e03c2e5a7115db984f70f72b0ddd870ece73d
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 10 12:39:34 2020 +0300
Update mobile block status on click
commit 033b28db3b324f6d529ac1a0ef657886cdbe02bd
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 20:53:42 2020 +0300
Fix mobile block buttons, auto open page on web serve start
commit 2730937b23309167a066b9154728ac53ffe81a49
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 13:58:37 2020 +0300
Disable allow this client button when isNotInAllowedList is true
commit 818cf869d63654c184762ad2701c4429a3e3011e
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 13:06:01 2020 +0300
Update client block state on option click
commit a072b8983757f419645c0207ea78e6e867c440cb
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 20:17:16 2020 +0300
Adapt to api changes
commit 28ab2bd8b3f14f60bc822b5a69fa1801db67d816
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 14:12:20 2020 +0300
Change query log block confirm messages
commit 9b0b6f6f9b1ec168fa71dbedd036152da59006e3
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 12:00:46 2020 +0300
Refactor inner work with disallowed
commit 05f76154b8f489738d032fdaa835edb371ce70c7
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Mon Sep 7 16:11:37 2020 +0300
+ client: Move the client access check to the server-side </s> remove if (type === BLOCK_ACTIONS.UNBLOCK && updatedDisallowedClients.includes(ip)) {
updatedDisallowedClients = updatedDisallowedClients.filter((client) => client !== ip);
} else if (type === BLOCK_ACTIONS.BLOCK && !updatedDisallowedClients.includes(ip)) {
updatedDisallowedClients.push(ip);
}
</s> add const updatedDisallowedClients = disallowed
? disallowed_clients.filter((client) => client !== disallowed_rule)
: disallowed_clients.concat(ip); </s> remove allowed_clients, disallowed_clients, blocked_hosts,
</s> add allowed_clients, blocked_hosts, disallowed_clients = [], </s> remove export const toggleClientBlock = (type, ip) => async (dispatch) => {
</s> add export const toggleClientBlock = (ip, disallowed, disallowed_rule) => async (dispatch) => { </s> remove if (type === BLOCK_ACTIONS.UNBLOCK) {
dispatch(addSuccessToast(i18next.t('client_unblocked', { ip })));
} else if (type === BLOCK_ACTIONS.BLOCK) {
</s> add if (disallowed) {
dispatch(addSuccessToast(i18next.t('client_unblocked', { ip: disallowed_rule })));
} else { </s> remove const onBlockingClientClick = () => {
const message = `${blockType === BLOCK_ACTIONS.BLOCK ? t('adg_will_drop_dns_queries') : ''} ${t(confirmMessage, { ip: client })}`;
if (window.confirm(message)) {
dispatch(toggleClientBlock(blockType, client));
</s> add const onBlockingClientClick = async () => {
if (window.confirm(confirmMessage)) {
await dispatch(toggleClientBlock(client, disallowed, disallowed_rule));
await dispatch(updateLogs());
setModalOpened(false); | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/c72cd58f69b71e4981d8b182b2f7d53ea5e30868 | client/src/actions/access.js | |
const updatedDisallowedClients = disallowed
? disallowed_clients.filter((client) => client !== disallowed_rule)
: disallowed_clients.concat(ip); | <mask> allowed_clients, disallowed_clients, blocked_hosts,
<mask> } = await apiClient.getAccessList();
<mask> let updatedDisallowedClients = disallowed_clients || [];
<mask>
<mask> if (type === BLOCK_ACTIONS.UNBLOCK && updatedDisallowedClients.includes(ip)) {
<mask> updatedDisallowedClients = updatedDisallowedClients.filter((client) => client !== ip);
<mask> } else if (type === BLOCK_ACTIONS.BLOCK && !updatedDisallowedClients.includes(ip)) {
<mask> updatedDisallowedClients.push(ip);
<mask> }
<mask>
<mask> const values = {
<mask> allowed_clients,
<mask> blocked_hosts,
<mask> disallowed_clients: updatedDisallowedClients,
</s> + client: Move the client access check to the server-side
Squashed commit of the following:
commit 1aab0f62e94ce665a1b996552fac41dc4e769b4d
Merge: cdf5eb6e c1f5fdae
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 24 15:36:05 2020 +0300
Merge branch '1920-client-find' into feature/1925
commit cdf5eb6ea67a665d21a3155d8cf89bba9a5a9948
Merge: b6c20b1c 10f67bd3
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 23 20:28:51 2020 +0300
Merge branch 'master' into feature/1925
commit b6c20b1c7359a0e5902405b0551712f936848a80
Merge: 97d388ef 96512433
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 15 10:44:25 2020 +0300
Merge branch 'master' into feature/1925
commit 97d388ef6571d590f21da00f86d889e881ca0c3d
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 15 10:30:50 2020 +0300
Extract buttons
commit ca45fde11fc2b2812ff2b84dbd67aff0b5341be1
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 10 12:46:09 2020 +0300
Handle errors in updateLogs
commit f15e03c2e5a7115db984f70f72b0ddd870ece73d
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 10 12:39:34 2020 +0300
Update mobile block status on click
commit 033b28db3b324f6d529ac1a0ef657886cdbe02bd
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 20:53:42 2020 +0300
Fix mobile block buttons, auto open page on web serve start
commit 2730937b23309167a066b9154728ac53ffe81a49
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 13:58:37 2020 +0300
Disable allow this client button when isNotInAllowedList is true
commit 818cf869d63654c184762ad2701c4429a3e3011e
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 13:06:01 2020 +0300
Update client block state on option click
commit a072b8983757f419645c0207ea78e6e867c440cb
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 20:17:16 2020 +0300
Adapt to api changes
commit 28ab2bd8b3f14f60bc822b5a69fa1801db67d816
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 14:12:20 2020 +0300
Change query log block confirm messages
commit 9b0b6f6f9b1ec168fa71dbedd036152da59006e3
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 12:00:46 2020 +0300
Refactor inner work with disallowed
commit 05f76154b8f489738d032fdaa835edb371ce70c7
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Mon Sep 7 16:11:37 2020 +0300
+ client: Move the client access check to the server-side </s> remove let updatedDisallowedClients = disallowed_clients || [];
</s> add </s> remove allowed_clients, disallowed_clients, blocked_hosts,
</s> add allowed_clients, blocked_hosts, disallowed_clients = [], </s> remove export const toggleClientBlock = (type, ip) => async (dispatch) => {
</s> add export const toggleClientBlock = (ip, disallowed, disallowed_rule) => async (dispatch) => { </s> remove if (type === BLOCK_ACTIONS.UNBLOCK) {
dispatch(addSuccessToast(i18next.t('client_unblocked', { ip })));
} else if (type === BLOCK_ACTIONS.BLOCK) {
</s> add if (disallowed) {
dispatch(addSuccessToast(i18next.t('client_unblocked', { ip: disallowed_rule })));
} else { </s> remove const onBlockingClientClick = () => {
const message = `${blockType === BLOCK_ACTIONS.BLOCK ? t('adg_will_drop_dns_queries') : ''} ${t(confirmMessage, { ip: client })}`;
if (window.confirm(message)) {
dispatch(toggleClientBlock(blockType, client));
</s> add const onBlockingClientClick = async () => {
if (window.confirm(confirmMessage)) {
await dispatch(toggleClientBlock(client, disallowed, disallowed_rule));
await dispatch(updateLogs());
setModalOpened(false); | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/c72cd58f69b71e4981d8b182b2f7d53ea5e30868 | client/src/actions/access.js |
if (disallowed) {
dispatch(addSuccessToast(i18next.t('client_unblocked', { ip: disallowed_rule })));
} else { | <mask>
<mask> await apiClient.setAccessList(values);
<mask> dispatch(toggleClientBlockSuccess(values));
<mask>
<mask> if (type === BLOCK_ACTIONS.UNBLOCK) {
<mask> dispatch(addSuccessToast(i18next.t('client_unblocked', { ip })));
<mask> } else if (type === BLOCK_ACTIONS.BLOCK) {
<mask> dispatch(addSuccessToast(i18next.t('client_blocked', { ip })));
<mask> }
<mask> } catch (error) {
<mask> dispatch(addErrorToast({ error }));
<mask> dispatch(toggleClientBlockFailure());
</s> + client: Move the client access check to the server-side
Squashed commit of the following:
commit 1aab0f62e94ce665a1b996552fac41dc4e769b4d
Merge: cdf5eb6e c1f5fdae
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 24 15:36:05 2020 +0300
Merge branch '1920-client-find' into feature/1925
commit cdf5eb6ea67a665d21a3155d8cf89bba9a5a9948
Merge: b6c20b1c 10f67bd3
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 23 20:28:51 2020 +0300
Merge branch 'master' into feature/1925
commit b6c20b1c7359a0e5902405b0551712f936848a80
Merge: 97d388ef 96512433
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 15 10:44:25 2020 +0300
Merge branch 'master' into feature/1925
commit 97d388ef6571d590f21da00f86d889e881ca0c3d
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 15 10:30:50 2020 +0300
Extract buttons
commit ca45fde11fc2b2812ff2b84dbd67aff0b5341be1
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 10 12:46:09 2020 +0300
Handle errors in updateLogs
commit f15e03c2e5a7115db984f70f72b0ddd870ece73d
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 10 12:39:34 2020 +0300
Update mobile block status on click
commit 033b28db3b324f6d529ac1a0ef657886cdbe02bd
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 20:53:42 2020 +0300
Fix mobile block buttons, auto open page on web serve start
commit 2730937b23309167a066b9154728ac53ffe81a49
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 13:58:37 2020 +0300
Disable allow this client button when isNotInAllowedList is true
commit 818cf869d63654c184762ad2701c4429a3e3011e
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 13:06:01 2020 +0300
Update client block state on option click
commit a072b8983757f419645c0207ea78e6e867c440cb
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 20:17:16 2020 +0300
Adapt to api changes
commit 28ab2bd8b3f14f60bc822b5a69fa1801db67d816
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 14:12:20 2020 +0300
Change query log block confirm messages
commit 9b0b6f6f9b1ec168fa71dbedd036152da59006e3
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 12:00:46 2020 +0300
Refactor inner work with disallowed
commit 05f76154b8f489738d032fdaa835edb371ce70c7
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Mon Sep 7 16:11:37 2020 +0300
+ client: Move the client access check to the server-side </s> remove let updatedDisallowedClients = disallowed_clients || [];
</s> add </s> remove if (type === BLOCK_ACTIONS.UNBLOCK && updatedDisallowedClients.includes(ip)) {
updatedDisallowedClients = updatedDisallowedClients.filter((client) => client !== ip);
} else if (type === BLOCK_ACTIONS.BLOCK && !updatedDisallowedClients.includes(ip)) {
updatedDisallowedClients.push(ip);
}
</s> add const updatedDisallowedClients = disallowed
? disallowed_clients.filter((client) => client !== disallowed_rule)
: disallowed_clients.concat(ip); </s> remove const { ip } = rowInfo.original;
</s> add const { info: { disallowed } } = rowInfo.original; </s> remove allowed_clients, disallowed_clients, blocked_hosts,
</s> add allowed_clients, blocked_hosts, disallowed_clients = [], </s> remove dispatch(toggleClientBlock(type, ip));
</s> add await dispatch(toggleClientBlock(ip, disallowed, disallowed_rule));
await dispatch(getStats()); | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/c72cd58f69b71e4981d8b182b2f7d53ea5e30868 | client/src/actions/access.js |
const enrichWithClientInfo = async (logs) => {
const clientsParams = getParamsForClientsSearch(logs, 'client');
if (Object.keys(clientsParams).length > 0) {
const clients = await apiClient.findClients(clientsParams);
return addClientInfo(logs, clients, 'client');
}
return logs;
};
| <mask> } from '../helpers/constants';
<mask> import { addErrorToast, addSuccessToast } from './toasts';
<mask>
<mask> const getLogsWithParams = async (config) => {
<mask> const { older_than, filter, ...values } = config;
<mask> const rawLogs = await apiClient.getQueryLog({
<mask> ...filter,
</s> + client: Move the client access check to the server-side
Squashed commit of the following:
commit 1aab0f62e94ce665a1b996552fac41dc4e769b4d
Merge: cdf5eb6e c1f5fdae
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 24 15:36:05 2020 +0300
Merge branch '1920-client-find' into feature/1925
commit cdf5eb6ea67a665d21a3155d8cf89bba9a5a9948
Merge: b6c20b1c 10f67bd3
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 23 20:28:51 2020 +0300
Merge branch 'master' into feature/1925
commit b6c20b1c7359a0e5902405b0551712f936848a80
Merge: 97d388ef 96512433
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 15 10:44:25 2020 +0300
Merge branch 'master' into feature/1925
commit 97d388ef6571d590f21da00f86d889e881ca0c3d
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 15 10:30:50 2020 +0300
Extract buttons
commit ca45fde11fc2b2812ff2b84dbd67aff0b5341be1
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 10 12:46:09 2020 +0300
Handle errors in updateLogs
commit f15e03c2e5a7115db984f70f72b0ddd870ece73d
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 10 12:39:34 2020 +0300
Update mobile block status on click
commit 033b28db3b324f6d529ac1a0ef657886cdbe02bd
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 20:53:42 2020 +0300
Fix mobile block buttons, auto open page on web serve start
commit 2730937b23309167a066b9154728ac53ffe81a49
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 13:58:37 2020 +0300
Disable allow this client button when isNotInAllowedList is true
commit 818cf869d63654c184762ad2701c4429a3e3011e
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 13:06:01 2020 +0300
Update client block state on option click
commit a072b8983757f419645c0207ea78e6e867c440cb
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 20:17:16 2020 +0300
Adapt to api changes
commit 28ab2bd8b3f14f60bc822b5a69fa1801db67d816
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 14:12:20 2020 +0300
Change query log block confirm messages
commit 9b0b6f6f9b1ec168fa71dbedd036152da59006e3
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 12:00:46 2020 +0300
Refactor inner work with disallowed
commit 05f76154b8f489738d032fdaa835edb371ce70c7
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Mon Sep 7 16:11:37 2020 +0300
+ client: Move the client access check to the server-side </s> remove import { BLOCK_ACTIONS } from '../helpers/constants';
</s> add </s> remove let logs = normalizeLogs(data);
const clientsParams = getParamsForClientsSearch(logs, 'client');
if (Object.keys(clientsParams).length > 0) {
const clients = await apiClient.findClients(clientsParams);
logs = addClientInfo(logs, clients, 'client');
}
</s> add const normalizedLogs = normalizeLogs(data);
const logs = await enrichWithClientInfo(normalizedLogs); </s> remove import { getIpMatchListStatus } from '../../../../helpers/helpers';
import { BLOCK_ACTIONS, IP_MATCH_LIST_STATUS } from '../../../../helpers/constants';
</s> add import i18next from 'i18next'; | [
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/c72cd58f69b71e4981d8b182b2f7d53ea5e30868 | client/src/actions/queryLogs.js |
const normalizedLogs = normalizeLogs(data);
const logs = await enrichWithClientInfo(normalizedLogs); | <mask> ...filter,
<mask> older_than,
<mask> });
<mask> const { data, oldest } = rawLogs;
<mask> let logs = normalizeLogs(data);
<mask> const clientsParams = getParamsForClientsSearch(logs, 'client');
<mask>
<mask> if (Object.keys(clientsParams).length > 0) {
<mask> const clients = await apiClient.findClients(clientsParams);
<mask> logs = addClientInfo(logs, clients, 'client');
<mask> }
<mask>
<mask> return {
<mask> logs,
<mask> oldest,
<mask> older_than,
</s> + client: Move the client access check to the server-side
Squashed commit of the following:
commit 1aab0f62e94ce665a1b996552fac41dc4e769b4d
Merge: cdf5eb6e c1f5fdae
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 24 15:36:05 2020 +0300
Merge branch '1920-client-find' into feature/1925
commit cdf5eb6ea67a665d21a3155d8cf89bba9a5a9948
Merge: b6c20b1c 10f67bd3
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 23 20:28:51 2020 +0300
Merge branch 'master' into feature/1925
commit b6c20b1c7359a0e5902405b0551712f936848a80
Merge: 97d388ef 96512433
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 15 10:44:25 2020 +0300
Merge branch 'master' into feature/1925
commit 97d388ef6571d590f21da00f86d889e881ca0c3d
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 15 10:30:50 2020 +0300
Extract buttons
commit ca45fde11fc2b2812ff2b84dbd67aff0b5341be1
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 10 12:46:09 2020 +0300
Handle errors in updateLogs
commit f15e03c2e5a7115db984f70f72b0ddd870ece73d
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 10 12:39:34 2020 +0300
Update mobile block status on click
commit 033b28db3b324f6d529ac1a0ef657886cdbe02bd
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 20:53:42 2020 +0300
Fix mobile block buttons, auto open page on web serve start
commit 2730937b23309167a066b9154728ac53ffe81a49
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 13:58:37 2020 +0300
Disable allow this client button when isNotInAllowedList is true
commit 818cf869d63654c184762ad2701c4429a3e3011e
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 13:06:01 2020 +0300
Update client block state on option click
commit a072b8983757f419645c0207ea78e6e867c440cb
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 20:17:16 2020 +0300
Adapt to api changes
commit 28ab2bd8b3f14f60bc822b5a69fa1801db67d816
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 14:12:20 2020 +0300
Change query log block confirm messages
commit 9b0b6f6f9b1ec168fa71dbedd036152da59006e3
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 12:00:46 2020 +0300
Refactor inner work with disallowed
commit 05f76154b8f489738d032fdaa835edb371ce70c7
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Mon Sep 7 16:11:37 2020 +0300
+ client: Move the client access check to the server-side </s> remove const getOptions = (optionToActionMap) => {
const options = Object.entries(optionToActionMap);
</s> add const getOptions = (options) => { </s> remove if (!isSmallScreen) { return; }
</s> add if (!isSmallScreen) {
return;
} </s> remove const disallowed_clients = useSelector(
(state) => state.access.disallowed_clients, shallowEqual,
);
const ipMatchListStatus = getIpMatchListStatus(ip, disallowed_clients);
if (ipMatchListStatus === IP_MATCH_LIST_STATUS.CIDR) {
return null;
}
const isNotFound = ipMatchListStatus === IP_MATCH_LIST_STATUS.NOT_FOUND;
const type = isNotFound ? BLOCK_ACTIONS.BLOCK : BLOCK_ACTIONS.UNBLOCK;
const text = type;
</s> add </s> remove export const addClientInfo = (data, clients, param) => (
data.map((row) => {
const clientIp = row[param];
const info = clients.find((item) => item[clientIp]) || '';
return {
...row,
info: info?.[clientIp] ?? '',
};
})
);
</s> add export const addClientInfo = (data, clients, param) => data.map((row) => {
const clientIp = row[param];
const info = clients.find((item) => item[clientIp]) || '';
return {
...row,
info: info?.[clientIp] ?? '',
};
}); | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/c72cd58f69b71e4981d8b182b2f7d53ea5e30868 | client/src/actions/queryLogs.js |
import { getPercent, sortIp } from '../../helpers/helpers';
import { BLOCK_ACTIONS, STATUS_COLORS } from '../../helpers/constants'; | <mask> import classNames from 'classnames';
<mask> import Card from '../ui/Card';
<mask> import Cell from '../ui/Cell';
<mask>
<mask> import { getPercent, getIpMatchListStatus, sortIp } from '../../helpers/helpers';
<mask> import { BLOCK_ACTIONS, IP_MATCH_LIST_STATUS, STATUS_COLORS } from '../../helpers/constants';
<mask> import { toggleClientBlock } from '../../actions/access';
<mask> import { renderFormattedClientCell } from '../../helpers/renderFormattedClientCell';
<mask>
<mask> const getClientsPercentColor = (percent) => {
<mask> if (percent > 50) {
</s> + client: Move the client access check to the server-side
Squashed commit of the following:
commit 1aab0f62e94ce665a1b996552fac41dc4e769b4d
Merge: cdf5eb6e c1f5fdae
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 24 15:36:05 2020 +0300
Merge branch '1920-client-find' into feature/1925
commit cdf5eb6ea67a665d21a3155d8cf89bba9a5a9948
Merge: b6c20b1c 10f67bd3
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 23 20:28:51 2020 +0300
Merge branch 'master' into feature/1925
commit b6c20b1c7359a0e5902405b0551712f936848a80
Merge: 97d388ef 96512433
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 15 10:44:25 2020 +0300
Merge branch 'master' into feature/1925
commit 97d388ef6571d590f21da00f86d889e881ca0c3d
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 15 10:30:50 2020 +0300
Extract buttons
commit ca45fde11fc2b2812ff2b84dbd67aff0b5341be1
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 10 12:46:09 2020 +0300
Handle errors in updateLogs
commit f15e03c2e5a7115db984f70f72b0ddd870ece73d
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 10 12:39:34 2020 +0300
Update mobile block status on click
commit 033b28db3b324f6d529ac1a0ef657886cdbe02bd
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 20:53:42 2020 +0300
Fix mobile block buttons, auto open page on web serve start
commit 2730937b23309167a066b9154728ac53ffe81a49
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 13:58:37 2020 +0300
Disable allow this client button when isNotInAllowedList is true
commit 818cf869d63654c184762ad2701c4429a3e3011e
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 13:06:01 2020 +0300
Update client block state on option click
commit a072b8983757f419645c0207ea78e6e867c440cb
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 20:17:16 2020 +0300
Adapt to api changes
commit 28ab2bd8b3f14f60bc822b5a69fa1801db67d816
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 14:12:20 2020 +0300
Change query log block confirm messages
commit 9b0b6f6f9b1ec168fa71dbedd036152da59006e3
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 12:00:46 2020 +0300
Refactor inner work with disallowed
commit 05f76154b8f489738d032fdaa835edb371ce70c7
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Mon Sep 7 16:11:37 2020 +0300
+ client: Move the client access check to the server-side </s> remove import { getIpMatchListStatus } from '../../../../helpers/helpers';
import { BLOCK_ACTIONS, IP_MATCH_LIST_STATUS } from '../../../../helpers/constants';
</s> add import i18next from 'i18next'; </s> remove import { BLOCK_ACTIONS } from '../helpers/constants';
</s> add | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/c72cd58f69b71e4981d8b182b2f7d53ea5e30868 | client/src/components/Dashboard/Clients.js |
import { getStats } from '../../actions/stats'; | <mask> import { getPercent, sortIp } from '../../helpers/helpers';
<mask> import { BLOCK_ACTIONS, STATUS_COLORS } from '../../helpers/constants';
<mask> import { toggleClientBlock } from '../../actions/access';
<mask> import { renderFormattedClientCell } from '../../helpers/renderFormattedClientCell';
<mask>
<mask> const getClientsPercentColor = (percent) => {
<mask> if (percent > 50) {
<mask> return STATUS_COLORS.green;
<mask> }
</s> + client: Move the client access check to the server-side
Squashed commit of the following:
commit 1aab0f62e94ce665a1b996552fac41dc4e769b4d
Merge: cdf5eb6e c1f5fdae
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 24 15:36:05 2020 +0300
Merge branch '1920-client-find' into feature/1925
commit cdf5eb6ea67a665d21a3155d8cf89bba9a5a9948
Merge: b6c20b1c 10f67bd3
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 23 20:28:51 2020 +0300
Merge branch 'master' into feature/1925
commit b6c20b1c7359a0e5902405b0551712f936848a80
Merge: 97d388ef 96512433
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 15 10:44:25 2020 +0300
Merge branch 'master' into feature/1925
commit 97d388ef6571d590f21da00f86d889e881ca0c3d
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 15 10:30:50 2020 +0300
Extract buttons
commit ca45fde11fc2b2812ff2b84dbd67aff0b5341be1
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 10 12:46:09 2020 +0300
Handle errors in updateLogs
commit f15e03c2e5a7115db984f70f72b0ddd870ece73d
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 10 12:39:34 2020 +0300
Update mobile block status on click
commit 033b28db3b324f6d529ac1a0ef657886cdbe02bd
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 20:53:42 2020 +0300
Fix mobile block buttons, auto open page on web serve start
commit 2730937b23309167a066b9154728ac53ffe81a49
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 13:58:37 2020 +0300
Disable allow this client button when isNotInAllowedList is true
commit 818cf869d63654c184762ad2701c4429a3e3011e
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 13:06:01 2020 +0300
Update client block state on option click
commit a072b8983757f419645c0207ea78e6e867c440cb
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 20:17:16 2020 +0300
Adapt to api changes
commit 28ab2bd8b3f14f60bc822b5a69fa1801db67d816
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 14:12:20 2020 +0300
Change query log block confirm messages
commit 9b0b6f6f9b1ec168fa71dbedd036152da59006e3
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 12:00:46 2020 +0300
Refactor inner work with disallowed
commit 05f76154b8f489738d032fdaa835edb371ce70c7
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Mon Sep 7 16:11:37 2020 +0300
+ client: Move the client access check to the server-side </s> remove import { getPercent, getIpMatchListStatus, sortIp } from '../../helpers/helpers';
import { BLOCK_ACTIONS, IP_MATCH_LIST_STATUS, STATUS_COLORS } from '../../helpers/constants';
</s> add import { getPercent, sortIp } from '../../helpers/helpers';
import { BLOCK_ACTIONS, STATUS_COLORS } from '../../helpers/constants'; </s> remove import { getIpMatchListStatus } from '../../../../helpers/helpers';
import { BLOCK_ACTIONS, IP_MATCH_LIST_STATUS } from '../../../../helpers/constants';
</s> add import i18next from 'i18next'; </s> remove import { BLOCK_ACTIONS } from '../helpers/constants';
</s> add | [
"keep",
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/c72cd58f69b71e4981d8b182b2f7d53ea5e30868 | client/src/components/Dashboard/Clients.js |
const renderBlockingButton = (ip, disallowed, disallowed_rule) => { | <mask>
<mask> return <Cell value={value} percent={percent} color={percentColor} search={ip} />;
<mask> };
<mask>
<mask> const renderBlockingButton = (ip) => {
<mask> const dispatch = useDispatch();
<mask> const { t } = useTranslation();
<mask> const processingSet = useSelector((state) => state.access.processingSet);
<mask> const disallowed_clients = useSelector(
<mask> (state) => state.access.disallowed_clients, shallowEqual,
</s> + client: Move the client access check to the server-side
Squashed commit of the following:
commit 1aab0f62e94ce665a1b996552fac41dc4e769b4d
Merge: cdf5eb6e c1f5fdae
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 24 15:36:05 2020 +0300
Merge branch '1920-client-find' into feature/1925
commit cdf5eb6ea67a665d21a3155d8cf89bba9a5a9948
Merge: b6c20b1c 10f67bd3
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 23 20:28:51 2020 +0300
Merge branch 'master' into feature/1925
commit b6c20b1c7359a0e5902405b0551712f936848a80
Merge: 97d388ef 96512433
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 15 10:44:25 2020 +0300
Merge branch 'master' into feature/1925
commit 97d388ef6571d590f21da00f86d889e881ca0c3d
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 15 10:30:50 2020 +0300
Extract buttons
commit ca45fde11fc2b2812ff2b84dbd67aff0b5341be1
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 10 12:46:09 2020 +0300
Handle errors in updateLogs
commit f15e03c2e5a7115db984f70f72b0ddd870ece73d
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 10 12:39:34 2020 +0300
Update mobile block status on click
commit 033b28db3b324f6d529ac1a0ef657886cdbe02bd
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 20:53:42 2020 +0300
Fix mobile block buttons, auto open page on web serve start
commit 2730937b23309167a066b9154728ac53ffe81a49
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 13:58:37 2020 +0300
Disable allow this client button when isNotInAllowedList is true
commit 818cf869d63654c184762ad2701c4429a3e3011e
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 13:06:01 2020 +0300
Update client block state on option click
commit a072b8983757f419645c0207ea78e6e867c440cb
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 20:17:16 2020 +0300
Adapt to api changes
commit 28ab2bd8b3f14f60bc822b5a69fa1801db67d816
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 14:12:20 2020 +0300
Change query log block confirm messages
commit 9b0b6f6f9b1ec168fa71dbedd036152da59006e3
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 12:00:46 2020 +0300
Refactor inner work with disallowed
commit 05f76154b8f489738d032fdaa835edb371ce70c7
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Mon Sep 7 16:11:37 2020 +0300
+ client: Move the client access check to the server-side </s> remove const disallowed_clients = useSelector(
(state) => state.access.disallowed_clients, shallowEqual,
);
const ipMatchListStatus = getIpMatchListStatus(ip, disallowed_clients);
if (ipMatchListStatus === IP_MATCH_LIST_STATUS.CIDR) {
return null;
}
const isNotFound = ipMatchListStatus === IP_MATCH_LIST_STATUS.NOT_FOUND;
const type = isNotFound ? BLOCK_ACTIONS.BLOCK : BLOCK_ACTIONS.UNBLOCK;
const text = type;
</s> add </s> remove const disallowed_clients = useSelector(
(state) => state.access.disallowed_clients,
shallowEqual,
);
</s> add </s> remove info: { name, whois_info },
</s> add info: {
name, whois_info, disallowed, disallowed_rule,
}, </s> remove const disallowedClients = useSelector((state) => state.access.disallowed_clients, shallowEqual);
</s> add </s> remove const disallowed_clients = useSelector(
(state) => state.access.disallowed_clients,
shallowEqual,
);
</s> add | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/c72cd58f69b71e4981d8b182b2f7d53ea5e30868 | client/src/components/Dashboard/Clients.js |
<mask> const renderBlockingButton = (ip) => {
<mask> const dispatch = useDispatch();
<mask> const { t } = useTranslation();
<mask> const processingSet = useSelector((state) => state.access.processingSet);
<mask> const disallowed_clients = useSelector(
<mask> (state) => state.access.disallowed_clients, shallowEqual,
<mask> );
<mask>
<mask> const ipMatchListStatus = getIpMatchListStatus(ip, disallowed_clients);
<mask>
<mask> if (ipMatchListStatus === IP_MATCH_LIST_STATUS.CIDR) {
<mask> return null;
<mask> }
<mask>
<mask> const isNotFound = ipMatchListStatus === IP_MATCH_LIST_STATUS.NOT_FOUND;
<mask> const type = isNotFound ? BLOCK_ACTIONS.BLOCK : BLOCK_ACTIONS.UNBLOCK;
<mask> const text = type;
<mask>
<mask> const buttonClass = classNames('button-action button-action--main', {
<mask> 'button-action--unblock': !isNotFound,
<mask> });
<mask>
</s> + client: Move the client access check to the server-side
Squashed commit of the following:
commit 1aab0f62e94ce665a1b996552fac41dc4e769b4d
Merge: cdf5eb6e c1f5fdae
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 24 15:36:05 2020 +0300
Merge branch '1920-client-find' into feature/1925
commit cdf5eb6ea67a665d21a3155d8cf89bba9a5a9948
Merge: b6c20b1c 10f67bd3
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 23 20:28:51 2020 +0300
Merge branch 'master' into feature/1925
commit b6c20b1c7359a0e5902405b0551712f936848a80
Merge: 97d388ef 96512433
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 15 10:44:25 2020 +0300
Merge branch 'master' into feature/1925
commit 97d388ef6571d590f21da00f86d889e881ca0c3d
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 15 10:30:50 2020 +0300
Extract buttons
commit ca45fde11fc2b2812ff2b84dbd67aff0b5341be1
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 10 12:46:09 2020 +0300
Handle errors in updateLogs
commit f15e03c2e5a7115db984f70f72b0ddd870ece73d
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 10 12:39:34 2020 +0300
Update mobile block status on click
commit 033b28db3b324f6d529ac1a0ef657886cdbe02bd
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 20:53:42 2020 +0300
Fix mobile block buttons, auto open page on web serve start
commit 2730937b23309167a066b9154728ac53ffe81a49
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 13:58:37 2020 +0300
Disable allow this client button when isNotInAllowedList is true
commit 818cf869d63654c184762ad2701c4429a3e3011e
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 13:06:01 2020 +0300
Update client block state on option click
commit a072b8983757f419645c0207ea78e6e867c440cb
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 20:17:16 2020 +0300
Adapt to api changes
commit 28ab2bd8b3f14f60bc822b5a69fa1801db67d816
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 14:12:20 2020 +0300
Change query log block confirm messages
commit 9b0b6f6f9b1ec168fa71dbedd036152da59006e3
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 12:00:46 2020 +0300
Refactor inner work with disallowed
commit 05f76154b8f489738d032fdaa835edb371ce70c7
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Mon Sep 7 16:11:37 2020 +0300
+ client: Move the client access check to the server-side </s> remove const renderBlockingButton = (ip) => {
</s> add const renderBlockingButton = (ip, disallowed, disallowed_rule) => { </s> remove 'button-action--unblock': !isNotFound,
</s> add 'button-action--unblock': disallowed, </s> remove const isNotFound = ipMatchListStatus === IP_MATCH_LIST_STATUS.NOT_FOUND;
const type = isNotFound ? BLOCK_ACTIONS.BLOCK : BLOCK_ACTIONS.UNBLOCK;
</s> add const buttonKey = i18next.t(disallowed ? 'allow_this_client' : 'disallow_this_client');
const isNotInAllowedList = disallowed && disallowed_rule === ''; </s> remove export const getBlockClientInfo = (client, disallowed_clients) => {
const ipMatchListStatus = getIpMatchListStatus(client, disallowed_clients);
</s> add export const getBlockClientInfo = (ip, disallowed, disallowed_rule) => {
const confirmMessage = disallowed
? i18next.t('client_confirm_unblock', { ip: disallowed_rule })
: `${i18next.t('adg_will_drop_dns_queries')} ${i18next.t('client_confirm_block', { ip })}`; </s> remove const disallowed_clients = useSelector(
(state) => state.access.disallowed_clients,
shallowEqual,
);
</s> add | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/c72cd58f69b71e4981d8b182b2f7d53ea5e30868 | client/src/components/Dashboard/Clients.js | |
'button-action--unblock': disallowed, | <mask> const type = isNotFound ? BLOCK_ACTIONS.BLOCK : BLOCK_ACTIONS.UNBLOCK;
<mask> const text = type;
<mask>
<mask> const buttonClass = classNames('button-action button-action--main', {
<mask> 'button-action--unblock': !isNotFound,
<mask> });
<mask>
<mask> const toggleClientStatus = (type, ip) => {
<mask> const confirmMessage = type === BLOCK_ACTIONS.BLOCK
<mask> ? `${t('adg_will_drop_dns_queries')} ${t('client_confirm_block', { ip })}`
</s> + client: Move the client access check to the server-side
Squashed commit of the following:
commit 1aab0f62e94ce665a1b996552fac41dc4e769b4d
Merge: cdf5eb6e c1f5fdae
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 24 15:36:05 2020 +0300
Merge branch '1920-client-find' into feature/1925
commit cdf5eb6ea67a665d21a3155d8cf89bba9a5a9948
Merge: b6c20b1c 10f67bd3
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 23 20:28:51 2020 +0300
Merge branch 'master' into feature/1925
commit b6c20b1c7359a0e5902405b0551712f936848a80
Merge: 97d388ef 96512433
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 15 10:44:25 2020 +0300
Merge branch 'master' into feature/1925
commit 97d388ef6571d590f21da00f86d889e881ca0c3d
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 15 10:30:50 2020 +0300
Extract buttons
commit ca45fde11fc2b2812ff2b84dbd67aff0b5341be1
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 10 12:46:09 2020 +0300
Handle errors in updateLogs
commit f15e03c2e5a7115db984f70f72b0ddd870ece73d
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 10 12:39:34 2020 +0300
Update mobile block status on click
commit 033b28db3b324f6d529ac1a0ef657886cdbe02bd
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 20:53:42 2020 +0300
Fix mobile block buttons, auto open page on web serve start
commit 2730937b23309167a066b9154728ac53ffe81a49
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 13:58:37 2020 +0300
Disable allow this client button when isNotInAllowedList is true
commit 818cf869d63654c184762ad2701c4429a3e3011e
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 13:06:01 2020 +0300
Update client block state on option click
commit a072b8983757f419645c0207ea78e6e867c440cb
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 20:17:16 2020 +0300
Adapt to api changes
commit 28ab2bd8b3f14f60bc822b5a69fa1801db67d816
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 14:12:20 2020 +0300
Change query log block confirm messages
commit 9b0b6f6f9b1ec168fa71dbedd036152da59006e3
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 12:00:46 2020 +0300
Refactor inner work with disallowed
commit 05f76154b8f489738d032fdaa835edb371ce70c7
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Mon Sep 7 16:11:37 2020 +0300
+ client: Move the client access check to the server-side </s> remove const toggleClientStatus = (type, ip) => {
const confirmMessage = type === BLOCK_ACTIONS.BLOCK
? `${t('adg_will_drop_dns_queries')} ${t('client_confirm_block', { ip })}`
: t('client_confirm_unblock', { ip });
</s> add const toggleClientStatus = async (ip, disallowed, disallowed_rule) => {
const confirmMessage = disallowed
? t('client_confirm_unblock', { ip: disallowed_rule })
: `${t('adg_will_drop_dns_queries')} ${t('client_confirm_block', { ip })}`; </s> remove const disallowed_clients = useSelector(
(state) => state.access.disallowed_clients, shallowEqual,
);
const ipMatchListStatus = getIpMatchListStatus(ip, disallowed_clients);
if (ipMatchListStatus === IP_MATCH_LIST_STATUS.CIDR) {
return null;
}
const isNotFound = ipMatchListStatus === IP_MATCH_LIST_STATUS.NOT_FOUND;
const type = isNotFound ? BLOCK_ACTIONS.BLOCK : BLOCK_ACTIONS.UNBLOCK;
const text = type;
</s> add </s> remove export const getBlockClientInfo = (client, disallowed_clients) => {
const ipMatchListStatus = getIpMatchListStatus(client, disallowed_clients);
</s> add export const getBlockClientInfo = (ip, disallowed, disallowed_rule) => {
const confirmMessage = disallowed
? i18next.t('client_confirm_unblock', { ip: disallowed_rule })
: `${i18next.t('adg_will_drop_dns_queries')} ${i18next.t('client_confirm_block', { ip })}`; </s> remove const confirmMessage = isNotFound ? 'client_confirm_block' : 'client_confirm_unblock';
const buttonKey = isNotFound ? 'disallow_this_client' : 'allow_this_client';
</s> add </s> remove const isNotFound = ipMatchListStatus === IP_MATCH_LIST_STATUS.NOT_FOUND;
const type = isNotFound ? BLOCK_ACTIONS.BLOCK : BLOCK_ACTIONS.UNBLOCK;
</s> add const buttonKey = i18next.t(disallowed ? 'allow_this_client' : 'disallow_this_client');
const isNotInAllowedList = disallowed && disallowed_rule === ''; | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/c72cd58f69b71e4981d8b182b2f7d53ea5e30868 | client/src/components/Dashboard/Clients.js |
const toggleClientStatus = async (ip, disallowed, disallowed_rule) => {
const confirmMessage = disallowed
? t('client_confirm_unblock', { ip: disallowed_rule })
: `${t('adg_will_drop_dns_queries')} ${t('client_confirm_block', { ip })}`; | <mask> const buttonClass = classNames('button-action button-action--main', {
<mask> 'button-action--unblock': !isNotFound,
<mask> });
<mask>
<mask> const toggleClientStatus = (type, ip) => {
<mask> const confirmMessage = type === BLOCK_ACTIONS.BLOCK
<mask> ? `${t('adg_will_drop_dns_queries')} ${t('client_confirm_block', { ip })}`
<mask> : t('client_confirm_unblock', { ip });
<mask>
<mask> if (window.confirm(confirmMessage)) {
<mask> dispatch(toggleClientBlock(type, ip));
<mask> }
<mask> };
</s> + client: Move the client access check to the server-side
Squashed commit of the following:
commit 1aab0f62e94ce665a1b996552fac41dc4e769b4d
Merge: cdf5eb6e c1f5fdae
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 24 15:36:05 2020 +0300
Merge branch '1920-client-find' into feature/1925
commit cdf5eb6ea67a665d21a3155d8cf89bba9a5a9948
Merge: b6c20b1c 10f67bd3
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 23 20:28:51 2020 +0300
Merge branch 'master' into feature/1925
commit b6c20b1c7359a0e5902405b0551712f936848a80
Merge: 97d388ef 96512433
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 15 10:44:25 2020 +0300
Merge branch 'master' into feature/1925
commit 97d388ef6571d590f21da00f86d889e881ca0c3d
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 15 10:30:50 2020 +0300
Extract buttons
commit ca45fde11fc2b2812ff2b84dbd67aff0b5341be1
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 10 12:46:09 2020 +0300
Handle errors in updateLogs
commit f15e03c2e5a7115db984f70f72b0ddd870ece73d
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 10 12:39:34 2020 +0300
Update mobile block status on click
commit 033b28db3b324f6d529ac1a0ef657886cdbe02bd
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 20:53:42 2020 +0300
Fix mobile block buttons, auto open page on web serve start
commit 2730937b23309167a066b9154728ac53ffe81a49
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 13:58:37 2020 +0300
Disable allow this client button when isNotInAllowedList is true
commit 818cf869d63654c184762ad2701c4429a3e3011e
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 13:06:01 2020 +0300
Update client block state on option click
commit a072b8983757f419645c0207ea78e6e867c440cb
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 20:17:16 2020 +0300
Adapt to api changes
commit 28ab2bd8b3f14f60bc822b5a69fa1801db67d816
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 14:12:20 2020 +0300
Change query log block confirm messages
commit 9b0b6f6f9b1ec168fa71dbedd036152da59006e3
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 12:00:46 2020 +0300
Refactor inner work with disallowed
commit 05f76154b8f489738d032fdaa835edb371ce70c7
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Mon Sep 7 16:11:37 2020 +0300
+ client: Move the client access check to the server-side </s> remove 'button-action--unblock': !isNotFound,
</s> add 'button-action--unblock': disallowed, </s> remove dispatch(toggleClientBlock(type, ip));
</s> add await dispatch(toggleClientBlock(ip, disallowed, disallowed_rule));
await dispatch(getStats()); </s> remove const disallowed_clients = useSelector(
(state) => state.access.disallowed_clients, shallowEqual,
);
const ipMatchListStatus = getIpMatchListStatus(ip, disallowed_clients);
if (ipMatchListStatus === IP_MATCH_LIST_STATUS.CIDR) {
return null;
}
const isNotFound = ipMatchListStatus === IP_MATCH_LIST_STATUS.NOT_FOUND;
const type = isNotFound ? BLOCK_ACTIONS.BLOCK : BLOCK_ACTIONS.UNBLOCK;
const text = type;
</s> add </s> remove export const getBlockClientInfo = (client, disallowed_clients) => {
const ipMatchListStatus = getIpMatchListStatus(client, disallowed_clients);
</s> add export const getBlockClientInfo = (ip, disallowed, disallowed_rule) => {
const confirmMessage = disallowed
? i18next.t('client_confirm_unblock', { ip: disallowed_rule })
: `${i18next.t('adg_will_drop_dns_queries')} ${i18next.t('client_confirm_block', { ip })}`; </s> remove const content = getOptions(BUTTON_OPTIONS_TO_ACTION_MAP);
</s> add const content = getOptions(BUTTON_OPTIONS); | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/c72cd58f69b71e4981d8b182b2f7d53ea5e30868 | client/src/components/Dashboard/Clients.js |
await dispatch(toggleClientBlock(ip, disallowed, disallowed_rule));
await dispatch(getStats()); | <mask> ? `${t('adg_will_drop_dns_queries')} ${t('client_confirm_block', { ip })}`
<mask> : t('client_confirm_unblock', { ip });
<mask>
<mask> if (window.confirm(confirmMessage)) {
<mask> dispatch(toggleClientBlock(type, ip));
<mask> }
<mask> };
<mask>
<mask> const onClick = () => toggleClientStatus(type, ip);
<mask>
</s> + client: Move the client access check to the server-side
Squashed commit of the following:
commit 1aab0f62e94ce665a1b996552fac41dc4e769b4d
Merge: cdf5eb6e c1f5fdae
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 24 15:36:05 2020 +0300
Merge branch '1920-client-find' into feature/1925
commit cdf5eb6ea67a665d21a3155d8cf89bba9a5a9948
Merge: b6c20b1c 10f67bd3
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 23 20:28:51 2020 +0300
Merge branch 'master' into feature/1925
commit b6c20b1c7359a0e5902405b0551712f936848a80
Merge: 97d388ef 96512433
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 15 10:44:25 2020 +0300
Merge branch 'master' into feature/1925
commit 97d388ef6571d590f21da00f86d889e881ca0c3d
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 15 10:30:50 2020 +0300
Extract buttons
commit ca45fde11fc2b2812ff2b84dbd67aff0b5341be1
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 10 12:46:09 2020 +0300
Handle errors in updateLogs
commit f15e03c2e5a7115db984f70f72b0ddd870ece73d
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 10 12:39:34 2020 +0300
Update mobile block status on click
commit 033b28db3b324f6d529ac1a0ef657886cdbe02bd
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 20:53:42 2020 +0300
Fix mobile block buttons, auto open page on web serve start
commit 2730937b23309167a066b9154728ac53ffe81a49
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 13:58:37 2020 +0300
Disable allow this client button when isNotInAllowedList is true
commit 818cf869d63654c184762ad2701c4429a3e3011e
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 13:06:01 2020 +0300
Update client block state on option click
commit a072b8983757f419645c0207ea78e6e867c440cb
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 20:17:16 2020 +0300
Adapt to api changes
commit 28ab2bd8b3f14f60bc822b5a69fa1801db67d816
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 14:12:20 2020 +0300
Change query log block confirm messages
commit 9b0b6f6f9b1ec168fa71dbedd036152da59006e3
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 12:00:46 2020 +0300
Refactor inner work with disallowed
commit 05f76154b8f489738d032fdaa835edb371ce70c7
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Mon Sep 7 16:11:37 2020 +0300
+ client: Move the client access check to the server-side </s> remove const toggleClientStatus = (type, ip) => {
const confirmMessage = type === BLOCK_ACTIONS.BLOCK
? `${t('adg_will_drop_dns_queries')} ${t('client_confirm_block', { ip })}`
: t('client_confirm_unblock', { ip });
</s> add const toggleClientStatus = async (ip, disallowed, disallowed_rule) => {
const confirmMessage = disallowed
? t('client_confirm_unblock', { ip: disallowed_rule })
: `${t('adg_will_drop_dns_queries')} ${t('client_confirm_block', { ip })}`; </s> remove 'button-action--unblock': !isNotFound,
</s> add 'button-action--unblock': disallowed, </s> remove const onClick = () => toggleClientStatus(type, ip);
</s> add const onClick = () => toggleClientStatus(ip, disallowed, disallowed_rule);
const text = disallowed ? BLOCK_ACTIONS.UNBLOCK : BLOCK_ACTIONS.BLOCK; </s> remove [blockingClientKey]: () => {
const message = `${type === BLOCK_ACTIONS.BLOCK ? t('adg_will_drop_dns_queries') : ''} ${t(confirmMessage, { ip: client })}`;
if (window.confirm(message)) {
dispatch(toggleClientBlock(type, client));
}
</s> add {
name: blockingClientKey,
onClick: async () => {
if (window.confirm(confirmMessage)) {
await dispatch(toggleClientBlock(client, disallowed, disallowed_rule));
await dispatch(updateLogs());
}
},
disabled: isNotInAllowedList, </s> remove <button
type="button"
className={buttonClass}
onClick={onClick}
disabled={processingSet}
>
<Trans>{text}</Trans>
</button>
</div>;
</s> add <button
type="button"
className={buttonClass}
onClick={isNotInAllowedList ? undefined : onClick}
disabled={isNotInAllowedList || processingSet}
title={t(isNotInAllowedList ? 'client_not_in_allowed_clients' : text)}
>
<Trans>{text}</Trans>
</button>
</div>; | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/c72cd58f69b71e4981d8b182b2f7d53ea5e30868 | client/src/components/Dashboard/Clients.js |
const onClick = () => toggleClientStatus(ip, disallowed, disallowed_rule);
const text = disallowed ? BLOCK_ACTIONS.UNBLOCK : BLOCK_ACTIONS.BLOCK; | <mask> dispatch(toggleClientBlock(type, ip));
<mask> }
<mask> };
<mask>
<mask> const onClick = () => toggleClientStatus(type, ip);
<mask>
<mask> return <div className="table__action pl-4">
<mask> <button
<mask> type="button"
<mask> className={buttonClass}
</s> + client: Move the client access check to the server-side
Squashed commit of the following:
commit 1aab0f62e94ce665a1b996552fac41dc4e769b4d
Merge: cdf5eb6e c1f5fdae
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 24 15:36:05 2020 +0300
Merge branch '1920-client-find' into feature/1925
commit cdf5eb6ea67a665d21a3155d8cf89bba9a5a9948
Merge: b6c20b1c 10f67bd3
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 23 20:28:51 2020 +0300
Merge branch 'master' into feature/1925
commit b6c20b1c7359a0e5902405b0551712f936848a80
Merge: 97d388ef 96512433
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 15 10:44:25 2020 +0300
Merge branch 'master' into feature/1925
commit 97d388ef6571d590f21da00f86d889e881ca0c3d
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 15 10:30:50 2020 +0300
Extract buttons
commit ca45fde11fc2b2812ff2b84dbd67aff0b5341be1
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 10 12:46:09 2020 +0300
Handle errors in updateLogs
commit f15e03c2e5a7115db984f70f72b0ddd870ece73d
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 10 12:39:34 2020 +0300
Update mobile block status on click
commit 033b28db3b324f6d529ac1a0ef657886cdbe02bd
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 20:53:42 2020 +0300
Fix mobile block buttons, auto open page on web serve start
commit 2730937b23309167a066b9154728ac53ffe81a49
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 13:58:37 2020 +0300
Disable allow this client button when isNotInAllowedList is true
commit 818cf869d63654c184762ad2701c4429a3e3011e
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 13:06:01 2020 +0300
Update client block state on option click
commit a072b8983757f419645c0207ea78e6e867c440cb
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 20:17:16 2020 +0300
Adapt to api changes
commit 28ab2bd8b3f14f60bc822b5a69fa1801db67d816
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 14:12:20 2020 +0300
Change query log block confirm messages
commit 9b0b6f6f9b1ec168fa71dbedd036152da59006e3
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 12:00:46 2020 +0300
Refactor inner work with disallowed
commit 05f76154b8f489738d032fdaa835edb371ce70c7
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Mon Sep 7 16:11:37 2020 +0300
+ client: Move the client access check to the server-side </s> remove <button
type="button"
className={buttonClass}
onClick={onClick}
disabled={processingSet}
>
<Trans>{text}</Trans>
</button>
</div>;
</s> add <button
type="button"
className={buttonClass}
onClick={isNotInAllowedList ? undefined : onClick}
disabled={isNotInAllowedList || processingSet}
title={t(isNotInAllowedList ? 'client_not_in_allowed_clients' : text)}
>
<Trans>{text}</Trans>
</button>
</div>; </s> remove dispatch(toggleClientBlock(type, ip));
</s> add await dispatch(toggleClientBlock(ip, disallowed, disallowed_rule));
await dispatch(getStats()); </s> remove };
</s> add ]; </s> remove const getOptions = (optionToActionMap) => {
const options = Object.entries(optionToActionMap);
</s> add const getOptions = (options) => { | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/c72cd58f69b71e4981d8b182b2f7d53ea5e30868 | client/src/components/Dashboard/Clients.js |
const isNotInAllowedList = disallowed && disallowed_rule === ''; | <mask> const onClick = () => toggleClientStatus(ip, disallowed, disallowed_rule);
<mask>
<mask> const text = disallowed ? BLOCK_ACTIONS.UNBLOCK : BLOCK_ACTIONS.BLOCK;
<mask>
<mask> return <div className="table__action pl-4">
<mask> <button
<mask> type="button"
<mask> className={buttonClass}
</s> + client: Move the client access check to the server-side
Squashed commit of the following:
commit 1aab0f62e94ce665a1b996552fac41dc4e769b4d
Merge: cdf5eb6e c1f5fdae
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 24 15:36:05 2020 +0300
Merge branch '1920-client-find' into feature/1925
commit cdf5eb6ea67a665d21a3155d8cf89bba9a5a9948
Merge: b6c20b1c 10f67bd3
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 23 20:28:51 2020 +0300
Merge branch 'master' into feature/1925
commit b6c20b1c7359a0e5902405b0551712f936848a80
Merge: 97d388ef 96512433
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 15 10:44:25 2020 +0300
Merge branch 'master' into feature/1925
commit 97d388ef6571d590f21da00f86d889e881ca0c3d
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 15 10:30:50 2020 +0300
Extract buttons
commit ca45fde11fc2b2812ff2b84dbd67aff0b5341be1
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 10 12:46:09 2020 +0300
Handle errors in updateLogs
commit f15e03c2e5a7115db984f70f72b0ddd870ece73d
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 10 12:39:34 2020 +0300
Update mobile block status on click
commit 033b28db3b324f6d529ac1a0ef657886cdbe02bd
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 20:53:42 2020 +0300
Fix mobile block buttons, auto open page on web serve start
commit 2730937b23309167a066b9154728ac53ffe81a49
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 13:58:37 2020 +0300
Disable allow this client button when isNotInAllowedList is true
commit 818cf869d63654c184762ad2701c4429a3e3011e
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 13:06:01 2020 +0300
Update client block state on option click
commit a072b8983757f419645c0207ea78e6e867c440cb
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 20:17:16 2020 +0300
Adapt to api changes
commit 28ab2bd8b3f14f60bc822b5a69fa1801db67d816
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 14:12:20 2020 +0300
Change query log block confirm messages
commit 9b0b6f6f9b1ec168fa71dbedd036152da59006e3
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 12:00:46 2020 +0300
Refactor inner work with disallowed
commit 05f76154b8f489738d032fdaa835edb371ce70c7
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Mon Sep 7 16:11:37 2020 +0300
+ client: Move the client access check to the server-side </s> remove const onClick = () => toggleClientStatus(type, ip);
</s> add const onClick = () => toggleClientStatus(ip, disallowed, disallowed_rule);
const text = disallowed ? BLOCK_ACTIONS.UNBLOCK : BLOCK_ACTIONS.BLOCK; </s> remove <button
type="button"
className={buttonClass}
onClick={onClick}
disabled={processingSet}
>
<Trans>{text}</Trans>
</button>
</div>;
</s> add <button
type="button"
className={buttonClass}
onClick={isNotInAllowedList ? undefined : onClick}
disabled={isNotInAllowedList || processingSet}
title={t(isNotInAllowedList ? 'client_not_in_allowed_clients' : text)}
>
<Trans>{text}</Trans>
</button>
</div>; </s> remove || reason === FILTERED_STATUS.FILTERED_BLOCKED_SERVICE;
</s> add || reason === FILTERED_STATUS.FILTERED_BLOCKED_SERVICE; </s> remove type: blockType,
} = getBlockClientInfo(client, disallowed_clients);
</s> add isNotInAllowedList,
} = getBlockClientInfo(client, disallowed, disallowed_rule); </s> remove const getOptions = (optionToActionMap) => {
const options = Object.entries(optionToActionMap);
</s> add const getOptions = (options) => { | [
"keep",
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/c72cd58f69b71e4981d8b182b2f7d53ea5e30868 | client/src/components/Dashboard/Clients.js |
<button
type="button"
className={buttonClass}
onClick={isNotInAllowedList ? undefined : onClick}
disabled={isNotInAllowedList || processingSet}
title={t(isNotInAllowedList ? 'client_not_in_allowed_clients' : text)}
>
<Trans>{text}</Trans>
</button>
</div>; | <mask>
<mask> const onClick = () => toggleClientStatus(type, ip);
<mask>
<mask> return <div className="table__action pl-4">
<mask> <button
<mask> type="button"
<mask> className={buttonClass}
<mask> onClick={onClick}
<mask> disabled={processingSet}
<mask> >
<mask> <Trans>{text}</Trans>
<mask> </button>
<mask> </div>;
<mask> };
<mask>
<mask> const ClientCell = (row) => {
<mask> const { value, original: { info } } = row;
<mask>
</s> + client: Move the client access check to the server-side
Squashed commit of the following:
commit 1aab0f62e94ce665a1b996552fac41dc4e769b4d
Merge: cdf5eb6e c1f5fdae
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 24 15:36:05 2020 +0300
Merge branch '1920-client-find' into feature/1925
commit cdf5eb6ea67a665d21a3155d8cf89bba9a5a9948
Merge: b6c20b1c 10f67bd3
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 23 20:28:51 2020 +0300
Merge branch 'master' into feature/1925
commit b6c20b1c7359a0e5902405b0551712f936848a80
Merge: 97d388ef 96512433
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 15 10:44:25 2020 +0300
Merge branch 'master' into feature/1925
commit 97d388ef6571d590f21da00f86d889e881ca0c3d
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 15 10:30:50 2020 +0300
Extract buttons
commit ca45fde11fc2b2812ff2b84dbd67aff0b5341be1
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 10 12:46:09 2020 +0300
Handle errors in updateLogs
commit f15e03c2e5a7115db984f70f72b0ddd870ece73d
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 10 12:39:34 2020 +0300
Update mobile block status on click
commit 033b28db3b324f6d529ac1a0ef657886cdbe02bd
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 20:53:42 2020 +0300
Fix mobile block buttons, auto open page on web serve start
commit 2730937b23309167a066b9154728ac53ffe81a49
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 13:58:37 2020 +0300
Disable allow this client button when isNotInAllowedList is true
commit 818cf869d63654c184762ad2701c4429a3e3011e
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 13:06:01 2020 +0300
Update client block state on option click
commit a072b8983757f419645c0207ea78e6e867c440cb
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 20:17:16 2020 +0300
Adapt to api changes
commit 28ab2bd8b3f14f60bc822b5a69fa1801db67d816
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 14:12:20 2020 +0300
Change query log block confirm messages
commit 9b0b6f6f9b1ec168fa71dbedd036152da59006e3
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 12:00:46 2020 +0300
Refactor inner work with disallowed
commit 05f76154b8f489738d032fdaa835edb371ce70c7
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Mon Sep 7 16:11:37 2020 +0300
+ client: Move the client access check to the server-side </s> remove const { value, original: { info } } = row;
</s> add const { value, original: { info, info: { disallowed, disallowed_rule } } } = row; </s> remove const onClick = () => toggleClientStatus(type, ip);
</s> add const onClick = () => toggleClientStatus(ip, disallowed, disallowed_rule);
const text = disallowed ? BLOCK_ACTIONS.UNBLOCK : BLOCK_ACTIONS.BLOCK; </s> remove const getOptions = (optionToActionMap) => {
const options = Object.entries(optionToActionMap);
</s> add const getOptions = (options) => { </s> remove dispatch(toggleClientBlock(type, ip));
</s> add await dispatch(toggleClientBlock(ip, disallowed, disallowed_rule));
await dispatch(getStats()); | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/c72cd58f69b71e4981d8b182b2f7d53ea5e30868 | client/src/components/Dashboard/Clients.js |
const { value, original: { info, info: { disallowed, disallowed_rule } } } = row; | <mask> </div>;
<mask> };
<mask>
<mask> const ClientCell = (row) => {
<mask> const { value, original: { info } } = row;
<mask>
<mask> return <>
<mask> <div className="logs__row logs__row--overflow logs__row--column d-flex align-items-center">
<mask> {renderFormattedClientCell(value, info, true)}
<mask> {renderBlockingButton(value)}
</s> + client: Move the client access check to the server-side
Squashed commit of the following:
commit 1aab0f62e94ce665a1b996552fac41dc4e769b4d
Merge: cdf5eb6e c1f5fdae
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 24 15:36:05 2020 +0300
Merge branch '1920-client-find' into feature/1925
commit cdf5eb6ea67a665d21a3155d8cf89bba9a5a9948
Merge: b6c20b1c 10f67bd3
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 23 20:28:51 2020 +0300
Merge branch 'master' into feature/1925
commit b6c20b1c7359a0e5902405b0551712f936848a80
Merge: 97d388ef 96512433
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 15 10:44:25 2020 +0300
Merge branch 'master' into feature/1925
commit 97d388ef6571d590f21da00f86d889e881ca0c3d
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 15 10:30:50 2020 +0300
Extract buttons
commit ca45fde11fc2b2812ff2b84dbd67aff0b5341be1
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 10 12:46:09 2020 +0300
Handle errors in updateLogs
commit f15e03c2e5a7115db984f70f72b0ddd870ece73d
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 10 12:39:34 2020 +0300
Update mobile block status on click
commit 033b28db3b324f6d529ac1a0ef657886cdbe02bd
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 20:53:42 2020 +0300
Fix mobile block buttons, auto open page on web serve start
commit 2730937b23309167a066b9154728ac53ffe81a49
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 13:58:37 2020 +0300
Disable allow this client button when isNotInAllowedList is true
commit 818cf869d63654c184762ad2701c4429a3e3011e
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 13:06:01 2020 +0300
Update client block state on option click
commit a072b8983757f419645c0207ea78e6e867c440cb
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 20:17:16 2020 +0300
Adapt to api changes
commit 28ab2bd8b3f14f60bc822b5a69fa1801db67d816
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 14:12:20 2020 +0300
Change query log block confirm messages
commit 9b0b6f6f9b1ec168fa71dbedd036152da59006e3
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 12:00:46 2020 +0300
Refactor inner work with disallowed
commit 05f76154b8f489738d032fdaa835edb371ce70c7
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Mon Sep 7 16:11:37 2020 +0300
+ client: Move the client access check to the server-side </s> remove {renderBlockingButton(value)}
</s> add {renderBlockingButton(value, disallowed, disallowed_rule)} </s> remove <button
type="button"
className={buttonClass}
onClick={onClick}
disabled={processingSet}
>
<Trans>{text}</Trans>
</button>
</div>;
</s> add <button
type="button"
className={buttonClass}
onClick={isNotInAllowedList ? undefined : onClick}
disabled={isNotInAllowedList || processingSet}
title={t(isNotInAllowedList ? 'client_not_in_allowed_clients' : text)}
>
<Trans>{text}</Trans>
</button>
</div>; </s> remove info: { name, whois_info },
</s> add info: {
name, whois_info, disallowed, disallowed_rule,
}, </s> remove const getOptions = (optionToActionMap) => {
const options = Object.entries(optionToActionMap);
</s> add const getOptions = (options) => { | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/c72cd58f69b71e4981d8b182b2f7d53ea5e30868 | client/src/components/Dashboard/Clients.js |
{renderBlockingButton(value, disallowed, disallowed_rule)} | <mask>
<mask> return <>
<mask> <div className="logs__row logs__row--overflow logs__row--column d-flex align-items-center">
<mask> {renderFormattedClientCell(value, info, true)}
<mask> {renderBlockingButton(value)}
<mask> </div>
<mask> </>;
<mask> };
<mask>
<mask> const Clients = ({
</s> + client: Move the client access check to the server-side
Squashed commit of the following:
commit 1aab0f62e94ce665a1b996552fac41dc4e769b4d
Merge: cdf5eb6e c1f5fdae
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 24 15:36:05 2020 +0300
Merge branch '1920-client-find' into feature/1925
commit cdf5eb6ea67a665d21a3155d8cf89bba9a5a9948
Merge: b6c20b1c 10f67bd3
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 23 20:28:51 2020 +0300
Merge branch 'master' into feature/1925
commit b6c20b1c7359a0e5902405b0551712f936848a80
Merge: 97d388ef 96512433
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 15 10:44:25 2020 +0300
Merge branch 'master' into feature/1925
commit 97d388ef6571d590f21da00f86d889e881ca0c3d
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 15 10:30:50 2020 +0300
Extract buttons
commit ca45fde11fc2b2812ff2b84dbd67aff0b5341be1
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 10 12:46:09 2020 +0300
Handle errors in updateLogs
commit f15e03c2e5a7115db984f70f72b0ddd870ece73d
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 10 12:39:34 2020 +0300
Update mobile block status on click
commit 033b28db3b324f6d529ac1a0ef657886cdbe02bd
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 20:53:42 2020 +0300
Fix mobile block buttons, auto open page on web serve start
commit 2730937b23309167a066b9154728ac53ffe81a49
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 13:58:37 2020 +0300
Disable allow this client button when isNotInAllowedList is true
commit 818cf869d63654c184762ad2701c4429a3e3011e
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 13:06:01 2020 +0300
Update client block state on option click
commit a072b8983757f419645c0207ea78e6e867c440cb
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 20:17:16 2020 +0300
Adapt to api changes
commit 28ab2bd8b3f14f60bc822b5a69fa1801db67d816
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 14:12:20 2020 +0300
Change query log block confirm messages
commit 9b0b6f6f9b1ec168fa71dbedd036152da59006e3
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 12:00:46 2020 +0300
Refactor inner work with disallowed
commit 05f76154b8f489738d032fdaa835edb371ce70c7
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Mon Sep 7 16:11:37 2020 +0300
+ client: Move the client access check to the server-side </s> remove const { value, original: { info } } = row;
</s> add const { value, original: { info, info: { disallowed, disallowed_rule } } } = row; </s> remove info: { name, whois_info },
</s> add info: {
name, whois_info, disallowed, disallowed_rule,
}, </s> remove const getOptions = (optionToActionMap) => {
const options = Object.entries(optionToActionMap);
</s> add const getOptions = (options) => { </s> remove const onClick = () => toggleClientStatus(type, ip);
</s> add const onClick = () => toggleClientStatus(ip, disallowed, disallowed_rule);
const text = disallowed ? BLOCK_ACTIONS.UNBLOCK : BLOCK_ACTIONS.BLOCK; | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/c72cd58f69b71e4981d8b182b2f7d53ea5e30868 | client/src/components/Dashboard/Clients.js |
<mask> subtitle,
<mask> }) => {
<mask> const { t } = useTranslation();
<mask> const topClients = useSelector((state) => state.stats.topClients, shallowEqual);
<mask> const disallowedClients = useSelector((state) => state.access.disallowed_clients, shallowEqual);
<mask>
<mask> return <Card
<mask> title={t('top_clients')}
<mask> subtitle={subtitle}
<mask> bodyType="card-table"
</s> + client: Move the client access check to the server-side
Squashed commit of the following:
commit 1aab0f62e94ce665a1b996552fac41dc4e769b4d
Merge: cdf5eb6e c1f5fdae
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 24 15:36:05 2020 +0300
Merge branch '1920-client-find' into feature/1925
commit cdf5eb6ea67a665d21a3155d8cf89bba9a5a9948
Merge: b6c20b1c 10f67bd3
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 23 20:28:51 2020 +0300
Merge branch 'master' into feature/1925
commit b6c20b1c7359a0e5902405b0551712f936848a80
Merge: 97d388ef 96512433
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 15 10:44:25 2020 +0300
Merge branch 'master' into feature/1925
commit 97d388ef6571d590f21da00f86d889e881ca0c3d
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 15 10:30:50 2020 +0300
Extract buttons
commit ca45fde11fc2b2812ff2b84dbd67aff0b5341be1
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 10 12:46:09 2020 +0300
Handle errors in updateLogs
commit f15e03c2e5a7115db984f70f72b0ddd870ece73d
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 10 12:39:34 2020 +0300
Update mobile block status on click
commit 033b28db3b324f6d529ac1a0ef657886cdbe02bd
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 20:53:42 2020 +0300
Fix mobile block buttons, auto open page on web serve start
commit 2730937b23309167a066b9154728ac53ffe81a49
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 13:58:37 2020 +0300
Disable allow this client button when isNotInAllowedList is true
commit 818cf869d63654c184762ad2701c4429a3e3011e
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 13:06:01 2020 +0300
Update client block state on option click
commit a072b8983757f419645c0207ea78e6e867c440cb
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 20:17:16 2020 +0300
Adapt to api changes
commit 28ab2bd8b3f14f60bc822b5a69fa1801db67d816
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 14:12:20 2020 +0300
Change query log block confirm messages
commit 9b0b6f6f9b1ec168fa71dbedd036152da59006e3
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 12:00:46 2020 +0300
Refactor inner work with disallowed
commit 05f76154b8f489738d032fdaa835edb371ce70c7
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Mon Sep 7 16:11:37 2020 +0300
+ client: Move the client access check to the server-side </s> remove const disallowed_clients = useSelector(
(state) => state.access.disallowed_clients,
shallowEqual,
);
</s> add </s> remove info: { name, whois_info },
</s> add info: {
name, whois_info, disallowed, disallowed_rule,
}, </s> remove const renderBlockingButton = (ip) => {
</s> add const renderBlockingButton = (ip, disallowed, disallowed_rule) => { </s> remove const disallowed_clients = useSelector(
(state) => state.access.disallowed_clients, shallowEqual,
);
const ipMatchListStatus = getIpMatchListStatus(ip, disallowed_clients);
if (ipMatchListStatus === IP_MATCH_LIST_STATUS.CIDR) {
return null;
}
const isNotFound = ipMatchListStatus === IP_MATCH_LIST_STATUS.NOT_FOUND;
const type = isNotFound ? BLOCK_ACTIONS.BLOCK : BLOCK_ACTIONS.UNBLOCK;
const text = type;
</s> add </s> remove const disallowed_clients = useSelector(
(state) => state.access.disallowed_clients,
shallowEqual,
);
</s> add | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/c72cd58f69b71e4981d8b182b2f7d53ea5e30868 | client/src/components/Dashboard/Clients.js | |
const { info: { disallowed } } = rowInfo.original; | <mask> if (!rowInfo) {
<mask> return {};
<mask> }
<mask>
<mask> const { ip } = rowInfo.original;
<mask>
<mask> return getIpMatchListStatus(ip, disallowedClients) === IP_MATCH_LIST_STATUS.NOT_FOUND ? {} : { className: 'logs__row--red' };
<mask> }}
<mask> />
<mask> </Card>;
</s> + client: Move the client access check to the server-side
Squashed commit of the following:
commit 1aab0f62e94ce665a1b996552fac41dc4e769b4d
Merge: cdf5eb6e c1f5fdae
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 24 15:36:05 2020 +0300
Merge branch '1920-client-find' into feature/1925
commit cdf5eb6ea67a665d21a3155d8cf89bba9a5a9948
Merge: b6c20b1c 10f67bd3
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 23 20:28:51 2020 +0300
Merge branch 'master' into feature/1925
commit b6c20b1c7359a0e5902405b0551712f936848a80
Merge: 97d388ef 96512433
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 15 10:44:25 2020 +0300
Merge branch 'master' into feature/1925
commit 97d388ef6571d590f21da00f86d889e881ca0c3d
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 15 10:30:50 2020 +0300
Extract buttons
commit ca45fde11fc2b2812ff2b84dbd67aff0b5341be1
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 10 12:46:09 2020 +0300
Handle errors in updateLogs
commit f15e03c2e5a7115db984f70f72b0ddd870ece73d
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 10 12:39:34 2020 +0300
Update mobile block status on click
commit 033b28db3b324f6d529ac1a0ef657886cdbe02bd
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 20:53:42 2020 +0300
Fix mobile block buttons, auto open page on web serve start
commit 2730937b23309167a066b9154728ac53ffe81a49
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 13:58:37 2020 +0300
Disable allow this client button when isNotInAllowedList is true
commit 818cf869d63654c184762ad2701c4429a3e3011e
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 13:06:01 2020 +0300
Update client block state on option click
commit a072b8983757f419645c0207ea78e6e867c440cb
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 20:17:16 2020 +0300
Adapt to api changes
commit 28ab2bd8b3f14f60bc822b5a69fa1801db67d816
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 14:12:20 2020 +0300
Change query log block confirm messages
commit 9b0b6f6f9b1ec168fa71dbedd036152da59006e3
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 12:00:46 2020 +0300
Refactor inner work with disallowed
commit 05f76154b8f489738d032fdaa835edb371ce70c7
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Mon Sep 7 16:11:37 2020 +0300
+ client: Move the client access check to the server-side </s> remove return getIpMatchListStatus(ip, disallowedClients) === IP_MATCH_LIST_STATUS.NOT_FOUND ? {} : { className: 'logs__row--red' };
</s> add return disallowed ? { className: 'logs__row--red' } : {}; </s> remove const disallowed_clients = useSelector(
(state) => state.access.disallowed_clients, shallowEqual,
);
const ipMatchListStatus = getIpMatchListStatus(ip, disallowed_clients);
if (ipMatchListStatus === IP_MATCH_LIST_STATUS.CIDR) {
return null;
}
const isNotFound = ipMatchListStatus === IP_MATCH_LIST_STATUS.NOT_FOUND;
const type = isNotFound ? BLOCK_ACTIONS.BLOCK : BLOCK_ACTIONS.UNBLOCK;
const text = type;
</s> add </s> remove const toggleClientStatus = (type, ip) => {
const confirmMessage = type === BLOCK_ACTIONS.BLOCK
? `${t('adg_will_drop_dns_queries')} ${t('client_confirm_block', { ip })}`
: t('client_confirm_unblock', { ip });
</s> add const toggleClientStatus = async (ip, disallowed, disallowed_rule) => {
const confirmMessage = disallowed
? t('client_confirm_unblock', { ip: disallowed_rule })
: `${t('adg_will_drop_dns_queries')} ${t('client_confirm_block', { ip })}`; </s> remove /**
* @param ip {string}
* @param list {string}
* @returns {'EXACT' | 'CIDR' | 'NOT_FOND'}
*/
export const getIpMatchListStatus = (ip, list) => {
if (!ip || !list) {
return IP_MATCH_LIST_STATUS.NOT_FOUND;
}
const listArr = list.trim()
.split('\n');
try {
for (let i = 0; i < listArr.length; i += 1) {
const listItem = listArr[i];
if (ip === listItem.trim()) {
return IP_MATCH_LIST_STATUS.EXACT;
}
// Using ipaddr.js is quite slow so we first do a quick check
// to see if it's possible that this IP may be in the specified CIDR range
if (isIpQuickMatchCIDR(ip, listItem)) {
const parsedIp = ipaddr.parse(ip);
const isItemAnIp = ipaddr.isValid(listItem);
const parsedItem = isItemAnIp ? ipaddr.parse(listItem) : ipaddr.parseCIDR(listItem);
if (isItemAnIp && parsedIp.toString() === parsedItem.toString()) {
return IP_MATCH_LIST_STATUS.EXACT;
}
if (!isItemAnIp && isIpMatchCidr(parsedIp, parsedItem)) {
return IP_MATCH_LIST_STATUS.CIDR;
}
}
}
return IP_MATCH_LIST_STATUS.NOT_FOUND;
} catch (e) {
console.error(e);
return IP_MATCH_LIST_STATUS.NOT_FOUND;
}
};
</s> add </s> remove dispatch(toggleClientBlock(type, ip));
</s> add await dispatch(toggleClientBlock(ip, disallowed, disallowed_rule));
await dispatch(getStats()); | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/c72cd58f69b71e4981d8b182b2f7d53ea5e30868 | client/src/components/Dashboard/Clients.js |
return disallowed ? { className: 'logs__row--red' } : {}; | <mask> }
<mask>
<mask> const { ip } = rowInfo.original;
<mask>
<mask> return getIpMatchListStatus(ip, disallowedClients) === IP_MATCH_LIST_STATUS.NOT_FOUND ? {} : { className: 'logs__row--red' };
<mask> }}
<mask> />
<mask> </Card>;
<mask> };
<mask>
</s> + client: Move the client access check to the server-side
Squashed commit of the following:
commit 1aab0f62e94ce665a1b996552fac41dc4e769b4d
Merge: cdf5eb6e c1f5fdae
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 24 15:36:05 2020 +0300
Merge branch '1920-client-find' into feature/1925
commit cdf5eb6ea67a665d21a3155d8cf89bba9a5a9948
Merge: b6c20b1c 10f67bd3
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 23 20:28:51 2020 +0300
Merge branch 'master' into feature/1925
commit b6c20b1c7359a0e5902405b0551712f936848a80
Merge: 97d388ef 96512433
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 15 10:44:25 2020 +0300
Merge branch 'master' into feature/1925
commit 97d388ef6571d590f21da00f86d889e881ca0c3d
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 15 10:30:50 2020 +0300
Extract buttons
commit ca45fde11fc2b2812ff2b84dbd67aff0b5341be1
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 10 12:46:09 2020 +0300
Handle errors in updateLogs
commit f15e03c2e5a7115db984f70f72b0ddd870ece73d
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 10 12:39:34 2020 +0300
Update mobile block status on click
commit 033b28db3b324f6d529ac1a0ef657886cdbe02bd
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 20:53:42 2020 +0300
Fix mobile block buttons, auto open page on web serve start
commit 2730937b23309167a066b9154728ac53ffe81a49
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 13:58:37 2020 +0300
Disable allow this client button when isNotInAllowedList is true
commit 818cf869d63654c184762ad2701c4429a3e3011e
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 13:06:01 2020 +0300
Update client block state on option click
commit a072b8983757f419645c0207ea78e6e867c440cb
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 20:17:16 2020 +0300
Adapt to api changes
commit 28ab2bd8b3f14f60bc822b5a69fa1801db67d816
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 14:12:20 2020 +0300
Change query log block confirm messages
commit 9b0b6f6f9b1ec168fa71dbedd036152da59006e3
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 12:00:46 2020 +0300
Refactor inner work with disallowed
commit 05f76154b8f489738d032fdaa835edb371ce70c7
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Mon Sep 7 16:11:37 2020 +0300
+ client: Move the client access check to the server-side </s> remove const { ip } = rowInfo.original;
</s> add const { info: { disallowed } } = rowInfo.original; </s> remove const disallowed_clients = useSelector(
(state) => state.access.disallowed_clients, shallowEqual,
);
const ipMatchListStatus = getIpMatchListStatus(ip, disallowed_clients);
if (ipMatchListStatus === IP_MATCH_LIST_STATUS.CIDR) {
return null;
}
const isNotFound = ipMatchListStatus === IP_MATCH_LIST_STATUS.NOT_FOUND;
const type = isNotFound ? BLOCK_ACTIONS.BLOCK : BLOCK_ACTIONS.UNBLOCK;
const text = type;
</s> add </s> remove const toggleClientStatus = (type, ip) => {
const confirmMessage = type === BLOCK_ACTIONS.BLOCK
? `${t('adg_will_drop_dns_queries')} ${t('client_confirm_block', { ip })}`
: t('client_confirm_unblock', { ip });
</s> add const toggleClientStatus = async (ip, disallowed, disallowed_rule) => {
const confirmMessage = disallowed
? t('client_confirm_unblock', { ip: disallowed_rule })
: `${t('adg_will_drop_dns_queries')} ${t('client_confirm_block', { ip })}`; </s> remove dispatch(toggleClientBlock(type, ip));
</s> add await dispatch(toggleClientBlock(ip, disallowed, disallowed_rule));
await dispatch(getStats()); </s> remove /**
* @param ip {string}
* @param list {string}
* @returns {'EXACT' | 'CIDR' | 'NOT_FOND'}
*/
export const getIpMatchListStatus = (ip, list) => {
if (!ip || !list) {
return IP_MATCH_LIST_STATUS.NOT_FOUND;
}
const listArr = list.trim()
.split('\n');
try {
for (let i = 0; i < listArr.length; i += 1) {
const listItem = listArr[i];
if (ip === listItem.trim()) {
return IP_MATCH_LIST_STATUS.EXACT;
}
// Using ipaddr.js is quite slow so we first do a quick check
// to see if it's possible that this IP may be in the specified CIDR range
if (isIpQuickMatchCIDR(ip, listItem)) {
const parsedIp = ipaddr.parse(ip);
const isItemAnIp = ipaddr.isValid(listItem);
const parsedItem = isItemAnIp ? ipaddr.parse(listItem) : ipaddr.parseCIDR(listItem);
if (isItemAnIp && parsedIp.toString() === parsedItem.toString()) {
return IP_MATCH_LIST_STATUS.EXACT;
}
if (!isItemAnIp && isIpMatchCidr(parsedIp, parsedItem)) {
return IP_MATCH_LIST_STATUS.CIDR;
}
}
}
return IP_MATCH_LIST_STATUS.NOT_FOUND;
} catch (e) {
console.error(e);
return IP_MATCH_LIST_STATUS.NOT_FOUND;
}
};
</s> add | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/c72cd58f69b71e4981d8b182b2f7d53ea5e30868 | client/src/components/Dashboard/Clients.js |
import { getStats } from '../../../actions/stats';
import { updateLogs } from '../../../actions/queryLogs'; | <mask> import { renderFormattedClientCell } from '../../../helpers/renderFormattedClientCell';
<mask> import { toggleClientBlock } from '../../../actions/access';
<mask> import { getBlockClientInfo } from './helpers';
<mask>
<mask> const ClientCell = ({
<mask> client,
<mask> domain,
<mask> info,
<mask> info: {
</s> + client: Move the client access check to the server-side
Squashed commit of the following:
commit 1aab0f62e94ce665a1b996552fac41dc4e769b4d
Merge: cdf5eb6e c1f5fdae
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 24 15:36:05 2020 +0300
Merge branch '1920-client-find' into feature/1925
commit cdf5eb6ea67a665d21a3155d8cf89bba9a5a9948
Merge: b6c20b1c 10f67bd3
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 23 20:28:51 2020 +0300
Merge branch 'master' into feature/1925
commit b6c20b1c7359a0e5902405b0551712f936848a80
Merge: 97d388ef 96512433
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 15 10:44:25 2020 +0300
Merge branch 'master' into feature/1925
commit 97d388ef6571d590f21da00f86d889e881ca0c3d
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 15 10:30:50 2020 +0300
Extract buttons
commit ca45fde11fc2b2812ff2b84dbd67aff0b5341be1
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 10 12:46:09 2020 +0300
Handle errors in updateLogs
commit f15e03c2e5a7115db984f70f72b0ddd870ece73d
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 10 12:39:34 2020 +0300
Update mobile block status on click
commit 033b28db3b324f6d529ac1a0ef657886cdbe02bd
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 20:53:42 2020 +0300
Fix mobile block buttons, auto open page on web serve start
commit 2730937b23309167a066b9154728ac53ffe81a49
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 13:58:37 2020 +0300
Disable allow this client button when isNotInAllowedList is true
commit 818cf869d63654c184762ad2701c4429a3e3011e
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 13:06:01 2020 +0300
Update client block state on option click
commit a072b8983757f419645c0207ea78e6e867c440cb
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 20:17:16 2020 +0300
Adapt to api changes
commit 28ab2bd8b3f14f60bc822b5a69fa1801db67d816
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 14:12:20 2020 +0300
Change query log block confirm messages
commit 9b0b6f6f9b1ec168fa71dbedd036152da59006e3
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 12:00:46 2020 +0300
Refactor inner work with disallowed
commit 05f76154b8f489738d032fdaa835edb371ce70c7
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Mon Sep 7 16:11:37 2020 +0300
+ client: Move the client access check to the server-side </s> remove import { getPercent, getIpMatchListStatus, sortIp } from '../../helpers/helpers';
import { BLOCK_ACTIONS, IP_MATCH_LIST_STATUS, STATUS_COLORS } from '../../helpers/constants';
</s> add import { getPercent, sortIp } from '../../helpers/helpers';
import { BLOCK_ACTIONS, STATUS_COLORS } from '../../helpers/constants'; </s> remove import { getIpMatchListStatus } from '../../../../helpers/helpers';
import { BLOCK_ACTIONS, IP_MATCH_LIST_STATUS } from '../../../../helpers/constants';
</s> add import i18next from 'i18next'; </s> remove import { BLOCK_ACTIONS } from '../helpers/constants';
</s> add | [
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/c72cd58f69b71e4981d8b182b2f7d53ea5e30868 | client/src/components/Logs/Cells/ClientCell.js |
info: {
name, whois_info, disallowed, disallowed_rule,
}, | <mask> const ClientCell = ({
<mask> client,
<mask> domain,
<mask> info,
<mask> info: { name, whois_info },
<mask> reason,
<mask> }) => {
<mask> const { t } = useTranslation();
<mask> const dispatch = useDispatch();
<mask> const autoClients = useSelector((state) => state.dashboard.autoClients, shallowEqual);
</s> + client: Move the client access check to the server-side
Squashed commit of the following:
commit 1aab0f62e94ce665a1b996552fac41dc4e769b4d
Merge: cdf5eb6e c1f5fdae
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 24 15:36:05 2020 +0300
Merge branch '1920-client-find' into feature/1925
commit cdf5eb6ea67a665d21a3155d8cf89bba9a5a9948
Merge: b6c20b1c 10f67bd3
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 23 20:28:51 2020 +0300
Merge branch 'master' into feature/1925
commit b6c20b1c7359a0e5902405b0551712f936848a80
Merge: 97d388ef 96512433
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 15 10:44:25 2020 +0300
Merge branch 'master' into feature/1925
commit 97d388ef6571d590f21da00f86d889e881ca0c3d
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 15 10:30:50 2020 +0300
Extract buttons
commit ca45fde11fc2b2812ff2b84dbd67aff0b5341be1
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 10 12:46:09 2020 +0300
Handle errors in updateLogs
commit f15e03c2e5a7115db984f70f72b0ddd870ece73d
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 10 12:39:34 2020 +0300
Update mobile block status on click
commit 033b28db3b324f6d529ac1a0ef657886cdbe02bd
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 20:53:42 2020 +0300
Fix mobile block buttons, auto open page on web serve start
commit 2730937b23309167a066b9154728ac53ffe81a49
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 13:58:37 2020 +0300
Disable allow this client button when isNotInAllowedList is true
commit 818cf869d63654c184762ad2701c4429a3e3011e
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 13:06:01 2020 +0300
Update client block state on option click
commit a072b8983757f419645c0207ea78e6e867c440cb
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 20:17:16 2020 +0300
Adapt to api changes
commit 28ab2bd8b3f14f60bc822b5a69fa1801db67d816
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 14:12:20 2020 +0300
Change query log block confirm messages
commit 9b0b6f6f9b1ec168fa71dbedd036152da59006e3
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 12:00:46 2020 +0300
Refactor inner work with disallowed
commit 05f76154b8f489738d032fdaa835edb371ce70c7
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Mon Sep 7 16:11:37 2020 +0300
+ client: Move the client access check to the server-side </s> remove const disallowedClients = useSelector((state) => state.access.disallowed_clients, shallowEqual);
</s> add </s> remove const disallowed_clients = useSelector(
(state) => state.access.disallowed_clients,
shallowEqual,
);
</s> add </s> remove const renderBlockingButton = (ip) => {
</s> add const renderBlockingButton = (ip, disallowed, disallowed_rule) => { </s> remove const disallowed_clients = useSelector(
(state) => state.access.disallowed_clients, shallowEqual,
);
const ipMatchListStatus = getIpMatchListStatus(ip, disallowed_clients);
if (ipMatchListStatus === IP_MATCH_LIST_STATUS.CIDR) {
return null;
}
const isNotFound = ipMatchListStatus === IP_MATCH_LIST_STATUS.NOT_FOUND;
const type = isNotFound ? BLOCK_ACTIONS.BLOCK : BLOCK_ACTIONS.UNBLOCK;
const text = type;
</s> add | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/c72cd58f69b71e4981d8b182b2f7d53ea5e30868 | client/src/components/Logs/Cells/ClientCell.js |
<mask> const processingRules = useSelector((state) => state.filtering.processingRules);
<mask> const isDetailed = useSelector((state) => state.queryLogs.isDetailed);
<mask> const [isOptionsOpened, setOptionsOpened] = useState(false);
<mask>
<mask> const disallowed_clients = useSelector(
<mask> (state) => state.access.disallowed_clients,
<mask> shallowEqual,
<mask> );
<mask>
<mask> const autoClient = autoClients.find((autoClient) => autoClient.name === client);
<mask> const source = autoClient?.source;
<mask> const whoisAvailable = whois_info && Object.keys(whois_info).length > 0;
<mask>
<mask> const id = nanoid();
</s> + client: Move the client access check to the server-side
Squashed commit of the following:
commit 1aab0f62e94ce665a1b996552fac41dc4e769b4d
Merge: cdf5eb6e c1f5fdae
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 24 15:36:05 2020 +0300
Merge branch '1920-client-find' into feature/1925
commit cdf5eb6ea67a665d21a3155d8cf89bba9a5a9948
Merge: b6c20b1c 10f67bd3
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 23 20:28:51 2020 +0300
Merge branch 'master' into feature/1925
commit b6c20b1c7359a0e5902405b0551712f936848a80
Merge: 97d388ef 96512433
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 15 10:44:25 2020 +0300
Merge branch 'master' into feature/1925
commit 97d388ef6571d590f21da00f86d889e881ca0c3d
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 15 10:30:50 2020 +0300
Extract buttons
commit ca45fde11fc2b2812ff2b84dbd67aff0b5341be1
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 10 12:46:09 2020 +0300
Handle errors in updateLogs
commit f15e03c2e5a7115db984f70f72b0ddd870ece73d
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 10 12:39:34 2020 +0300
Update mobile block status on click
commit 033b28db3b324f6d529ac1a0ef657886cdbe02bd
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 20:53:42 2020 +0300
Fix mobile block buttons, auto open page on web serve start
commit 2730937b23309167a066b9154728ac53ffe81a49
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 13:58:37 2020 +0300
Disable allow this client button when isNotInAllowedList is true
commit 818cf869d63654c184762ad2701c4429a3e3011e
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 13:06:01 2020 +0300
Update client block state on option click
commit a072b8983757f419645c0207ea78e6e867c440cb
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 20:17:16 2020 +0300
Adapt to api changes
commit 28ab2bd8b3f14f60bc822b5a69fa1801db67d816
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 14:12:20 2020 +0300
Change query log block confirm messages
commit 9b0b6f6f9b1ec168fa71dbedd036152da59006e3
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 12:00:46 2020 +0300
Refactor inner work with disallowed
commit 05f76154b8f489738d032fdaa835edb371ce70c7
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Mon Sep 7 16:11:37 2020 +0300
+ client: Move the client access check to the server-side </s> remove const disallowed_clients = useSelector(
(state) => state.access.disallowed_clients,
shallowEqual,
);
</s> add </s> remove const renderBlockingButton = (ip) => {
</s> add const renderBlockingButton = (ip, disallowed, disallowed_rule) => { </s> remove const disallowed_clients = useSelector(
(state) => state.access.disallowed_clients, shallowEqual,
);
const ipMatchListStatus = getIpMatchListStatus(ip, disallowed_clients);
if (ipMatchListStatus === IP_MATCH_LIST_STATUS.CIDR) {
return null;
}
const isNotFound = ipMatchListStatus === IP_MATCH_LIST_STATUS.NOT_FOUND;
const type = isNotFound ? BLOCK_ACTIONS.BLOCK : BLOCK_ACTIONS.UNBLOCK;
const text = type;
</s> add </s> remove const disallowedClients = useSelector((state) => state.access.disallowed_clients, shallowEqual);
</s> add </s> remove info: { name, whois_info },
</s> add info: {
name, whois_info, disallowed, disallowed_rule,
}, | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/c72cd58f69b71e4981d8b182b2f7d53ea5e30868 | client/src/components/Logs/Cells/ClientCell.js | |
isNotInAllowedList,
} = getBlockClientInfo(client, disallowed, disallowed_rule); | <mask>
<mask> const {
<mask> confirmMessage,
<mask> buttonKey: blockingClientKey,
<mask> type,
<mask> } = getBlockClientInfo(client, disallowed_clients);
<mask>
<mask> const blockingForClientKey = isFiltered ? 'unblock_for_this_client_only' : 'block_for_this_client_only';
<mask> const clientNameBlockingFor = getBlockingClientName(clients, client);
<mask>
<mask> const BUTTON_OPTIONS_TO_ACTION_MAP = {
</s> + client: Move the client access check to the server-side
Squashed commit of the following:
commit 1aab0f62e94ce665a1b996552fac41dc4e769b4d
Merge: cdf5eb6e c1f5fdae
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 24 15:36:05 2020 +0300
Merge branch '1920-client-find' into feature/1925
commit cdf5eb6ea67a665d21a3155d8cf89bba9a5a9948
Merge: b6c20b1c 10f67bd3
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 23 20:28:51 2020 +0300
Merge branch 'master' into feature/1925
commit b6c20b1c7359a0e5902405b0551712f936848a80
Merge: 97d388ef 96512433
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 15 10:44:25 2020 +0300
Merge branch 'master' into feature/1925
commit 97d388ef6571d590f21da00f86d889e881ca0c3d
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 15 10:30:50 2020 +0300
Extract buttons
commit ca45fde11fc2b2812ff2b84dbd67aff0b5341be1
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 10 12:46:09 2020 +0300
Handle errors in updateLogs
commit f15e03c2e5a7115db984f70f72b0ddd870ece73d
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 10 12:39:34 2020 +0300
Update mobile block status on click
commit 033b28db3b324f6d529ac1a0ef657886cdbe02bd
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 20:53:42 2020 +0300
Fix mobile block buttons, auto open page on web serve start
commit 2730937b23309167a066b9154728ac53ffe81a49
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 13:58:37 2020 +0300
Disable allow this client button when isNotInAllowedList is true
commit 818cf869d63654c184762ad2701c4429a3e3011e
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 13:06:01 2020 +0300
Update client block state on option click
commit a072b8983757f419645c0207ea78e6e867c440cb
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 20:17:16 2020 +0300
Adapt to api changes
commit 28ab2bd8b3f14f60bc822b5a69fa1801db67d816
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 14:12:20 2020 +0300
Change query log block confirm messages
commit 9b0b6f6f9b1ec168fa71dbedd036152da59006e3
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 12:00:46 2020 +0300
Refactor inner work with disallowed
commit 05f76154b8f489738d032fdaa835edb371ce70c7
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Mon Sep 7 16:11:37 2020 +0300
+ client: Move the client access check to the server-side </s> remove type: blockType,
} = getBlockClientInfo(client, disallowed_clients);
</s> add isNotInAllowedList,
} = getBlockClientInfo(client, disallowed, disallowed_rule); </s> remove const BUTTON_OPTIONS_TO_ACTION_MAP = {
[blockingForClientKey]: () => {
dispatch(toggleBlockingForClient(buttonType, domain, clientNameBlockingFor));
</s> add const BUTTON_OPTIONS = [
{
name: blockingForClientKey,
onClick: () => {
dispatch(toggleBlockingForClient(buttonType, domain, clientNameBlockingFor));
}, </s> remove const confirmMessage = isNotFound ? 'client_confirm_block' : 'client_confirm_unblock';
const buttonKey = isNotFound ? 'disallow_this_client' : 'allow_this_client';
</s> add </s> remove const isNotFound = ipMatchListStatus === IP_MATCH_LIST_STATUS.NOT_FOUND;
const type = isNotFound ? BLOCK_ACTIONS.BLOCK : BLOCK_ACTIONS.UNBLOCK;
</s> add const buttonKey = i18next.t(disallowed ? 'allow_this_client' : 'disallow_this_client');
const isNotInAllowedList = disallowed && disallowed_rule === ''; </s> remove type,
</s> add isNotInAllowedList, | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/c72cd58f69b71e4981d8b182b2f7d53ea5e30868 | client/src/components/Logs/Cells/ClientCell.js |
const BUTTON_OPTIONS = [
{
name: blockingForClientKey,
onClick: () => {
dispatch(toggleBlockingForClient(buttonType, domain, clientNameBlockingFor));
}, | <mask>
<mask> const blockingForClientKey = isFiltered ? 'unblock_for_this_client_only' : 'block_for_this_client_only';
<mask> const clientNameBlockingFor = getBlockingClientName(clients, client);
<mask>
<mask> const BUTTON_OPTIONS_TO_ACTION_MAP = {
<mask> [blockingForClientKey]: () => {
<mask> dispatch(toggleBlockingForClient(buttonType, domain, clientNameBlockingFor));
<mask> },
<mask> [blockingClientKey]: () => {
<mask> const message = `${type === BLOCK_ACTIONS.BLOCK ? t('adg_will_drop_dns_queries') : ''} ${t(confirmMessage, { ip: client })}`;
<mask> if (window.confirm(message)) {
<mask> dispatch(toggleClientBlock(type, client));
</s> + client: Move the client access check to the server-side
Squashed commit of the following:
commit 1aab0f62e94ce665a1b996552fac41dc4e769b4d
Merge: cdf5eb6e c1f5fdae
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 24 15:36:05 2020 +0300
Merge branch '1920-client-find' into feature/1925
commit cdf5eb6ea67a665d21a3155d8cf89bba9a5a9948
Merge: b6c20b1c 10f67bd3
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 23 20:28:51 2020 +0300
Merge branch 'master' into feature/1925
commit b6c20b1c7359a0e5902405b0551712f936848a80
Merge: 97d388ef 96512433
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 15 10:44:25 2020 +0300
Merge branch 'master' into feature/1925
commit 97d388ef6571d590f21da00f86d889e881ca0c3d
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 15 10:30:50 2020 +0300
Extract buttons
commit ca45fde11fc2b2812ff2b84dbd67aff0b5341be1
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 10 12:46:09 2020 +0300
Handle errors in updateLogs
commit f15e03c2e5a7115db984f70f72b0ddd870ece73d
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 10 12:39:34 2020 +0300
Update mobile block status on click
commit 033b28db3b324f6d529ac1a0ef657886cdbe02bd
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 20:53:42 2020 +0300
Fix mobile block buttons, auto open page on web serve start
commit 2730937b23309167a066b9154728ac53ffe81a49
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 13:58:37 2020 +0300
Disable allow this client button when isNotInAllowedList is true
commit 818cf869d63654c184762ad2701c4429a3e3011e
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 13:06:01 2020 +0300
Update client block state on option click
commit a072b8983757f419645c0207ea78e6e867c440cb
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 20:17:16 2020 +0300
Adapt to api changes
commit 28ab2bd8b3f14f60bc822b5a69fa1801db67d816
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 14:12:20 2020 +0300
Change query log block confirm messages
commit 9b0b6f6f9b1ec168fa71dbedd036152da59006e3
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 12:00:46 2020 +0300
Refactor inner work with disallowed
commit 05f76154b8f489738d032fdaa835edb371ce70c7
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Mon Sep 7 16:11:37 2020 +0300
+ client: Move the client access check to the server-side </s> remove [blockingClientKey]: () => {
const message = `${type === BLOCK_ACTIONS.BLOCK ? t('adg_will_drop_dns_queries') : ''} ${t(confirmMessage, { ip: client })}`;
if (window.confirm(message)) {
dispatch(toggleClientBlock(type, client));
}
</s> add {
name: blockingClientKey,
onClick: async () => {
if (window.confirm(confirmMessage)) {
await dispatch(toggleClientBlock(client, disallowed, disallowed_rule));
await dispatch(updateLogs());
}
},
disabled: isNotInAllowedList, </s> remove const onBlockingClientClick = () => {
const message = `${blockType === BLOCK_ACTIONS.BLOCK ? t('adg_will_drop_dns_queries') : ''} ${t(confirmMessage, { ip: client })}`;
if (window.confirm(message)) {
dispatch(toggleClientBlock(blockType, client));
</s> add const onBlockingClientClick = async () => {
if (window.confirm(confirmMessage)) {
await dispatch(toggleClientBlock(client, disallowed, disallowed_rule));
await dispatch(updateLogs());
setModalOpened(false); </s> remove type: blockType,
} = getBlockClientInfo(client, disallowed_clients);
</s> add isNotInAllowedList,
} = getBlockClientInfo(client, disallowed, disallowed_rule); </s> remove type,
} = getBlockClientInfo(client, disallowed_clients);
</s> add isNotInAllowedList,
} = getBlockClientInfo(client, disallowed, disallowed_rule); </s> remove };
</s> add ]; | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/c72cd58f69b71e4981d8b182b2f7d53ea5e30868 | client/src/components/Logs/Cells/ClientCell.js |
{
name: blockingClientKey,
onClick: async () => {
if (window.confirm(confirmMessage)) {
await dispatch(toggleClientBlock(client, disallowed, disallowed_rule));
await dispatch(updateLogs());
}
},
disabled: isNotInAllowedList, | <mask> const BUTTON_OPTIONS_TO_ACTION_MAP = {
<mask> [blockingForClientKey]: () => {
<mask> dispatch(toggleBlockingForClient(buttonType, domain, clientNameBlockingFor));
<mask> },
<mask> [blockingClientKey]: () => {
<mask> const message = `${type === BLOCK_ACTIONS.BLOCK ? t('adg_will_drop_dns_queries') : ''} ${t(confirmMessage, { ip: client })}`;
<mask> if (window.confirm(message)) {
<mask> dispatch(toggleClientBlock(type, client));
<mask> }
<mask> },
<mask> };
<mask>
<mask> const onClick = async () => {
<mask> await dispatch(toggleBlocking(buttonType, domain));
</s> + client: Move the client access check to the server-side
Squashed commit of the following:
commit 1aab0f62e94ce665a1b996552fac41dc4e769b4d
Merge: cdf5eb6e c1f5fdae
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 24 15:36:05 2020 +0300
Merge branch '1920-client-find' into feature/1925
commit cdf5eb6ea67a665d21a3155d8cf89bba9a5a9948
Merge: b6c20b1c 10f67bd3
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 23 20:28:51 2020 +0300
Merge branch 'master' into feature/1925
commit b6c20b1c7359a0e5902405b0551712f936848a80
Merge: 97d388ef 96512433
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 15 10:44:25 2020 +0300
Merge branch 'master' into feature/1925
commit 97d388ef6571d590f21da00f86d889e881ca0c3d
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 15 10:30:50 2020 +0300
Extract buttons
commit ca45fde11fc2b2812ff2b84dbd67aff0b5341be1
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 10 12:46:09 2020 +0300
Handle errors in updateLogs
commit f15e03c2e5a7115db984f70f72b0ddd870ece73d
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 10 12:39:34 2020 +0300
Update mobile block status on click
commit 033b28db3b324f6d529ac1a0ef657886cdbe02bd
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 20:53:42 2020 +0300
Fix mobile block buttons, auto open page on web serve start
commit 2730937b23309167a066b9154728ac53ffe81a49
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 13:58:37 2020 +0300
Disable allow this client button when isNotInAllowedList is true
commit 818cf869d63654c184762ad2701c4429a3e3011e
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 13:06:01 2020 +0300
Update client block state on option click
commit a072b8983757f419645c0207ea78e6e867c440cb
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 20:17:16 2020 +0300
Adapt to api changes
commit 28ab2bd8b3f14f60bc822b5a69fa1801db67d816
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 14:12:20 2020 +0300
Change query log block confirm messages
commit 9b0b6f6f9b1ec168fa71dbedd036152da59006e3
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 12:00:46 2020 +0300
Refactor inner work with disallowed
commit 05f76154b8f489738d032fdaa835edb371ce70c7
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Mon Sep 7 16:11:37 2020 +0300
+ client: Move the client access check to the server-side </s> remove const BUTTON_OPTIONS_TO_ACTION_MAP = {
[blockingForClientKey]: () => {
dispatch(toggleBlockingForClient(buttonType, domain, clientNameBlockingFor));
</s> add const BUTTON_OPTIONS = [
{
name: blockingForClientKey,
onClick: () => {
dispatch(toggleBlockingForClient(buttonType, domain, clientNameBlockingFor));
}, </s> remove const onBlockingClientClick = () => {
const message = `${blockType === BLOCK_ACTIONS.BLOCK ? t('adg_will_drop_dns_queries') : ''} ${t(confirmMessage, { ip: client })}`;
if (window.confirm(message)) {
dispatch(toggleClientBlock(blockType, client));
</s> add const onBlockingClientClick = async () => {
if (window.confirm(confirmMessage)) {
await dispatch(toggleClientBlock(client, disallowed, disallowed_rule));
await dispatch(updateLogs());
setModalOpened(false); </s> remove };
</s> add ]; </s> remove const getOptions = (optionToActionMap) => {
const options = Object.entries(optionToActionMap);
</s> add const getOptions = (options) => { | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/c72cd58f69b71e4981d8b182b2f7d53ea5e30868 | client/src/components/Logs/Cells/ClientCell.js |
]; | <mask> if (window.confirm(message)) {
<mask> dispatch(toggleClientBlock(type, client));
<mask> }
<mask> },
<mask> };
<mask>
<mask> const onClick = async () => {
<mask> await dispatch(toggleBlocking(buttonType, domain));
<mask> };
<mask>
</s> + client: Move the client access check to the server-side
Squashed commit of the following:
commit 1aab0f62e94ce665a1b996552fac41dc4e769b4d
Merge: cdf5eb6e c1f5fdae
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 24 15:36:05 2020 +0300
Merge branch '1920-client-find' into feature/1925
commit cdf5eb6ea67a665d21a3155d8cf89bba9a5a9948
Merge: b6c20b1c 10f67bd3
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 23 20:28:51 2020 +0300
Merge branch 'master' into feature/1925
commit b6c20b1c7359a0e5902405b0551712f936848a80
Merge: 97d388ef 96512433
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 15 10:44:25 2020 +0300
Merge branch 'master' into feature/1925
commit 97d388ef6571d590f21da00f86d889e881ca0c3d
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 15 10:30:50 2020 +0300
Extract buttons
commit ca45fde11fc2b2812ff2b84dbd67aff0b5341be1
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 10 12:46:09 2020 +0300
Handle errors in updateLogs
commit f15e03c2e5a7115db984f70f72b0ddd870ece73d
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 10 12:39:34 2020 +0300
Update mobile block status on click
commit 033b28db3b324f6d529ac1a0ef657886cdbe02bd
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 20:53:42 2020 +0300
Fix mobile block buttons, auto open page on web serve start
commit 2730937b23309167a066b9154728ac53ffe81a49
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 13:58:37 2020 +0300
Disable allow this client button when isNotInAllowedList is true
commit 818cf869d63654c184762ad2701c4429a3e3011e
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 13:06:01 2020 +0300
Update client block state on option click
commit a072b8983757f419645c0207ea78e6e867c440cb
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 20:17:16 2020 +0300
Adapt to api changes
commit 28ab2bd8b3f14f60bc822b5a69fa1801db67d816
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 14:12:20 2020 +0300
Change query log block confirm messages
commit 9b0b6f6f9b1ec168fa71dbedd036152da59006e3
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 12:00:46 2020 +0300
Refactor inner work with disallowed
commit 05f76154b8f489738d032fdaa835edb371ce70c7
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Mon Sep 7 16:11:37 2020 +0300
+ client: Move the client access check to the server-side </s> remove [blockingClientKey]: () => {
const message = `${type === BLOCK_ACTIONS.BLOCK ? t('adg_will_drop_dns_queries') : ''} ${t(confirmMessage, { ip: client })}`;
if (window.confirm(message)) {
dispatch(toggleClientBlock(type, client));
}
</s> add {
name: blockingClientKey,
onClick: async () => {
if (window.confirm(confirmMessage)) {
await dispatch(toggleClientBlock(client, disallowed, disallowed_rule));
await dispatch(updateLogs());
}
},
disabled: isNotInAllowedList, </s> remove const getOptions = (optionToActionMap) => {
const options = Object.entries(optionToActionMap);
</s> add const getOptions = (options) => { </s> remove const onBlockingClientClick = () => {
const message = `${blockType === BLOCK_ACTIONS.BLOCK ? t('adg_will_drop_dns_queries') : ''} ${t(confirmMessage, { ip: client })}`;
if (window.confirm(message)) {
dispatch(toggleClientBlock(blockType, client));
</s> add const onBlockingClientClick = async () => {
if (window.confirm(confirmMessage)) {
await dispatch(toggleClientBlock(client, disallowed, disallowed_rule));
await dispatch(updateLogs());
setModalOpened(false); </s> remove const BUTTON_OPTIONS_TO_ACTION_MAP = {
[blockingForClientKey]: () => {
dispatch(toggleBlockingForClient(buttonType, domain, clientNameBlockingFor));
</s> add const BUTTON_OPTIONS = [
{
name: blockingForClientKey,
onClick: () => {
dispatch(toggleBlockingForClient(buttonType, domain, clientNameBlockingFor));
}, | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/c72cd58f69b71e4981d8b182b2f7d53ea5e30868 | client/src/components/Logs/Cells/ClientCell.js |
await dispatch(getStats()); | <mask>
<mask> const onClick = async () => {
<mask> await dispatch(toggleBlocking(buttonType, domain));
<mask> };
<mask>
<mask> const getOptions = (options) => {
<mask> if (options.length === 0) {
<mask> return null;
</s> + client: Move the client access check to the server-side
Squashed commit of the following:
commit 1aab0f62e94ce665a1b996552fac41dc4e769b4d
Merge: cdf5eb6e c1f5fdae
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 24 15:36:05 2020 +0300
Merge branch '1920-client-find' into feature/1925
commit cdf5eb6ea67a665d21a3155d8cf89bba9a5a9948
Merge: b6c20b1c 10f67bd3
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 23 20:28:51 2020 +0300
Merge branch 'master' into feature/1925
commit b6c20b1c7359a0e5902405b0551712f936848a80
Merge: 97d388ef 96512433
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 15 10:44:25 2020 +0300
Merge branch 'master' into feature/1925
commit 97d388ef6571d590f21da00f86d889e881ca0c3d
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 15 10:30:50 2020 +0300
Extract buttons
commit ca45fde11fc2b2812ff2b84dbd67aff0b5341be1
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 10 12:46:09 2020 +0300
Handle errors in updateLogs
commit f15e03c2e5a7115db984f70f72b0ddd870ece73d
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 10 12:39:34 2020 +0300
Update mobile block status on click
commit 033b28db3b324f6d529ac1a0ef657886cdbe02bd
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 20:53:42 2020 +0300
Fix mobile block buttons, auto open page on web serve start
commit 2730937b23309167a066b9154728ac53ffe81a49
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 13:58:37 2020 +0300
Disable allow this client button when isNotInAllowedList is true
commit 818cf869d63654c184762ad2701c4429a3e3011e
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 13:06:01 2020 +0300
Update client block state on option click
commit a072b8983757f419645c0207ea78e6e867c440cb
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 20:17:16 2020 +0300
Adapt to api changes
commit 28ab2bd8b3f14f60bc822b5a69fa1801db67d816
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 14:12:20 2020 +0300
Change query log block confirm messages
commit 9b0b6f6f9b1ec168fa71dbedd036152da59006e3
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 12:00:46 2020 +0300
Refactor inner work with disallowed
commit 05f76154b8f489738d032fdaa835edb371ce70c7
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Mon Sep 7 16:11:37 2020 +0300
+ client: Move the client access check to the server-side </s> remove const getOptions = (optionToActionMap) => {
const options = Object.entries(optionToActionMap);
</s> add const getOptions = (options) => { </s> remove };
</s> add ]; </s> remove [blockingClientKey]: () => {
const message = `${type === BLOCK_ACTIONS.BLOCK ? t('adg_will_drop_dns_queries') : ''} ${t(confirmMessage, { ip: client })}`;
if (window.confirm(message)) {
dispatch(toggleClientBlock(type, client));
}
</s> add {
name: blockingClientKey,
onClick: async () => {
if (window.confirm(confirmMessage)) {
await dispatch(toggleClientBlock(client, disallowed, disallowed_rule));
await dispatch(updateLogs());
}
},
disabled: isNotInAllowedList, </s> remove return <>{options
.map(([name, onClick]) => <div
</s> add return <>{options.map(({ name, onClick, disabled }) => <button | [
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/c72cd58f69b71e4981d8b182b2f7d53ea5e30868 | client/src/components/Logs/Cells/ClientCell.js |
const getOptions = (options) => { | <mask> const onClick = async () => {
<mask> await dispatch(toggleBlocking(buttonType, domain));
<mask> };
<mask>
<mask> const getOptions = (optionToActionMap) => {
<mask> const options = Object.entries(optionToActionMap);
<mask> if (options.length === 0) {
<mask> return null;
<mask> }
<mask> return <>{options
<mask> .map(([name, onClick]) => <div
</s> + client: Move the client access check to the server-side
Squashed commit of the following:
commit 1aab0f62e94ce665a1b996552fac41dc4e769b4d
Merge: cdf5eb6e c1f5fdae
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 24 15:36:05 2020 +0300
Merge branch '1920-client-find' into feature/1925
commit cdf5eb6ea67a665d21a3155d8cf89bba9a5a9948
Merge: b6c20b1c 10f67bd3
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 23 20:28:51 2020 +0300
Merge branch 'master' into feature/1925
commit b6c20b1c7359a0e5902405b0551712f936848a80
Merge: 97d388ef 96512433
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 15 10:44:25 2020 +0300
Merge branch 'master' into feature/1925
commit 97d388ef6571d590f21da00f86d889e881ca0c3d
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 15 10:30:50 2020 +0300
Extract buttons
commit ca45fde11fc2b2812ff2b84dbd67aff0b5341be1
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 10 12:46:09 2020 +0300
Handle errors in updateLogs
commit f15e03c2e5a7115db984f70f72b0ddd870ece73d
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 10 12:39:34 2020 +0300
Update mobile block status on click
commit 033b28db3b324f6d529ac1a0ef657886cdbe02bd
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 20:53:42 2020 +0300
Fix mobile block buttons, auto open page on web serve start
commit 2730937b23309167a066b9154728ac53ffe81a49
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 13:58:37 2020 +0300
Disable allow this client button when isNotInAllowedList is true
commit 818cf869d63654c184762ad2701c4429a3e3011e
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 13:06:01 2020 +0300
Update client block state on option click
commit a072b8983757f419645c0207ea78e6e867c440cb
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 20:17:16 2020 +0300
Adapt to api changes
commit 28ab2bd8b3f14f60bc822b5a69fa1801db67d816
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 14:12:20 2020 +0300
Change query log block confirm messages
commit 9b0b6f6f9b1ec168fa71dbedd036152da59006e3
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 12:00:46 2020 +0300
Refactor inner work with disallowed
commit 05f76154b8f489738d032fdaa835edb371ce70c7
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Mon Sep 7 16:11:37 2020 +0300
+ client: Move the client access check to the server-side </s> remove return <>{options
.map(([name, onClick]) => <div
</s> add return <>{options.map(({ name, onClick, disabled }) => <button </s> remove };
</s> add ]; </s> remove [blockingClientKey]: () => {
const message = `${type === BLOCK_ACTIONS.BLOCK ? t('adg_will_drop_dns_queries') : ''} ${t(confirmMessage, { ip: client })}`;
if (window.confirm(message)) {
dispatch(toggleClientBlock(type, client));
}
</s> add {
name: blockingClientKey,
onClick: async () => {
if (window.confirm(confirmMessage)) {
await dispatch(toggleClientBlock(client, disallowed, disallowed_rule));
await dispatch(updateLogs());
}
},
disabled: isNotInAllowedList, | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/c72cd58f69b71e4981d8b182b2f7d53ea5e30868 | client/src/components/Logs/Cells/ClientCell.js |
return <>{options.map(({ name, onClick, disabled }) => <button | <mask> const options = Object.entries(optionToActionMap);
<mask> if (options.length === 0) {
<mask> return null;
<mask> }
<mask> return <>{options
<mask> .map(([name, onClick]) => <div
<mask> key={name}
<mask> className="button-action--arrow-option px-4 py-2"
<mask> onClick={onClick}
<mask> >{t(name)}
<mask> </div>)}</>;
</s> + client: Move the client access check to the server-side
Squashed commit of the following:
commit 1aab0f62e94ce665a1b996552fac41dc4e769b4d
Merge: cdf5eb6e c1f5fdae
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 24 15:36:05 2020 +0300
Merge branch '1920-client-find' into feature/1925
commit cdf5eb6ea67a665d21a3155d8cf89bba9a5a9948
Merge: b6c20b1c 10f67bd3
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 23 20:28:51 2020 +0300
Merge branch 'master' into feature/1925
commit b6c20b1c7359a0e5902405b0551712f936848a80
Merge: 97d388ef 96512433
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 15 10:44:25 2020 +0300
Merge branch 'master' into feature/1925
commit 97d388ef6571d590f21da00f86d889e881ca0c3d
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 15 10:30:50 2020 +0300
Extract buttons
commit ca45fde11fc2b2812ff2b84dbd67aff0b5341be1
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 10 12:46:09 2020 +0300
Handle errors in updateLogs
commit f15e03c2e5a7115db984f70f72b0ddd870ece73d
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 10 12:39:34 2020 +0300
Update mobile block status on click
commit 033b28db3b324f6d529ac1a0ef657886cdbe02bd
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 20:53:42 2020 +0300
Fix mobile block buttons, auto open page on web serve start
commit 2730937b23309167a066b9154728ac53ffe81a49
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 13:58:37 2020 +0300
Disable allow this client button when isNotInAllowedList is true
commit 818cf869d63654c184762ad2701c4429a3e3011e
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 13:06:01 2020 +0300
Update client block state on option click
commit a072b8983757f419645c0207ea78e6e867c440cb
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 20:17:16 2020 +0300
Adapt to api changes
commit 28ab2bd8b3f14f60bc822b5a69fa1801db67d816
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 14:12:20 2020 +0300
Change query log block confirm messages
commit 9b0b6f6f9b1ec168fa71dbedd036152da59006e3
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 12:00:46 2020 +0300
Refactor inner work with disallowed
commit 05f76154b8f489738d032fdaa835edb371ce70c7
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Mon Sep 7 16:11:37 2020 +0300
+ client: Move the client access check to the server-side </s> remove const getOptions = (optionToActionMap) => {
const options = Object.entries(optionToActionMap);
</s> add const getOptions = (options) => { </s> remove </div>)}</>;
</s> add </button>)}</>; </s> remove const content = getOptions(BUTTON_OPTIONS_TO_ACTION_MAP);
</s> add const content = getOptions(BUTTON_OPTIONS); | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/c72cd58f69b71e4981d8b182b2f7d53ea5e30868 | client/src/components/Logs/Cells/ClientCell.js |
disabled={disabled} | <mask> return <>{options.map(({ name, onClick, disabled }) => <button
<mask> key={name}
<mask> className="button-action--arrow-option px-4 py-2"
<mask> onClick={onClick}
<mask> >{t(name)}
<mask> </button>)}</>;
<mask> };
<mask>
</s> + client: Move the client access check to the server-side
Squashed commit of the following:
commit 1aab0f62e94ce665a1b996552fac41dc4e769b4d
Merge: cdf5eb6e c1f5fdae
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 24 15:36:05 2020 +0300
Merge branch '1920-client-find' into feature/1925
commit cdf5eb6ea67a665d21a3155d8cf89bba9a5a9948
Merge: b6c20b1c 10f67bd3
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 23 20:28:51 2020 +0300
Merge branch 'master' into feature/1925
commit b6c20b1c7359a0e5902405b0551712f936848a80
Merge: 97d388ef 96512433
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 15 10:44:25 2020 +0300
Merge branch 'master' into feature/1925
commit 97d388ef6571d590f21da00f86d889e881ca0c3d
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 15 10:30:50 2020 +0300
Extract buttons
commit ca45fde11fc2b2812ff2b84dbd67aff0b5341be1
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 10 12:46:09 2020 +0300
Handle errors in updateLogs
commit f15e03c2e5a7115db984f70f72b0ddd870ece73d
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 10 12:39:34 2020 +0300
Update mobile block status on click
commit 033b28db3b324f6d529ac1a0ef657886cdbe02bd
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 20:53:42 2020 +0300
Fix mobile block buttons, auto open page on web serve start
commit 2730937b23309167a066b9154728ac53ffe81a49
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 13:58:37 2020 +0300
Disable allow this client button when isNotInAllowedList is true
commit 818cf869d63654c184762ad2701c4429a3e3011e
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 13:06:01 2020 +0300
Update client block state on option click
commit a072b8983757f419645c0207ea78e6e867c440cb
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 20:17:16 2020 +0300
Adapt to api changes
commit 28ab2bd8b3f14f60bc822b5a69fa1801db67d816
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 14:12:20 2020 +0300
Change query log block confirm messages
commit 9b0b6f6f9b1ec168fa71dbedd036152da59006e3
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 12:00:46 2020 +0300
Refactor inner work with disallowed
commit 05f76154b8f489738d032fdaa835edb371ce70c7
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Mon Sep 7 16:11:37 2020 +0300
+ client: Move the client access check to the server-side </s> remove return <>{options
.map(([name, onClick]) => <div
</s> add return <>{options.map(({ name, onClick, disabled }) => <button </s> remove </div>)}</>;
</s> add </button>)}</>; </s> remove info: { name, whois_info },
</s> add info: {
name, whois_info, disallowed, disallowed_rule,
}, </s> remove <button
type="button"
className={buttonClass}
onClick={onClick}
disabled={processingSet}
>
<Trans>{text}</Trans>
</button>
</div>;
</s> add <button
type="button"
className={buttonClass}
onClick={isNotInAllowedList ? undefined : onClick}
disabled={isNotInAllowedList || processingSet}
title={t(isNotInAllowedList ? 'client_not_in_allowed_clients' : text)}
>
<Trans>{text}</Trans>
</button>
</div>; </s> remove const onClick = () => toggleClientStatus(type, ip);
</s> add const onClick = () => toggleClientStatus(ip, disallowed, disallowed_rule);
const text = disallowed ? BLOCK_ACTIONS.UNBLOCK : BLOCK_ACTIONS.BLOCK; | [
"keep",
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/c72cd58f69b71e4981d8b182b2f7d53ea5e30868 | client/src/components/Logs/Cells/ClientCell.js |
</button>)}</>; | <mask> key={name}
<mask> className="button-action--arrow-option px-4 py-2"
<mask> onClick={onClick}
<mask> >{t(name)}
<mask> </div>)}</>;
<mask> };
<mask>
<mask> const content = getOptions(BUTTON_OPTIONS_TO_ACTION_MAP);
<mask>
<mask> const buttonClass = classNames('button-action button-action--main', {
</s> + client: Move the client access check to the server-side
Squashed commit of the following:
commit 1aab0f62e94ce665a1b996552fac41dc4e769b4d
Merge: cdf5eb6e c1f5fdae
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 24 15:36:05 2020 +0300
Merge branch '1920-client-find' into feature/1925
commit cdf5eb6ea67a665d21a3155d8cf89bba9a5a9948
Merge: b6c20b1c 10f67bd3
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 23 20:28:51 2020 +0300
Merge branch 'master' into feature/1925
commit b6c20b1c7359a0e5902405b0551712f936848a80
Merge: 97d388ef 96512433
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 15 10:44:25 2020 +0300
Merge branch 'master' into feature/1925
commit 97d388ef6571d590f21da00f86d889e881ca0c3d
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 15 10:30:50 2020 +0300
Extract buttons
commit ca45fde11fc2b2812ff2b84dbd67aff0b5341be1
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 10 12:46:09 2020 +0300
Handle errors in updateLogs
commit f15e03c2e5a7115db984f70f72b0ddd870ece73d
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 10 12:39:34 2020 +0300
Update mobile block status on click
commit 033b28db3b324f6d529ac1a0ef657886cdbe02bd
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 20:53:42 2020 +0300
Fix mobile block buttons, auto open page on web serve start
commit 2730937b23309167a066b9154728ac53ffe81a49
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 13:58:37 2020 +0300
Disable allow this client button when isNotInAllowedList is true
commit 818cf869d63654c184762ad2701c4429a3e3011e
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 13:06:01 2020 +0300
Update client block state on option click
commit a072b8983757f419645c0207ea78e6e867c440cb
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 20:17:16 2020 +0300
Adapt to api changes
commit 28ab2bd8b3f14f60bc822b5a69fa1801db67d816
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 14:12:20 2020 +0300
Change query log block confirm messages
commit 9b0b6f6f9b1ec168fa71dbedd036152da59006e3
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 12:00:46 2020 +0300
Refactor inner work with disallowed
commit 05f76154b8f489738d032fdaa835edb371ce70c7
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Mon Sep 7 16:11:37 2020 +0300
+ client: Move the client access check to the server-side </s> remove const content = getOptions(BUTTON_OPTIONS_TO_ACTION_MAP);
</s> add const content = getOptions(BUTTON_OPTIONS); </s> remove return <>{options
.map(([name, onClick]) => <div
</s> add return <>{options.map(({ name, onClick, disabled }) => <button </s> remove 'button-action--unblock': !isNotFound,
</s> add 'button-action--unblock': disallowed, </s> remove const disallowed_clients = useSelector(
(state) => state.access.disallowed_clients, shallowEqual,
);
const ipMatchListStatus = getIpMatchListStatus(ip, disallowed_clients);
if (ipMatchListStatus === IP_MATCH_LIST_STATUS.CIDR) {
return null;
}
const isNotFound = ipMatchListStatus === IP_MATCH_LIST_STATUS.NOT_FOUND;
const type = isNotFound ? BLOCK_ACTIONS.BLOCK : BLOCK_ACTIONS.UNBLOCK;
const text = type;
</s> add | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/c72cd58f69b71e4981d8b182b2f7d53ea5e30868 | client/src/components/Logs/Cells/ClientCell.js |
const content = getOptions(BUTTON_OPTIONS); | <mask> >{t(name)}
<mask> </div>)}</>;
<mask> };
<mask>
<mask> const content = getOptions(BUTTON_OPTIONS_TO_ACTION_MAP);
<mask>
<mask> const buttonClass = classNames('button-action button-action--main', {
<mask> 'button-action--unblock': isFiltered,
<mask> 'button-action--with-options': content,
<mask> 'button-action--active': isOptionsOpened,
</s> + client: Move the client access check to the server-side
Squashed commit of the following:
commit 1aab0f62e94ce665a1b996552fac41dc4e769b4d
Merge: cdf5eb6e c1f5fdae
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 24 15:36:05 2020 +0300
Merge branch '1920-client-find' into feature/1925
commit cdf5eb6ea67a665d21a3155d8cf89bba9a5a9948
Merge: b6c20b1c 10f67bd3
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 23 20:28:51 2020 +0300
Merge branch 'master' into feature/1925
commit b6c20b1c7359a0e5902405b0551712f936848a80
Merge: 97d388ef 96512433
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 15 10:44:25 2020 +0300
Merge branch 'master' into feature/1925
commit 97d388ef6571d590f21da00f86d889e881ca0c3d
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 15 10:30:50 2020 +0300
Extract buttons
commit ca45fde11fc2b2812ff2b84dbd67aff0b5341be1
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 10 12:46:09 2020 +0300
Handle errors in updateLogs
commit f15e03c2e5a7115db984f70f72b0ddd870ece73d
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 10 12:39:34 2020 +0300
Update mobile block status on click
commit 033b28db3b324f6d529ac1a0ef657886cdbe02bd
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 20:53:42 2020 +0300
Fix mobile block buttons, auto open page on web serve start
commit 2730937b23309167a066b9154728ac53ffe81a49
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 13:58:37 2020 +0300
Disable allow this client button when isNotInAllowedList is true
commit 818cf869d63654c184762ad2701c4429a3e3011e
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 13:06:01 2020 +0300
Update client block state on option click
commit a072b8983757f419645c0207ea78e6e867c440cb
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 20:17:16 2020 +0300
Adapt to api changes
commit 28ab2bd8b3f14f60bc822b5a69fa1801db67d816
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 14:12:20 2020 +0300
Change query log block confirm messages
commit 9b0b6f6f9b1ec168fa71dbedd036152da59006e3
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 12:00:46 2020 +0300
Refactor inner work with disallowed
commit 05f76154b8f489738d032fdaa835edb371ce70c7
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Mon Sep 7 16:11:37 2020 +0300
+ client: Move the client access check to the server-side </s> remove </div>)}</>;
</s> add </button>)}</>; </s> remove 'button-action--unblock': !isNotFound,
</s> add 'button-action--unblock': disallowed, </s> remove const toggleClientStatus = (type, ip) => {
const confirmMessage = type === BLOCK_ACTIONS.BLOCK
? `${t('adg_will_drop_dns_queries')} ${t('client_confirm_block', { ip })}`
: t('client_confirm_unblock', { ip });
</s> add const toggleClientStatus = async (ip, disallowed, disallowed_rule) => {
const confirmMessage = disallowed
? t('client_confirm_unblock', { ip: disallowed_rule })
: `${t('adg_will_drop_dns_queries')} ${t('client_confirm_block', { ip })}`; </s> remove const disallowed_clients = useSelector(
(state) => state.access.disallowed_clients, shallowEqual,
);
const ipMatchListStatus = getIpMatchListStatus(ip, disallowed_clients);
if (ipMatchListStatus === IP_MATCH_LIST_STATUS.CIDR) {
return null;
}
const isNotFound = ipMatchListStatus === IP_MATCH_LIST_STATUS.NOT_FOUND;
const type = isNotFound ? BLOCK_ACTIONS.BLOCK : BLOCK_ACTIONS.UNBLOCK;
const text = type;
</s> add </s> remove return <>{options
.map(([name, onClick]) => <div
</s> add return <>{options.map(({ name, onClick, disabled }) => <button | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/c72cd58f69b71e4981d8b182b2f7d53ea5e30868 | client/src/components/Logs/Cells/ClientCell.js |
disallowed: propTypes.bool.isRequired,
disallowed_rule: propTypes.string.isRequired, | <mask> orgname: propTypes.string,
<mask> }),
<mask> }),
<mask> ]),
<mask> reason: propTypes.string.isRequired,
<mask> };
<mask>
<mask> export default ClientCell;
</s> + client: Move the client access check to the server-side
Squashed commit of the following:
commit 1aab0f62e94ce665a1b996552fac41dc4e769b4d
Merge: cdf5eb6e c1f5fdae
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 24 15:36:05 2020 +0300
Merge branch '1920-client-find' into feature/1925
commit cdf5eb6ea67a665d21a3155d8cf89bba9a5a9948
Merge: b6c20b1c 10f67bd3
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 23 20:28:51 2020 +0300
Merge branch 'master' into feature/1925
commit b6c20b1c7359a0e5902405b0551712f936848a80
Merge: 97d388ef 96512433
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 15 10:44:25 2020 +0300
Merge branch 'master' into feature/1925
commit 97d388ef6571d590f21da00f86d889e881ca0c3d
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 15 10:30:50 2020 +0300
Extract buttons
commit ca45fde11fc2b2812ff2b84dbd67aff0b5341be1
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 10 12:46:09 2020 +0300
Handle errors in updateLogs
commit f15e03c2e5a7115db984f70f72b0ddd870ece73d
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 10 12:39:34 2020 +0300
Update mobile block status on click
commit 033b28db3b324f6d529ac1a0ef657886cdbe02bd
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 20:53:42 2020 +0300
Fix mobile block buttons, auto open page on web serve start
commit 2730937b23309167a066b9154728ac53ffe81a49
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 13:58:37 2020 +0300
Disable allow this client button when isNotInAllowedList is true
commit 818cf869d63654c184762ad2701c4429a3e3011e
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 13:06:01 2020 +0300
Update client block state on option click
commit a072b8983757f419645c0207ea78e6e867c440cb
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 20:17:16 2020 +0300
Adapt to api changes
commit 28ab2bd8b3f14f60bc822b5a69fa1801db67d816
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 14:12:20 2020 +0300
Change query log block confirm messages
commit 9b0b6f6f9b1ec168fa71dbedd036152da59006e3
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 12:00:46 2020 +0300
Refactor inner work with disallowed
commit 05f76154b8f489738d032fdaa835edb371ce70c7
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Mon Sep 7 16:11:37 2020 +0300
+ client: Move the client access check to the server-side </s> remove export const toggleClientBlock = (type, ip) => async (dispatch) => {
</s> add export const toggleClientBlock = (ip, disallowed, disallowed_rule) => async (dispatch) => { </s> remove import { BLOCK_ACTIONS } from '../helpers/constants';
</s> add </s> remove export const IP_MATCH_LIST_STATUS = {
NOT_FOUND: 'NOT_FOUND', // not found in the list
EXACT: 'EXACT', // found exact match (including the match of short and long forms)
CIDR: 'CIDR', // the ip is in the specified CIDR range
};
</s> add </s> remove export const addClientInfo = (data, clients, param) => (
data.map((row) => {
const clientIp = row[param];
const info = clients.find((item) => item[clientIp]) || '';
return {
...row,
info: info?.[clientIp] ?? '',
};
})
);
</s> add export const addClientInfo = (data, clients, param) => data.map((row) => {
const clientIp = row[param];
const info = clients.find((item) => item[clientIp]) || '';
return {
...row,
info: info?.[clientIp] ?? '',
};
}); </s> remove import { getIpMatchListStatus } from '../../../../helpers/helpers';
import { BLOCK_ACTIONS, IP_MATCH_LIST_STATUS } from '../../../../helpers/constants';
</s> add import i18next from 'i18next'; | [
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/c72cd58f69b71e4981d8b182b2f7d53ea5e30868 | client/src/components/Logs/Cells/ClientCell.js |
import i18next from 'i18next'; | <mask> import { getIpMatchListStatus } from '../../../../helpers/helpers';
<mask> import { BLOCK_ACTIONS, IP_MATCH_LIST_STATUS } from '../../../../helpers/constants';
<mask>
<mask> export const BUTTON_PREFIX = 'btn_';
<mask>
<mask> export const getBlockClientInfo = (client, disallowed_clients) => {
<mask> const ipMatchListStatus = getIpMatchListStatus(client, disallowed_clients);
</s> + client: Move the client access check to the server-side
Squashed commit of the following:
commit 1aab0f62e94ce665a1b996552fac41dc4e769b4d
Merge: cdf5eb6e c1f5fdae
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 24 15:36:05 2020 +0300
Merge branch '1920-client-find' into feature/1925
commit cdf5eb6ea67a665d21a3155d8cf89bba9a5a9948
Merge: b6c20b1c 10f67bd3
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 23 20:28:51 2020 +0300
Merge branch 'master' into feature/1925
commit b6c20b1c7359a0e5902405b0551712f936848a80
Merge: 97d388ef 96512433
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 15 10:44:25 2020 +0300
Merge branch 'master' into feature/1925
commit 97d388ef6571d590f21da00f86d889e881ca0c3d
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 15 10:30:50 2020 +0300
Extract buttons
commit ca45fde11fc2b2812ff2b84dbd67aff0b5341be1
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 10 12:46:09 2020 +0300
Handle errors in updateLogs
commit f15e03c2e5a7115db984f70f72b0ddd870ece73d
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 10 12:39:34 2020 +0300
Update mobile block status on click
commit 033b28db3b324f6d529ac1a0ef657886cdbe02bd
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 20:53:42 2020 +0300
Fix mobile block buttons, auto open page on web serve start
commit 2730937b23309167a066b9154728ac53ffe81a49
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 13:58:37 2020 +0300
Disable allow this client button when isNotInAllowedList is true
commit 818cf869d63654c184762ad2701c4429a3e3011e
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 13:06:01 2020 +0300
Update client block state on option click
commit a072b8983757f419645c0207ea78e6e867c440cb
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 20:17:16 2020 +0300
Adapt to api changes
commit 28ab2bd8b3f14f60bc822b5a69fa1801db67d816
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 14:12:20 2020 +0300
Change query log block confirm messages
commit 9b0b6f6f9b1ec168fa71dbedd036152da59006e3
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 12:00:46 2020 +0300
Refactor inner work with disallowed
commit 05f76154b8f489738d032fdaa835edb371ce70c7
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Mon Sep 7 16:11:37 2020 +0300
+ client: Move the client access check to the server-side </s> remove export const getBlockClientInfo = (client, disallowed_clients) => {
const ipMatchListStatus = getIpMatchListStatus(client, disallowed_clients);
</s> add export const getBlockClientInfo = (ip, disallowed, disallowed_rule) => {
const confirmMessage = disallowed
? i18next.t('client_confirm_unblock', { ip: disallowed_rule })
: `${i18next.t('adg_will_drop_dns_queries')} ${i18next.t('client_confirm_block', { ip })}`; </s> remove import { BLOCK_ACTIONS } from '../helpers/constants';
</s> add </s> remove const isNotFound = ipMatchListStatus === IP_MATCH_LIST_STATUS.NOT_FOUND;
const type = isNotFound ? BLOCK_ACTIONS.BLOCK : BLOCK_ACTIONS.UNBLOCK;
</s> add const buttonKey = i18next.t(disallowed ? 'allow_this_client' : 'disallow_this_client');
const isNotInAllowedList = disallowed && disallowed_rule === ''; </s> remove import { getPercent, getIpMatchListStatus, sortIp } from '../../helpers/helpers';
import { BLOCK_ACTIONS, IP_MATCH_LIST_STATUS, STATUS_COLORS } from '../../helpers/constants';
</s> add import { getPercent, sortIp } from '../../helpers/helpers';
import { BLOCK_ACTIONS, STATUS_COLORS } from '../../helpers/constants'; | [
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/c72cd58f69b71e4981d8b182b2f7d53ea5e30868 | client/src/components/Logs/Cells/helpers/index.js |
export const getBlockClientInfo = (ip, disallowed, disallowed_rule) => {
const confirmMessage = disallowed
? i18next.t('client_confirm_unblock', { ip: disallowed_rule })
: `${i18next.t('adg_will_drop_dns_queries')} ${i18next.t('client_confirm_block', { ip })}`; | <mask> import { BLOCK_ACTIONS, IP_MATCH_LIST_STATUS } from '../../../../helpers/constants';
<mask>
<mask> export const BUTTON_PREFIX = 'btn_';
<mask>
<mask> export const getBlockClientInfo = (client, disallowed_clients) => {
<mask> const ipMatchListStatus = getIpMatchListStatus(client, disallowed_clients);
<mask>
<mask> const isNotFound = ipMatchListStatus === IP_MATCH_LIST_STATUS.NOT_FOUND;
<mask> const type = isNotFound ? BLOCK_ACTIONS.BLOCK : BLOCK_ACTIONS.UNBLOCK;
<mask>
<mask> const confirmMessage = isNotFound ? 'client_confirm_block' : 'client_confirm_unblock';
</s> + client: Move the client access check to the server-side
Squashed commit of the following:
commit 1aab0f62e94ce665a1b996552fac41dc4e769b4d
Merge: cdf5eb6e c1f5fdae
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 24 15:36:05 2020 +0300
Merge branch '1920-client-find' into feature/1925
commit cdf5eb6ea67a665d21a3155d8cf89bba9a5a9948
Merge: b6c20b1c 10f67bd3
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 23 20:28:51 2020 +0300
Merge branch 'master' into feature/1925
commit b6c20b1c7359a0e5902405b0551712f936848a80
Merge: 97d388ef 96512433
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 15 10:44:25 2020 +0300
Merge branch 'master' into feature/1925
commit 97d388ef6571d590f21da00f86d889e881ca0c3d
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 15 10:30:50 2020 +0300
Extract buttons
commit ca45fde11fc2b2812ff2b84dbd67aff0b5341be1
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 10 12:46:09 2020 +0300
Handle errors in updateLogs
commit f15e03c2e5a7115db984f70f72b0ddd870ece73d
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 10 12:39:34 2020 +0300
Update mobile block status on click
commit 033b28db3b324f6d529ac1a0ef657886cdbe02bd
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 20:53:42 2020 +0300
Fix mobile block buttons, auto open page on web serve start
commit 2730937b23309167a066b9154728ac53ffe81a49
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 13:58:37 2020 +0300
Disable allow this client button when isNotInAllowedList is true
commit 818cf869d63654c184762ad2701c4429a3e3011e
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 13:06:01 2020 +0300
Update client block state on option click
commit a072b8983757f419645c0207ea78e6e867c440cb
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 20:17:16 2020 +0300
Adapt to api changes
commit 28ab2bd8b3f14f60bc822b5a69fa1801db67d816
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 14:12:20 2020 +0300
Change query log block confirm messages
commit 9b0b6f6f9b1ec168fa71dbedd036152da59006e3
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 12:00:46 2020 +0300
Refactor inner work with disallowed
commit 05f76154b8f489738d032fdaa835edb371ce70c7
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Mon Sep 7 16:11:37 2020 +0300
+ client: Move the client access check to the server-side </s> remove const isNotFound = ipMatchListStatus === IP_MATCH_LIST_STATUS.NOT_FOUND;
const type = isNotFound ? BLOCK_ACTIONS.BLOCK : BLOCK_ACTIONS.UNBLOCK;
</s> add const buttonKey = i18next.t(disallowed ? 'allow_this_client' : 'disallow_this_client');
const isNotInAllowedList = disallowed && disallowed_rule === ''; </s> remove import { getIpMatchListStatus } from '../../../../helpers/helpers';
import { BLOCK_ACTIONS, IP_MATCH_LIST_STATUS } from '../../../../helpers/constants';
</s> add import i18next from 'i18next'; </s> remove const confirmMessage = isNotFound ? 'client_confirm_block' : 'client_confirm_unblock';
const buttonKey = isNotFound ? 'disallow_this_client' : 'allow_this_client';
</s> add </s> remove const disallowed_clients = useSelector(
(state) => state.access.disallowed_clients, shallowEqual,
);
const ipMatchListStatus = getIpMatchListStatus(ip, disallowed_clients);
if (ipMatchListStatus === IP_MATCH_LIST_STATUS.CIDR) {
return null;
}
const isNotFound = ipMatchListStatus === IP_MATCH_LIST_STATUS.NOT_FOUND;
const type = isNotFound ? BLOCK_ACTIONS.BLOCK : BLOCK_ACTIONS.UNBLOCK;
const text = type;
</s> add </s> remove 'button-action--unblock': !isNotFound,
</s> add 'button-action--unblock': disallowed, | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/c72cd58f69b71e4981d8b182b2f7d53ea5e30868 | client/src/components/Logs/Cells/helpers/index.js |
const buttonKey = i18next.t(disallowed ? 'allow_this_client' : 'disallow_this_client');
const isNotInAllowedList = disallowed && disallowed_rule === ''; | <mask>
<mask> export const getBlockClientInfo = (client, disallowed_clients) => {
<mask> const ipMatchListStatus = getIpMatchListStatus(client, disallowed_clients);
<mask>
<mask> const isNotFound = ipMatchListStatus === IP_MATCH_LIST_STATUS.NOT_FOUND;
<mask> const type = isNotFound ? BLOCK_ACTIONS.BLOCK : BLOCK_ACTIONS.UNBLOCK;
<mask>
<mask> const confirmMessage = isNotFound ? 'client_confirm_block' : 'client_confirm_unblock';
<mask> const buttonKey = isNotFound ? 'disallow_this_client' : 'allow_this_client';
<mask> return {
<mask> confirmMessage,
</s> + client: Move the client access check to the server-side
Squashed commit of the following:
commit 1aab0f62e94ce665a1b996552fac41dc4e769b4d
Merge: cdf5eb6e c1f5fdae
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 24 15:36:05 2020 +0300
Merge branch '1920-client-find' into feature/1925
commit cdf5eb6ea67a665d21a3155d8cf89bba9a5a9948
Merge: b6c20b1c 10f67bd3
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 23 20:28:51 2020 +0300
Merge branch 'master' into feature/1925
commit b6c20b1c7359a0e5902405b0551712f936848a80
Merge: 97d388ef 96512433
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 15 10:44:25 2020 +0300
Merge branch 'master' into feature/1925
commit 97d388ef6571d590f21da00f86d889e881ca0c3d
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 15 10:30:50 2020 +0300
Extract buttons
commit ca45fde11fc2b2812ff2b84dbd67aff0b5341be1
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 10 12:46:09 2020 +0300
Handle errors in updateLogs
commit f15e03c2e5a7115db984f70f72b0ddd870ece73d
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 10 12:39:34 2020 +0300
Update mobile block status on click
commit 033b28db3b324f6d529ac1a0ef657886cdbe02bd
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 20:53:42 2020 +0300
Fix mobile block buttons, auto open page on web serve start
commit 2730937b23309167a066b9154728ac53ffe81a49
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 13:58:37 2020 +0300
Disable allow this client button when isNotInAllowedList is true
commit 818cf869d63654c184762ad2701c4429a3e3011e
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 13:06:01 2020 +0300
Update client block state on option click
commit a072b8983757f419645c0207ea78e6e867c440cb
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 20:17:16 2020 +0300
Adapt to api changes
commit 28ab2bd8b3f14f60bc822b5a69fa1801db67d816
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 14:12:20 2020 +0300
Change query log block confirm messages
commit 9b0b6f6f9b1ec168fa71dbedd036152da59006e3
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 12:00:46 2020 +0300
Refactor inner work with disallowed
commit 05f76154b8f489738d032fdaa835edb371ce70c7
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Mon Sep 7 16:11:37 2020 +0300
+ client: Move the client access check to the server-side </s> remove const confirmMessage = isNotFound ? 'client_confirm_block' : 'client_confirm_unblock';
const buttonKey = isNotFound ? 'disallow_this_client' : 'allow_this_client';
</s> add </s> remove export const getBlockClientInfo = (client, disallowed_clients) => {
const ipMatchListStatus = getIpMatchListStatus(client, disallowed_clients);
</s> add export const getBlockClientInfo = (ip, disallowed, disallowed_rule) => {
const confirmMessage = disallowed
? i18next.t('client_confirm_unblock', { ip: disallowed_rule })
: `${i18next.t('adg_will_drop_dns_queries')} ${i18next.t('client_confirm_block', { ip })}`; </s> remove const disallowed_clients = useSelector(
(state) => state.access.disallowed_clients, shallowEqual,
);
const ipMatchListStatus = getIpMatchListStatus(ip, disallowed_clients);
if (ipMatchListStatus === IP_MATCH_LIST_STATUS.CIDR) {
return null;
}
const isNotFound = ipMatchListStatus === IP_MATCH_LIST_STATUS.NOT_FOUND;
const type = isNotFound ? BLOCK_ACTIONS.BLOCK : BLOCK_ACTIONS.UNBLOCK;
const text = type;
</s> add </s> remove type,
</s> add isNotInAllowedList, </s> remove 'button-action--unblock': !isNotFound,
</s> add 'button-action--unblock': disallowed, | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/c72cd58f69b71e4981d8b182b2f7d53ea5e30868 | client/src/components/Logs/Cells/helpers/index.js |
<mask>
<mask> const isNotFound = ipMatchListStatus === IP_MATCH_LIST_STATUS.NOT_FOUND;
<mask> const type = isNotFound ? BLOCK_ACTIONS.BLOCK : BLOCK_ACTIONS.UNBLOCK;
<mask>
<mask> const confirmMessage = isNotFound ? 'client_confirm_block' : 'client_confirm_unblock';
<mask> const buttonKey = isNotFound ? 'disallow_this_client' : 'allow_this_client';
<mask> return {
<mask> confirmMessage,
<mask> buttonKey,
<mask> type,
<mask> };
</s> + client: Move the client access check to the server-side
Squashed commit of the following:
commit 1aab0f62e94ce665a1b996552fac41dc4e769b4d
Merge: cdf5eb6e c1f5fdae
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 24 15:36:05 2020 +0300
Merge branch '1920-client-find' into feature/1925
commit cdf5eb6ea67a665d21a3155d8cf89bba9a5a9948
Merge: b6c20b1c 10f67bd3
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 23 20:28:51 2020 +0300
Merge branch 'master' into feature/1925
commit b6c20b1c7359a0e5902405b0551712f936848a80
Merge: 97d388ef 96512433
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 15 10:44:25 2020 +0300
Merge branch 'master' into feature/1925
commit 97d388ef6571d590f21da00f86d889e881ca0c3d
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 15 10:30:50 2020 +0300
Extract buttons
commit ca45fde11fc2b2812ff2b84dbd67aff0b5341be1
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 10 12:46:09 2020 +0300
Handle errors in updateLogs
commit f15e03c2e5a7115db984f70f72b0ddd870ece73d
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 10 12:39:34 2020 +0300
Update mobile block status on click
commit 033b28db3b324f6d529ac1a0ef657886cdbe02bd
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 20:53:42 2020 +0300
Fix mobile block buttons, auto open page on web serve start
commit 2730937b23309167a066b9154728ac53ffe81a49
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 13:58:37 2020 +0300
Disable allow this client button when isNotInAllowedList is true
commit 818cf869d63654c184762ad2701c4429a3e3011e
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 13:06:01 2020 +0300
Update client block state on option click
commit a072b8983757f419645c0207ea78e6e867c440cb
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 20:17:16 2020 +0300
Adapt to api changes
commit 28ab2bd8b3f14f60bc822b5a69fa1801db67d816
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 14:12:20 2020 +0300
Change query log block confirm messages
commit 9b0b6f6f9b1ec168fa71dbedd036152da59006e3
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 12:00:46 2020 +0300
Refactor inner work with disallowed
commit 05f76154b8f489738d032fdaa835edb371ce70c7
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Mon Sep 7 16:11:37 2020 +0300
+ client: Move the client access check to the server-side </s> remove const isNotFound = ipMatchListStatus === IP_MATCH_LIST_STATUS.NOT_FOUND;
const type = isNotFound ? BLOCK_ACTIONS.BLOCK : BLOCK_ACTIONS.UNBLOCK;
</s> add const buttonKey = i18next.t(disallowed ? 'allow_this_client' : 'disallow_this_client');
const isNotInAllowedList = disallowed && disallowed_rule === ''; </s> remove type,
</s> add isNotInAllowedList, </s> remove export const getBlockClientInfo = (client, disallowed_clients) => {
const ipMatchListStatus = getIpMatchListStatus(client, disallowed_clients);
</s> add export const getBlockClientInfo = (ip, disallowed, disallowed_rule) => {
const confirmMessage = disallowed
? i18next.t('client_confirm_unblock', { ip: disallowed_rule })
: `${i18next.t('adg_will_drop_dns_queries')} ${i18next.t('client_confirm_block', { ip })}`; </s> remove const disallowed_clients = useSelector(
(state) => state.access.disallowed_clients, shallowEqual,
);
const ipMatchListStatus = getIpMatchListStatus(ip, disallowed_clients);
if (ipMatchListStatus === IP_MATCH_LIST_STATUS.CIDR) {
return null;
}
const isNotFound = ipMatchListStatus === IP_MATCH_LIST_STATUS.NOT_FOUND;
const type = isNotFound ? BLOCK_ACTIONS.BLOCK : BLOCK_ACTIONS.UNBLOCK;
const text = type;
</s> add </s> remove 'button-action--unblock': !isNotFound,
</s> add 'button-action--unblock': disallowed, | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/c72cd58f69b71e4981d8b182b2f7d53ea5e30868 | client/src/components/Logs/Cells/helpers/index.js | |
isNotInAllowedList, | <mask> const buttonKey = isNotFound ? 'disallow_this_client' : 'allow_this_client';
<mask> return {
<mask> confirmMessage,
<mask> buttonKey,
<mask> type,
<mask> };
<mask> };
</s> + client: Move the client access check to the server-side
Squashed commit of the following:
commit 1aab0f62e94ce665a1b996552fac41dc4e769b4d
Merge: cdf5eb6e c1f5fdae
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 24 15:36:05 2020 +0300
Merge branch '1920-client-find' into feature/1925
commit cdf5eb6ea67a665d21a3155d8cf89bba9a5a9948
Merge: b6c20b1c 10f67bd3
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 23 20:28:51 2020 +0300
Merge branch 'master' into feature/1925
commit b6c20b1c7359a0e5902405b0551712f936848a80
Merge: 97d388ef 96512433
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 15 10:44:25 2020 +0300
Merge branch 'master' into feature/1925
commit 97d388ef6571d590f21da00f86d889e881ca0c3d
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 15 10:30:50 2020 +0300
Extract buttons
commit ca45fde11fc2b2812ff2b84dbd67aff0b5341be1
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 10 12:46:09 2020 +0300
Handle errors in updateLogs
commit f15e03c2e5a7115db984f70f72b0ddd870ece73d
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 10 12:39:34 2020 +0300
Update mobile block status on click
commit 033b28db3b324f6d529ac1a0ef657886cdbe02bd
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 20:53:42 2020 +0300
Fix mobile block buttons, auto open page on web serve start
commit 2730937b23309167a066b9154728ac53ffe81a49
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 13:58:37 2020 +0300
Disable allow this client button when isNotInAllowedList is true
commit 818cf869d63654c184762ad2701c4429a3e3011e
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 13:06:01 2020 +0300
Update client block state on option click
commit a072b8983757f419645c0207ea78e6e867c440cb
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 20:17:16 2020 +0300
Adapt to api changes
commit 28ab2bd8b3f14f60bc822b5a69fa1801db67d816
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 14:12:20 2020 +0300
Change query log block confirm messages
commit 9b0b6f6f9b1ec168fa71dbedd036152da59006e3
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 12:00:46 2020 +0300
Refactor inner work with disallowed
commit 05f76154b8f489738d032fdaa835edb371ce70c7
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Mon Sep 7 16:11:37 2020 +0300
+ client: Move the client access check to the server-side </s> remove const confirmMessage = isNotFound ? 'client_confirm_block' : 'client_confirm_unblock';
const buttonKey = isNotFound ? 'disallow_this_client' : 'allow_this_client';
</s> add </s> remove const isNotFound = ipMatchListStatus === IP_MATCH_LIST_STATUS.NOT_FOUND;
const type = isNotFound ? BLOCK_ACTIONS.BLOCK : BLOCK_ACTIONS.UNBLOCK;
</s> add const buttonKey = i18next.t(disallowed ? 'allow_this_client' : 'disallow_this_client');
const isNotInAllowedList = disallowed && disallowed_rule === ''; </s> remove type,
} = getBlockClientInfo(client, disallowed_clients);
</s> add isNotInAllowedList,
} = getBlockClientInfo(client, disallowed, disallowed_rule); </s> remove export const getBlockClientInfo = (client, disallowed_clients) => {
const ipMatchListStatus = getIpMatchListStatus(client, disallowed_clients);
</s> add export const getBlockClientInfo = (ip, disallowed, disallowed_rule) => {
const confirmMessage = disallowed
? i18next.t('client_confirm_unblock', { ip: disallowed_rule })
: `${i18next.t('adg_will_drop_dns_queries')} ${i18next.t('client_confirm_block', { ip })}`; </s> remove const disallowed_clients = useSelector(
(state) => state.access.disallowed_clients, shallowEqual,
);
const ipMatchListStatus = getIpMatchListStatus(ip, disallowed_clients);
if (ipMatchListStatus === IP_MATCH_LIST_STATUS.CIDR) {
return null;
}
const isNotFound = ipMatchListStatus === IP_MATCH_LIST_STATUS.NOT_FOUND;
const type = isNotFound ? BLOCK_ACTIONS.BLOCK : BLOCK_ACTIONS.UNBLOCK;
const text = type;
</s> add | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/c72cd58f69b71e4981d8b182b2f7d53ea5e30868 | client/src/components/Logs/Cells/helpers/index.js |
import { updateLogs } from '../../../actions/queryLogs'; | <mask> import { toggleClientBlock } from '../../../actions/access';
<mask> import { getBlockClientInfo, BUTTON_PREFIX } from './helpers';
<mask>
<mask> const Row = memo(({
<mask> style,
<mask> rowProps,
</s> + client: Move the client access check to the server-side
Squashed commit of the following:
commit 1aab0f62e94ce665a1b996552fac41dc4e769b4d
Merge: cdf5eb6e c1f5fdae
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 24 15:36:05 2020 +0300
Merge branch '1920-client-find' into feature/1925
commit cdf5eb6ea67a665d21a3155d8cf89bba9a5a9948
Merge: b6c20b1c 10f67bd3
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 23 20:28:51 2020 +0300
Merge branch 'master' into feature/1925
commit b6c20b1c7359a0e5902405b0551712f936848a80
Merge: 97d388ef 96512433
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 15 10:44:25 2020 +0300
Merge branch 'master' into feature/1925
commit 97d388ef6571d590f21da00f86d889e881ca0c3d
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 15 10:30:50 2020 +0300
Extract buttons
commit ca45fde11fc2b2812ff2b84dbd67aff0b5341be1
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 10 12:46:09 2020 +0300
Handle errors in updateLogs
commit f15e03c2e5a7115db984f70f72b0ddd870ece73d
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 10 12:39:34 2020 +0300
Update mobile block status on click
commit 033b28db3b324f6d529ac1a0ef657886cdbe02bd
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 20:53:42 2020 +0300
Fix mobile block buttons, auto open page on web serve start
commit 2730937b23309167a066b9154728ac53ffe81a49
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 13:58:37 2020 +0300
Disable allow this client button when isNotInAllowedList is true
commit 818cf869d63654c184762ad2701c4429a3e3011e
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 13:06:01 2020 +0300
Update client block state on option click
commit a072b8983757f419645c0207ea78e6e867c440cb
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 20:17:16 2020 +0300
Adapt to api changes
commit 28ab2bd8b3f14f60bc822b5a69fa1801db67d816
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 14:12:20 2020 +0300
Change query log block confirm messages
commit 9b0b6f6f9b1ec168fa71dbedd036152da59006e3
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 12:00:46 2020 +0300
Refactor inner work with disallowed
commit 05f76154b8f489738d032fdaa835edb371ce70c7
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Mon Sep 7 16:11:37 2020 +0300
+ client: Move the client access check to the server-side </s> remove import { getIpMatchListStatus } from '../../../../helpers/helpers';
import { BLOCK_ACTIONS, IP_MATCH_LIST_STATUS } from '../../../../helpers/constants';
</s> add import i18next from 'i18next'; </s> remove import { getPercent, getIpMatchListStatus, sortIp } from '../../helpers/helpers';
import { BLOCK_ACTIONS, IP_MATCH_LIST_STATUS, STATUS_COLORS } from '../../helpers/constants';
</s> add import { getPercent, sortIp } from '../../helpers/helpers';
import { BLOCK_ACTIONS, STATUS_COLORS } from '../../helpers/constants'; </s> remove import { BLOCK_ACTIONS } from '../helpers/constants';
</s> add | [
"keep",
"add",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/c72cd58f69b71e4981d8b182b2f7d53ea5e30868 | client/src/components/Logs/Cells/index.js |
<mask> const filters = useSelector((state) => state.filtering.filters, shallowEqual);
<mask> const whitelistFilters = useSelector((state) => state.filtering.whitelistFilters, shallowEqual);
<mask> const autoClients = useSelector((state) => state.dashboard.autoClients, shallowEqual);
<mask>
<mask> const disallowed_clients = useSelector(
<mask> (state) => state.access.disallowed_clients,
<mask> shallowEqual,
<mask> );
<mask>
<mask> const clients = useSelector((state) => state.dashboard.clients);
<mask>
<mask> const onClick = () => {
<mask> if (!isSmallScreen) { return; }
<mask> const {
</s> + client: Move the client access check to the server-side
Squashed commit of the following:
commit 1aab0f62e94ce665a1b996552fac41dc4e769b4d
Merge: cdf5eb6e c1f5fdae
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 24 15:36:05 2020 +0300
Merge branch '1920-client-find' into feature/1925
commit cdf5eb6ea67a665d21a3155d8cf89bba9a5a9948
Merge: b6c20b1c 10f67bd3
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 23 20:28:51 2020 +0300
Merge branch 'master' into feature/1925
commit b6c20b1c7359a0e5902405b0551712f936848a80
Merge: 97d388ef 96512433
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 15 10:44:25 2020 +0300
Merge branch 'master' into feature/1925
commit 97d388ef6571d590f21da00f86d889e881ca0c3d
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 15 10:30:50 2020 +0300
Extract buttons
commit ca45fde11fc2b2812ff2b84dbd67aff0b5341be1
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 10 12:46:09 2020 +0300
Handle errors in updateLogs
commit f15e03c2e5a7115db984f70f72b0ddd870ece73d
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 10 12:39:34 2020 +0300
Update mobile block status on click
commit 033b28db3b324f6d529ac1a0ef657886cdbe02bd
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 20:53:42 2020 +0300
Fix mobile block buttons, auto open page on web serve start
commit 2730937b23309167a066b9154728ac53ffe81a49
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 13:58:37 2020 +0300
Disable allow this client button when isNotInAllowedList is true
commit 818cf869d63654c184762ad2701c4429a3e3011e
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 13:06:01 2020 +0300
Update client block state on option click
commit a072b8983757f419645c0207ea78e6e867c440cb
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 20:17:16 2020 +0300
Adapt to api changes
commit 28ab2bd8b3f14f60bc822b5a69fa1801db67d816
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 14:12:20 2020 +0300
Change query log block confirm messages
commit 9b0b6f6f9b1ec168fa71dbedd036152da59006e3
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 12:00:46 2020 +0300
Refactor inner work with disallowed
commit 05f76154b8f489738d032fdaa835edb371ce70c7
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Mon Sep 7 16:11:37 2020 +0300
+ client: Move the client access check to the server-side </s> remove if (!isSmallScreen) { return; }
</s> add if (!isSmallScreen) {
return;
} </s> remove const disallowedClients = useSelector((state) => state.access.disallowed_clients, shallowEqual);
</s> add </s> remove info: { name, whois_info },
</s> add info: {
name, whois_info, disallowed, disallowed_rule,
}, </s> remove const disallowed_clients = useSelector(
(state) => state.access.disallowed_clients,
shallowEqual,
);
</s> add </s> remove const renderBlockingButton = (ip) => {
</s> add const renderBlockingButton = (ip, disallowed, disallowed_rule) => { | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/c72cd58f69b71e4981d8b182b2f7d53ea5e30868 | client/src/components/Logs/Cells/index.js | |
if (!isSmallScreen) {
return;
} | <mask>
<mask> const clients = useSelector((state) => state.dashboard.clients);
<mask>
<mask> const onClick = () => {
<mask> if (!isSmallScreen) { return; }
<mask> const {
<mask> answer_dnssec,
<mask> client,
<mask> domain,
<mask> elapsedMs,
</s> + client: Move the client access check to the server-side
Squashed commit of the following:
commit 1aab0f62e94ce665a1b996552fac41dc4e769b4d
Merge: cdf5eb6e c1f5fdae
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 24 15:36:05 2020 +0300
Merge branch '1920-client-find' into feature/1925
commit cdf5eb6ea67a665d21a3155d8cf89bba9a5a9948
Merge: b6c20b1c 10f67bd3
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 23 20:28:51 2020 +0300
Merge branch 'master' into feature/1925
commit b6c20b1c7359a0e5902405b0551712f936848a80
Merge: 97d388ef 96512433
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 15 10:44:25 2020 +0300
Merge branch 'master' into feature/1925
commit 97d388ef6571d590f21da00f86d889e881ca0c3d
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 15 10:30:50 2020 +0300
Extract buttons
commit ca45fde11fc2b2812ff2b84dbd67aff0b5341be1
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 10 12:46:09 2020 +0300
Handle errors in updateLogs
commit f15e03c2e5a7115db984f70f72b0ddd870ece73d
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 10 12:39:34 2020 +0300
Update mobile block status on click
commit 033b28db3b324f6d529ac1a0ef657886cdbe02bd
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 20:53:42 2020 +0300
Fix mobile block buttons, auto open page on web serve start
commit 2730937b23309167a066b9154728ac53ffe81a49
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 13:58:37 2020 +0300
Disable allow this client button when isNotInAllowedList is true
commit 818cf869d63654c184762ad2701c4429a3e3011e
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 13:06:01 2020 +0300
Update client block state on option click
commit a072b8983757f419645c0207ea78e6e867c440cb
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 20:17:16 2020 +0300
Adapt to api changes
commit 28ab2bd8b3f14f60bc822b5a69fa1801db67d816
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 14:12:20 2020 +0300
Change query log block confirm messages
commit 9b0b6f6f9b1ec168fa71dbedd036152da59006e3
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 12:00:46 2020 +0300
Refactor inner work with disallowed
commit 05f76154b8f489738d032fdaa835edb371ce70c7
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Mon Sep 7 16:11:37 2020 +0300
+ client: Move the client access check to the server-side </s> remove const disallowed_clients = useSelector(
(state) => state.access.disallowed_clients,
shallowEqual,
);
</s> add </s> remove info: { name, whois_info },
</s> add info: {
name, whois_info, disallowed, disallowed_rule,
}, </s> remove [blockingClientKey]: () => {
const message = `${type === BLOCK_ACTIONS.BLOCK ? t('adg_will_drop_dns_queries') : ''} ${t(confirmMessage, { ip: client })}`;
if (window.confirm(message)) {
dispatch(toggleClientBlock(type, client));
}
</s> add {
name: blockingClientKey,
onClick: async () => {
if (window.confirm(confirmMessage)) {
await dispatch(toggleClientBlock(client, disallowed, disallowed_rule));
await dispatch(updateLogs());
}
},
disabled: isNotInAllowedList, </s> remove const onBlockingClientClick = () => {
const message = `${blockType === BLOCK_ACTIONS.BLOCK ? t('adg_will_drop_dns_queries') : ''} ${t(confirmMessage, { ip: client })}`;
if (window.confirm(message)) {
dispatch(toggleClientBlock(blockType, client));
</s> add const onBlockingClientClick = async () => {
if (window.confirm(confirmMessage)) {
await dispatch(toggleClientBlock(client, disallowed, disallowed_rule));
await dispatch(updateLogs());
setModalOpened(false); </s> remove const getOptions = (optionToActionMap) => {
const options = Object.entries(optionToActionMap);
</s> add const getOptions = (options) => { | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/c72cd58f69b71e4981d8b182b2f7d53ea5e30868 | client/src/components/Logs/Cells/index.js |
info: { disallowed, disallowed_rule }, | <mask> domain,
<mask> elapsedMs,
<mask> info,
<mask> reason,
<mask> response,
<mask> time,
<mask> tracker,
</s> + client: Move the client access check to the server-side
Squashed commit of the following:
commit 1aab0f62e94ce665a1b996552fac41dc4e769b4d
Merge: cdf5eb6e c1f5fdae
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 24 15:36:05 2020 +0300
Merge branch '1920-client-find' into feature/1925
commit cdf5eb6ea67a665d21a3155d8cf89bba9a5a9948
Merge: b6c20b1c 10f67bd3
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 23 20:28:51 2020 +0300
Merge branch 'master' into feature/1925
commit b6c20b1c7359a0e5902405b0551712f936848a80
Merge: 97d388ef 96512433
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 15 10:44:25 2020 +0300
Merge branch 'master' into feature/1925
commit 97d388ef6571d590f21da00f86d889e881ca0c3d
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 15 10:30:50 2020 +0300
Extract buttons
commit ca45fde11fc2b2812ff2b84dbd67aff0b5341be1
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 10 12:46:09 2020 +0300
Handle errors in updateLogs
commit f15e03c2e5a7115db984f70f72b0ddd870ece73d
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 10 12:39:34 2020 +0300
Update mobile block status on click
commit 033b28db3b324f6d529ac1a0ef657886cdbe02bd
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 20:53:42 2020 +0300
Fix mobile block buttons, auto open page on web serve start
commit 2730937b23309167a066b9154728ac53ffe81a49
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 13:58:37 2020 +0300
Disable allow this client button when isNotInAllowedList is true
commit 818cf869d63654c184762ad2701c4429a3e3011e
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 13:06:01 2020 +0300
Update client block state on option click
commit a072b8983757f419645c0207ea78e6e867c440cb
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 20:17:16 2020 +0300
Adapt to api changes
commit 28ab2bd8b3f14f60bc822b5a69fa1801db67d816
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 14:12:20 2020 +0300
Change query log block confirm messages
commit 9b0b6f6f9b1ec168fa71dbedd036152da59006e3
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 12:00:46 2020 +0300
Refactor inner work with disallowed
commit 05f76154b8f489738d032fdaa835edb371ce70c7
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Mon Sep 7 16:11:37 2020 +0300
+ client: Move the client access check to the server-side </s> remove info: { name, whois_info },
</s> add info: {
name, whois_info, disallowed, disallowed_rule,
}, </s> remove if (!isSmallScreen) { return; }
</s> add if (!isSmallScreen) {
return;
} </s> remove const { value, original: { info } } = row;
</s> add const { value, original: { info, info: { disallowed, disallowed_rule } } } = row; </s> remove {renderBlockingButton(value)}
</s> add {renderBlockingButton(value, disallowed, disallowed_rule)} | [
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/c72cd58f69b71e4981d8b182b2f7d53ea5e30868 | client/src/components/Logs/Cells/index.js |
|| reason === FILTERED_STATUS.FILTERED_BLOCKED_SERVICE; | <mask> const formattedElapsedMs = formatElapsedMs(elapsedMs, t);
<mask> const isFiltered = checkFiltered(reason);
<mask>
<mask> const isBlocked = reason === FILTERED_STATUS.FILTERED_BLACK_LIST
<mask> || reason === FILTERED_STATUS.FILTERED_BLOCKED_SERVICE;
<mask>
<mask> const buttonType = isFiltered ? BLOCK_ACTIONS.UNBLOCK : BLOCK_ACTIONS.BLOCK;
<mask> const onToggleBlock = () => {
<mask> dispatch(toggleBlocking(buttonType, domain));
<mask> };
</s> + client: Move the client access check to the server-side
Squashed commit of the following:
commit 1aab0f62e94ce665a1b996552fac41dc4e769b4d
Merge: cdf5eb6e c1f5fdae
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 24 15:36:05 2020 +0300
Merge branch '1920-client-find' into feature/1925
commit cdf5eb6ea67a665d21a3155d8cf89bba9a5a9948
Merge: b6c20b1c 10f67bd3
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 23 20:28:51 2020 +0300
Merge branch 'master' into feature/1925
commit b6c20b1c7359a0e5902405b0551712f936848a80
Merge: 97d388ef 96512433
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 15 10:44:25 2020 +0300
Merge branch 'master' into feature/1925
commit 97d388ef6571d590f21da00f86d889e881ca0c3d
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 15 10:30:50 2020 +0300
Extract buttons
commit ca45fde11fc2b2812ff2b84dbd67aff0b5341be1
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 10 12:46:09 2020 +0300
Handle errors in updateLogs
commit f15e03c2e5a7115db984f70f72b0ddd870ece73d
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 10 12:39:34 2020 +0300
Update mobile block status on click
commit 033b28db3b324f6d529ac1a0ef657886cdbe02bd
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 20:53:42 2020 +0300
Fix mobile block buttons, auto open page on web serve start
commit 2730937b23309167a066b9154728ac53ffe81a49
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 13:58:37 2020 +0300
Disable allow this client button when isNotInAllowedList is true
commit 818cf869d63654c184762ad2701c4429a3e3011e
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 13:06:01 2020 +0300
Update client block state on option click
commit a072b8983757f419645c0207ea78e6e867c440cb
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 20:17:16 2020 +0300
Adapt to api changes
commit 28ab2bd8b3f14f60bc822b5a69fa1801db67d816
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 14:12:20 2020 +0300
Change query log block confirm messages
commit 9b0b6f6f9b1ec168fa71dbedd036152da59006e3
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 12:00:46 2020 +0300
Refactor inner work with disallowed
commit 05f76154b8f489738d032fdaa835edb371ce70c7
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Mon Sep 7 16:11:37 2020 +0300
+ client: Move the client access check to the server-side </s> remove type: blockType,
} = getBlockClientInfo(client, disallowed_clients);
</s> add isNotInAllowedList,
} = getBlockClientInfo(client, disallowed, disallowed_rule); </s> remove const BUTTON_OPTIONS_TO_ACTION_MAP = {
[blockingForClientKey]: () => {
dispatch(toggleBlockingForClient(buttonType, domain, clientNameBlockingFor));
</s> add const BUTTON_OPTIONS = [
{
name: blockingForClientKey,
onClick: () => {
dispatch(toggleBlockingForClient(buttonType, domain, clientNameBlockingFor));
}, </s> remove const getOptions = (optionToActionMap) => {
const options = Object.entries(optionToActionMap);
</s> add const getOptions = (options) => { | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/c72cd58f69b71e4981d8b182b2f7d53ea5e30868 | client/src/components/Logs/Cells/index.js |
isNotInAllowedList,
} = getBlockClientInfo(client, disallowed, disallowed_rule); | <mask>
<mask> const {
<mask> confirmMessage,
<mask> buttonKey: blockingClientKey,
<mask> type: blockType,
<mask> } = getBlockClientInfo(client, disallowed_clients);
<mask>
<mask> const blockingForClientKey = isFiltered ? 'unblock_for_this_client_only' : 'block_for_this_client_only';
<mask> const clientNameBlockingFor = getBlockingClientName(clients, client);
<mask>
<mask> const onBlockingForClientClick = () => {
</s> + client: Move the client access check to the server-side
Squashed commit of the following:
commit 1aab0f62e94ce665a1b996552fac41dc4e769b4d
Merge: cdf5eb6e c1f5fdae
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 24 15:36:05 2020 +0300
Merge branch '1920-client-find' into feature/1925
commit cdf5eb6ea67a665d21a3155d8cf89bba9a5a9948
Merge: b6c20b1c 10f67bd3
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 23 20:28:51 2020 +0300
Merge branch 'master' into feature/1925
commit b6c20b1c7359a0e5902405b0551712f936848a80
Merge: 97d388ef 96512433
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 15 10:44:25 2020 +0300
Merge branch 'master' into feature/1925
commit 97d388ef6571d590f21da00f86d889e881ca0c3d
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 15 10:30:50 2020 +0300
Extract buttons
commit ca45fde11fc2b2812ff2b84dbd67aff0b5341be1
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 10 12:46:09 2020 +0300
Handle errors in updateLogs
commit f15e03c2e5a7115db984f70f72b0ddd870ece73d
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 10 12:39:34 2020 +0300
Update mobile block status on click
commit 033b28db3b324f6d529ac1a0ef657886cdbe02bd
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 20:53:42 2020 +0300
Fix mobile block buttons, auto open page on web serve start
commit 2730937b23309167a066b9154728ac53ffe81a49
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 13:58:37 2020 +0300
Disable allow this client button when isNotInAllowedList is true
commit 818cf869d63654c184762ad2701c4429a3e3011e
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 13:06:01 2020 +0300
Update client block state on option click
commit a072b8983757f419645c0207ea78e6e867c440cb
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 20:17:16 2020 +0300
Adapt to api changes
commit 28ab2bd8b3f14f60bc822b5a69fa1801db67d816
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 14:12:20 2020 +0300
Change query log block confirm messages
commit 9b0b6f6f9b1ec168fa71dbedd036152da59006e3
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 12:00:46 2020 +0300
Refactor inner work with disallowed
commit 05f76154b8f489738d032fdaa835edb371ce70c7
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Mon Sep 7 16:11:37 2020 +0300
+ client: Move the client access check to the server-side </s> remove type,
} = getBlockClientInfo(client, disallowed_clients);
</s> add isNotInAllowedList,
} = getBlockClientInfo(client, disallowed, disallowed_rule); </s> remove const BUTTON_OPTIONS_TO_ACTION_MAP = {
[blockingForClientKey]: () => {
dispatch(toggleBlockingForClient(buttonType, domain, clientNameBlockingFor));
</s> add const BUTTON_OPTIONS = [
{
name: blockingForClientKey,
onClick: () => {
dispatch(toggleBlockingForClient(buttonType, domain, clientNameBlockingFor));
}, </s> remove const onBlockingClientClick = () => {
const message = `${blockType === BLOCK_ACTIONS.BLOCK ? t('adg_will_drop_dns_queries') : ''} ${t(confirmMessage, { ip: client })}`;
if (window.confirm(message)) {
dispatch(toggleClientBlock(blockType, client));
</s> add const onBlockingClientClick = async () => {
if (window.confirm(confirmMessage)) {
await dispatch(toggleClientBlock(client, disallowed, disallowed_rule));
await dispatch(updateLogs());
setModalOpened(false); </s> remove const isNotFound = ipMatchListStatus === IP_MATCH_LIST_STATUS.NOT_FOUND;
const type = isNotFound ? BLOCK_ACTIONS.BLOCK : BLOCK_ACTIONS.UNBLOCK;
</s> add const buttonKey = i18next.t(disallowed ? 'allow_this_client' : 'disallow_this_client');
const isNotInAllowedList = disallowed && disallowed_rule === ''; </s> remove || reason === FILTERED_STATUS.FILTERED_BLOCKED_SERVICE;
</s> add || reason === FILTERED_STATUS.FILTERED_BLOCKED_SERVICE; | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/c72cd58f69b71e4981d8b182b2f7d53ea5e30868 | client/src/components/Logs/Cells/index.js |
const onBlockingClientClick = async () => {
if (window.confirm(confirmMessage)) {
await dispatch(toggleClientBlock(client, disallowed, disallowed_rule));
await dispatch(updateLogs());
setModalOpened(false); | <mask> const onBlockingForClientClick = () => {
<mask> dispatch(toggleBlockingForClient(buttonType, domain, clientNameBlockingFor));
<mask> };
<mask>
<mask> const onBlockingClientClick = () => {
<mask> const message = `${blockType === BLOCK_ACTIONS.BLOCK ? t('adg_will_drop_dns_queries') : ''} ${t(confirmMessage, { ip: client })}`;
<mask> if (window.confirm(message)) {
<mask> dispatch(toggleClientBlock(blockType, client));
<mask> }
<mask> };
<mask>
<mask> const detailedData = {
<mask> time_table_header: formatTime(time, LONG_TIME_FORMAT),
</s> + client: Move the client access check to the server-side
Squashed commit of the following:
commit 1aab0f62e94ce665a1b996552fac41dc4e769b4d
Merge: cdf5eb6e c1f5fdae
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 24 15:36:05 2020 +0300
Merge branch '1920-client-find' into feature/1925
commit cdf5eb6ea67a665d21a3155d8cf89bba9a5a9948
Merge: b6c20b1c 10f67bd3
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 23 20:28:51 2020 +0300
Merge branch 'master' into feature/1925
commit b6c20b1c7359a0e5902405b0551712f936848a80
Merge: 97d388ef 96512433
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 15 10:44:25 2020 +0300
Merge branch 'master' into feature/1925
commit 97d388ef6571d590f21da00f86d889e881ca0c3d
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 15 10:30:50 2020 +0300
Extract buttons
commit ca45fde11fc2b2812ff2b84dbd67aff0b5341be1
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 10 12:46:09 2020 +0300
Handle errors in updateLogs
commit f15e03c2e5a7115db984f70f72b0ddd870ece73d
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 10 12:39:34 2020 +0300
Update mobile block status on click
commit 033b28db3b324f6d529ac1a0ef657886cdbe02bd
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 20:53:42 2020 +0300
Fix mobile block buttons, auto open page on web serve start
commit 2730937b23309167a066b9154728ac53ffe81a49
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 13:58:37 2020 +0300
Disable allow this client button when isNotInAllowedList is true
commit 818cf869d63654c184762ad2701c4429a3e3011e
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 13:06:01 2020 +0300
Update client block state on option click
commit a072b8983757f419645c0207ea78e6e867c440cb
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 20:17:16 2020 +0300
Adapt to api changes
commit 28ab2bd8b3f14f60bc822b5a69fa1801db67d816
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 14:12:20 2020 +0300
Change query log block confirm messages
commit 9b0b6f6f9b1ec168fa71dbedd036152da59006e3
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 12:00:46 2020 +0300
Refactor inner work with disallowed
commit 05f76154b8f489738d032fdaa835edb371ce70c7
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Mon Sep 7 16:11:37 2020 +0300
+ client: Move the client access check to the server-side </s> remove const BUTTON_OPTIONS_TO_ACTION_MAP = {
[blockingForClientKey]: () => {
dispatch(toggleBlockingForClient(buttonType, domain, clientNameBlockingFor));
</s> add const BUTTON_OPTIONS = [
{
name: blockingForClientKey,
onClick: () => {
dispatch(toggleBlockingForClient(buttonType, domain, clientNameBlockingFor));
}, </s> remove [blockingClientKey]: () => {
const message = `${type === BLOCK_ACTIONS.BLOCK ? t('adg_will_drop_dns_queries') : ''} ${t(confirmMessage, { ip: client })}`;
if (window.confirm(message)) {
dispatch(toggleClientBlock(type, client));
}
</s> add {
name: blockingClientKey,
onClick: async () => {
if (window.confirm(confirmMessage)) {
await dispatch(toggleClientBlock(client, disallowed, disallowed_rule));
await dispatch(updateLogs());
}
},
disabled: isNotInAllowedList, </s> remove const toggleClientStatus = (type, ip) => {
const confirmMessage = type === BLOCK_ACTIONS.BLOCK
? `${t('adg_will_drop_dns_queries')} ${t('client_confirm_block', { ip })}`
: t('client_confirm_unblock', { ip });
</s> add const toggleClientStatus = async (ip, disallowed, disallowed_rule) => {
const confirmMessage = disallowed
? t('client_confirm_unblock', { ip: disallowed_rule })
: `${t('adg_will_drop_dns_queries')} ${t('client_confirm_block', { ip })}`; </s> remove };
</s> add ]; </s> remove export const getBlockClientInfo = (client, disallowed_clients) => {
const ipMatchListStatus = getIpMatchListStatus(client, disallowed_clients);
</s> add export const getBlockClientInfo = (ip, disallowed, disallowed_rule) => {
const confirmMessage = disallowed
? i18next.t('client_confirm_unblock', { ip: disallowed_rule })
: `${i18next.t('adg_will_drop_dns_queries')} ${i18next.t('client_confirm_block', { ip })}`; | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/c72cd58f69b71e4981d8b182b2f7d53ea5e30868 | client/src/components/Logs/Cells/index.js |
&& <a
href={sourceData.url}
target="_blank"
rel="noopener noreferrer"
className="link--green">{sourceData.name}
</a>, | <mask> known_tracker: hasTracker && 'title',
<mask> table_name: tracker?.name,
<mask> category_label: hasTracker && captitalizeWords(tracker.category),
<mask> tracker_source: hasTracker && sourceData
<mask> && <a
<mask> href={sourceData.url}
<mask> target="_blank"
<mask> rel="noopener noreferrer"
<mask> className="link--green">{sourceData.name}
<mask> </a>,
<mask> response_details: 'title',
<mask> install_settings_dns: upstream,
<mask> elapsed: formattedElapsedMs,
<mask> filter: rule ? filter : null,
<mask> rule_label: rule,
</s> + client: Move the client access check to the server-side
Squashed commit of the following:
commit 1aab0f62e94ce665a1b996552fac41dc4e769b4d
Merge: cdf5eb6e c1f5fdae
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 24 15:36:05 2020 +0300
Merge branch '1920-client-find' into feature/1925
commit cdf5eb6ea67a665d21a3155d8cf89bba9a5a9948
Merge: b6c20b1c 10f67bd3
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 23 20:28:51 2020 +0300
Merge branch 'master' into feature/1925
commit b6c20b1c7359a0e5902405b0551712f936848a80
Merge: 97d388ef 96512433
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 15 10:44:25 2020 +0300
Merge branch 'master' into feature/1925
commit 97d388ef6571d590f21da00f86d889e881ca0c3d
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 15 10:30:50 2020 +0300
Extract buttons
commit ca45fde11fc2b2812ff2b84dbd67aff0b5341be1
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 10 12:46:09 2020 +0300
Handle errors in updateLogs
commit f15e03c2e5a7115db984f70f72b0ddd870ece73d
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 10 12:39:34 2020 +0300
Update mobile block status on click
commit 033b28db3b324f6d529ac1a0ef657886cdbe02bd
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 20:53:42 2020 +0300
Fix mobile block buttons, auto open page on web serve start
commit 2730937b23309167a066b9154728ac53ffe81a49
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 13:58:37 2020 +0300
Disable allow this client button when isNotInAllowedList is true
commit 818cf869d63654c184762ad2701c4429a3e3011e
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 13:06:01 2020 +0300
Update client block state on option click
commit a072b8983757f419645c0207ea78e6e867c440cb
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 20:17:16 2020 +0300
Adapt to api changes
commit 28ab2bd8b3f14f60bc822b5a69fa1801db67d816
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 14:12:20 2020 +0300
Change query log block confirm messages
commit 9b0b6f6f9b1ec168fa71dbedd036152da59006e3
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 12:00:46 2020 +0300
Refactor inner work with disallowed
commit 05f76154b8f489738d032fdaa835edb371ce70c7
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Mon Sep 7 16:11:37 2020 +0300
+ client: Move the client access check to the server-side </s> remove let updatedDisallowedClients = disallowed_clients || [];
</s> add </s> remove if (type === BLOCK_ACTIONS.UNBLOCK && updatedDisallowedClients.includes(ip)) {
updatedDisallowedClients = updatedDisallowedClients.filter((client) => client !== ip);
} else if (type === BLOCK_ACTIONS.BLOCK && !updatedDisallowedClients.includes(ip)) {
updatedDisallowedClients.push(ip);
}
</s> add const updatedDisallowedClients = disallowed
? disallowed_clients.filter((client) => client !== disallowed_rule)
: disallowed_clients.concat(ip); </s> remove const isNotFound = ipMatchListStatus === IP_MATCH_LIST_STATUS.NOT_FOUND;
const type = isNotFound ? BLOCK_ACTIONS.BLOCK : BLOCK_ACTIONS.UNBLOCK;
</s> add const buttonKey = i18next.t(disallowed ? 'allow_this_client' : 'disallow_this_client');
const isNotInAllowedList = disallowed && disallowed_rule === ''; </s> remove allowed_clients, disallowed_clients, blocked_hosts,
</s> add allowed_clients, blocked_hosts, disallowed_clients = [], | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/c72cd58f69b71e4981d8b182b2f7d53ea5e30868 | client/src/components/Logs/Cells/index.js |
[BUTTON_PREFIX + buttonType]: blockButton,
[BUTTON_PREFIX + blockingForClientKey]: blockForClientButton,
[BUTTON_PREFIX + blockingClientKey]: blockClientButton, | <mask> network,
<mask> source_label: source,
<mask> validated_with_dnssec: dnssec_enabled ? Boolean(answer_dnssec) : false,
<mask> original_response: originalResponse?.join('\n'),
<mask> [BUTTON_PREFIX + buttonType]: <div onClick={onToggleBlock}
<mask> className={classNames('title--border text-center', {
<mask> 'bg--danger': isBlocked,
<mask> })}>{t(buttonType)}</div>,
<mask> [BUTTON_PREFIX + blockingForClientKey]: <div onClick={onBlockingForClientClick} className='text-center font-weight-bold py-2'>{t(blockingForClientKey)}</div>,
<mask> [BUTTON_PREFIX + blockingClientKey]: <div onClick={onBlockingClientClick} className='text-center font-weight-bold py-2'>{t(blockingClientKey)}</div>,
<mask> };
<mask>
<mask> setDetailedDataCurrent(processContent(detailedData));
<mask> setButtonType(buttonType);
<mask> setModalOpened(true);
</s> + client: Move the client access check to the server-side
Squashed commit of the following:
commit 1aab0f62e94ce665a1b996552fac41dc4e769b4d
Merge: cdf5eb6e c1f5fdae
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 24 15:36:05 2020 +0300
Merge branch '1920-client-find' into feature/1925
commit cdf5eb6ea67a665d21a3155d8cf89bba9a5a9948
Merge: b6c20b1c 10f67bd3
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 23 20:28:51 2020 +0300
Merge branch 'master' into feature/1925
commit b6c20b1c7359a0e5902405b0551712f936848a80
Merge: 97d388ef 96512433
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 15 10:44:25 2020 +0300
Merge branch 'master' into feature/1925
commit 97d388ef6571d590f21da00f86d889e881ca0c3d
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 15 10:30:50 2020 +0300
Extract buttons
commit ca45fde11fc2b2812ff2b84dbd67aff0b5341be1
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 10 12:46:09 2020 +0300
Handle errors in updateLogs
commit f15e03c2e5a7115db984f70f72b0ddd870ece73d
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 10 12:39:34 2020 +0300
Update mobile block status on click
commit 033b28db3b324f6d529ac1a0ef657886cdbe02bd
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 20:53:42 2020 +0300
Fix mobile block buttons, auto open page on web serve start
commit 2730937b23309167a066b9154728ac53ffe81a49
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 13:58:37 2020 +0300
Disable allow this client button when isNotInAllowedList is true
commit 818cf869d63654c184762ad2701c4429a3e3011e
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 13:06:01 2020 +0300
Update client block state on option click
commit a072b8983757f419645c0207ea78e6e867c440cb
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 20:17:16 2020 +0300
Adapt to api changes
commit 28ab2bd8b3f14f60bc822b5a69fa1801db67d816
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 14:12:20 2020 +0300
Change query log block confirm messages
commit 9b0b6f6f9b1ec168fa71dbedd036152da59006e3
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 12:00:46 2020 +0300
Refactor inner work with disallowed
commit 05f76154b8f489738d032fdaa835edb371ce70c7
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Mon Sep 7 16:11:37 2020 +0300
+ client: Move the client access check to the server-side </s> remove <button
type="button"
className={buttonClass}
onClick={onClick}
disabled={processingSet}
>
<Trans>{text}</Trans>
</button>
</div>;
</s> add <button
type="button"
className={buttonClass}
onClick={isNotInAllowedList ? undefined : onClick}
disabled={isNotInAllowedList || processingSet}
title={t(isNotInAllowedList ? 'client_not_in_allowed_clients' : text)}
>
<Trans>{text}</Trans>
</button>
</div>; </s> remove const onClick = () => toggleClientStatus(type, ip);
</s> add const onClick = () => toggleClientStatus(ip, disallowed, disallowed_rule);
const text = disallowed ? BLOCK_ACTIONS.UNBLOCK : BLOCK_ACTIONS.BLOCK; </s> remove const getOptions = (optionToActionMap) => {
const options = Object.entries(optionToActionMap);
</s> add const getOptions = (options) => { </s> remove const { value, original: { info } } = row;
</s> add const { value, original: { info, info: { disallowed, disallowed_rule } } } = row; | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/c72cd58f69b71e4981d8b182b2f7d53ea5e30868 | client/src/components/Logs/Cells/index.js |
color: var(--danger) !important; | <mask> padding: 0.5rem 0.75rem 0.5rem 2rem !important;
<mask> }
<mask>
<mask> .bg--danger {
<mask> color: var(--danger);
<mask> }
<mask>
<mask> .form-control--search {
<mask> box-shadow: 0 1px 0 #ddd;
<mask> padding: 0 2.5rem;
</s> + client: Move the client access check to the server-side
Squashed commit of the following:
commit 1aab0f62e94ce665a1b996552fac41dc4e769b4d
Merge: cdf5eb6e c1f5fdae
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 24 15:36:05 2020 +0300
Merge branch '1920-client-find' into feature/1925
commit cdf5eb6ea67a665d21a3155d8cf89bba9a5a9948
Merge: b6c20b1c 10f67bd3
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 23 20:28:51 2020 +0300
Merge branch 'master' into feature/1925
commit b6c20b1c7359a0e5902405b0551712f936848a80
Merge: 97d388ef 96512433
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 15 10:44:25 2020 +0300
Merge branch 'master' into feature/1925
commit 97d388ef6571d590f21da00f86d889e881ca0c3d
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 15 10:30:50 2020 +0300
Extract buttons
commit ca45fde11fc2b2812ff2b84dbd67aff0b5341be1
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 10 12:46:09 2020 +0300
Handle errors in updateLogs
commit f15e03c2e5a7115db984f70f72b0ddd870ece73d
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 10 12:39:34 2020 +0300
Update mobile block status on click
commit 033b28db3b324f6d529ac1a0ef657886cdbe02bd
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 20:53:42 2020 +0300
Fix mobile block buttons, auto open page on web serve start
commit 2730937b23309167a066b9154728ac53ffe81a49
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 13:58:37 2020 +0300
Disable allow this client button when isNotInAllowedList is true
commit 818cf869d63654c184762ad2701c4429a3e3011e
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 13:06:01 2020 +0300
Update client block state on option click
commit a072b8983757f419645c0207ea78e6e867c440cb
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 20:17:16 2020 +0300
Adapt to api changes
commit 28ab2bd8b3f14f60bc822b5a69fa1801db67d816
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 14:12:20 2020 +0300
Change query log block confirm messages
commit 9b0b6f6f9b1ec168fa71dbedd036152da59006e3
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 12:00:46 2020 +0300
Refactor inner work with disallowed
commit 05f76154b8f489738d032fdaa835edb371ce70c7
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Mon Sep 7 16:11:37 2020 +0300
+ client: Move the client access check to the server-side </s> remove background-color: var(--red);
</s> add background-color: var(--red) !important; </s> remove .button-action--arrow-option:hover {
</s> add .button-action--arrow-option {
background: transparent;
border: 0;
display: block;
width: 100%;
text-align: left;
color: inherit;
}
.button-action--arrow-option:disabled {
display: none;
}
.tooltip-custom__container .button-action--arrow-option:not(:disabled):hover { </s> remove if (type === BLOCK_ACTIONS.UNBLOCK) {
dispatch(addSuccessToast(i18next.t('client_unblocked', { ip })));
} else if (type === BLOCK_ACTIONS.BLOCK) {
</s> add if (disallowed) {
dispatch(addSuccessToast(i18next.t('client_unblocked', { ip: disallowed_rule })));
} else { | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/c72cd58f69b71e4981d8b182b2f7d53ea5e30868 | client/src/components/Logs/Logs.css |
.button-action--arrow-option {
background: transparent;
border: 0;
display: block;
width: 100%;
text-align: left;
color: inherit;
}
.button-action--arrow-option:disabled {
display: none;
}
.tooltip-custom__container .button-action--arrow-option:not(:disabled):hover { | <mask> .button-action--unblock:disabled {
<mask> background: var(--btn-unblock-disabled);
<mask> }
<mask>
<mask> .button-action--arrow-option:hover {
<mask> cursor: pointer;
<mask> background: var(--gray-f3);
<mask> overflow: hidden;
<mask> }
<mask>
</s> + client: Move the client access check to the server-side
Squashed commit of the following:
commit 1aab0f62e94ce665a1b996552fac41dc4e769b4d
Merge: cdf5eb6e c1f5fdae
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 24 15:36:05 2020 +0300
Merge branch '1920-client-find' into feature/1925
commit cdf5eb6ea67a665d21a3155d8cf89bba9a5a9948
Merge: b6c20b1c 10f67bd3
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 23 20:28:51 2020 +0300
Merge branch 'master' into feature/1925
commit b6c20b1c7359a0e5902405b0551712f936848a80
Merge: 97d388ef 96512433
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 15 10:44:25 2020 +0300
Merge branch 'master' into feature/1925
commit 97d388ef6571d590f21da00f86d889e881ca0c3d
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 15 10:30:50 2020 +0300
Extract buttons
commit ca45fde11fc2b2812ff2b84dbd67aff0b5341be1
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 10 12:46:09 2020 +0300
Handle errors in updateLogs
commit f15e03c2e5a7115db984f70f72b0ddd870ece73d
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 10 12:39:34 2020 +0300
Update mobile block status on click
commit 033b28db3b324f6d529ac1a0ef657886cdbe02bd
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 20:53:42 2020 +0300
Fix mobile block buttons, auto open page on web serve start
commit 2730937b23309167a066b9154728ac53ffe81a49
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 13:58:37 2020 +0300
Disable allow this client button when isNotInAllowedList is true
commit 818cf869d63654c184762ad2701c4429a3e3011e
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 13:06:01 2020 +0300
Update client block state on option click
commit a072b8983757f419645c0207ea78e6e867c440cb
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 20:17:16 2020 +0300
Adapt to api changes
commit 28ab2bd8b3f14f60bc822b5a69fa1801db67d816
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 14:12:20 2020 +0300
Change query log block confirm messages
commit 9b0b6f6f9b1ec168fa71dbedd036152da59006e3
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 12:00:46 2020 +0300
Refactor inner work with disallowed
commit 05f76154b8f489738d032fdaa835edb371ce70c7
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Mon Sep 7 16:11:37 2020 +0300
+ client: Move the client access check to the server-side </s> remove if (type === BLOCK_ACTIONS.UNBLOCK) {
dispatch(addSuccessToast(i18next.t('client_unblocked', { ip })));
} else if (type === BLOCK_ACTIONS.BLOCK) {
</s> add if (disallowed) {
dispatch(addSuccessToast(i18next.t('client_unblocked', { ip: disallowed_rule })));
} else { </s> remove const { value, original: { info } } = row;
</s> add const { value, original: { info, info: { disallowed, disallowed_rule } } } = row; </s> remove import { getPercent, getIpMatchListStatus, sortIp } from '../../helpers/helpers';
import { BLOCK_ACTIONS, IP_MATCH_LIST_STATUS, STATUS_COLORS } from '../../helpers/constants';
</s> add import { getPercent, sortIp } from '../../helpers/helpers';
import { BLOCK_ACTIONS, STATUS_COLORS } from '../../helpers/constants'; | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/c72cd58f69b71e4981d8b182b2f7d53ea5e30868 | client/src/components/Logs/Logs.css |
background-color: var(--red) !important; | <mask> background-color: var(--green-pale);
<mask> }
<mask>
<mask> .logs__row--red {
<mask> background-color: var(--red);
<mask> }
<mask>
<mask> .logs__row--white {
<mask> background-color: var(--white);
<mask> }
</s> + client: Move the client access check to the server-side
Squashed commit of the following:
commit 1aab0f62e94ce665a1b996552fac41dc4e769b4d
Merge: cdf5eb6e c1f5fdae
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 24 15:36:05 2020 +0300
Merge branch '1920-client-find' into feature/1925
commit cdf5eb6ea67a665d21a3155d8cf89bba9a5a9948
Merge: b6c20b1c 10f67bd3
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 23 20:28:51 2020 +0300
Merge branch 'master' into feature/1925
commit b6c20b1c7359a0e5902405b0551712f936848a80
Merge: 97d388ef 96512433
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 15 10:44:25 2020 +0300
Merge branch 'master' into feature/1925
commit 97d388ef6571d590f21da00f86d889e881ca0c3d
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 15 10:30:50 2020 +0300
Extract buttons
commit ca45fde11fc2b2812ff2b84dbd67aff0b5341be1
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 10 12:46:09 2020 +0300
Handle errors in updateLogs
commit f15e03c2e5a7115db984f70f72b0ddd870ece73d
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 10 12:39:34 2020 +0300
Update mobile block status on click
commit 033b28db3b324f6d529ac1a0ef657886cdbe02bd
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 20:53:42 2020 +0300
Fix mobile block buttons, auto open page on web serve start
commit 2730937b23309167a066b9154728ac53ffe81a49
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 13:58:37 2020 +0300
Disable allow this client button when isNotInAllowedList is true
commit 818cf869d63654c184762ad2701c4429a3e3011e
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 13:06:01 2020 +0300
Update client block state on option click
commit a072b8983757f419645c0207ea78e6e867c440cb
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 20:17:16 2020 +0300
Adapt to api changes
commit 28ab2bd8b3f14f60bc822b5a69fa1801db67d816
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 14:12:20 2020 +0300
Change query log block confirm messages
commit 9b0b6f6f9b1ec168fa71dbedd036152da59006e3
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 12:00:46 2020 +0300
Refactor inner work with disallowed
commit 05f76154b8f489738d032fdaa835edb371ce70c7
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Mon Sep 7 16:11:37 2020 +0300
+ client: Move the client access check to the server-side </s> remove const { value, original: { info } } = row;
</s> add const { value, original: { info, info: { disallowed, disallowed_rule } } } = row; </s> remove if (type === BLOCK_ACTIONS.UNBLOCK) {
dispatch(addSuccessToast(i18next.t('client_unblocked', { ip })));
} else if (type === BLOCK_ACTIONS.BLOCK) {
</s> add if (disallowed) {
dispatch(addSuccessToast(i18next.t('client_unblocked', { ip: disallowed_rule })));
} else { </s> remove const { ip } = rowInfo.original;
</s> add const { info: { disallowed } } = rowInfo.original; | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/c72cd58f69b71e4981d8b182b2f7d53ea5e30868 | client/src/components/Logs/Logs.css |
<mask> FASTEST_ADDR: 'fastest_addr',
<mask> LOAD_BALANCING: '',
<mask> };
<mask>
<mask> export const IP_MATCH_LIST_STATUS = {
<mask> NOT_FOUND: 'NOT_FOUND', // not found in the list
<mask> EXACT: 'EXACT', // found exact match (including the match of short and long forms)
<mask> CIDR: 'CIDR', // the ip is in the specified CIDR range
<mask> };
<mask>
<mask> export const DHCP_FORM_NAMES = {
<mask> DHCPv4: 'dhcpv4',
<mask> DHCPv6: 'dhcpv6',
<mask> DHCP_INTERFACES: 'dhcpInterfaces',
<mask> };
</s> + client: Move the client access check to the server-side
Squashed commit of the following:
commit 1aab0f62e94ce665a1b996552fac41dc4e769b4d
Merge: cdf5eb6e c1f5fdae
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 24 15:36:05 2020 +0300
Merge branch '1920-client-find' into feature/1925
commit cdf5eb6ea67a665d21a3155d8cf89bba9a5a9948
Merge: b6c20b1c 10f67bd3
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 23 20:28:51 2020 +0300
Merge branch 'master' into feature/1925
commit b6c20b1c7359a0e5902405b0551712f936848a80
Merge: 97d388ef 96512433
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 15 10:44:25 2020 +0300
Merge branch 'master' into feature/1925
commit 97d388ef6571d590f21da00f86d889e881ca0c3d
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 15 10:30:50 2020 +0300
Extract buttons
commit ca45fde11fc2b2812ff2b84dbd67aff0b5341be1
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 10 12:46:09 2020 +0300
Handle errors in updateLogs
commit f15e03c2e5a7115db984f70f72b0ddd870ece73d
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 10 12:39:34 2020 +0300
Update mobile block status on click
commit 033b28db3b324f6d529ac1a0ef657886cdbe02bd
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 20:53:42 2020 +0300
Fix mobile block buttons, auto open page on web serve start
commit 2730937b23309167a066b9154728ac53ffe81a49
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 13:58:37 2020 +0300
Disable allow this client button when isNotInAllowedList is true
commit 818cf869d63654c184762ad2701c4429a3e3011e
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 13:06:01 2020 +0300
Update client block state on option click
commit a072b8983757f419645c0207ea78e6e867c440cb
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 20:17:16 2020 +0300
Adapt to api changes
commit 28ab2bd8b3f14f60bc822b5a69fa1801db67d816
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 14:12:20 2020 +0300
Change query log block confirm messages
commit 9b0b6f6f9b1ec168fa71dbedd036152da59006e3
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 12:00:46 2020 +0300
Refactor inner work with disallowed
commit 05f76154b8f489738d032fdaa835edb371ce70c7
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Mon Sep 7 16:11:37 2020 +0300
+ client: Move the client access check to the server-side </s> remove import {
countClientsStatistics, findAddressType, getIpMatchListStatus, sortIp,
} from '../helpers/helpers';
import { ADDRESS_TYPES, IP_MATCH_LIST_STATUS } from '../helpers/constants';
describe('getIpMatchListStatus', () => {
describe('IPv4', () => {
test('should return EXACT on find the exact ip match', () => {
const list = `127.0.0.2
2001:db8:11a3:9d7:0:0:0:0
192.168.0.1/8
127.0.0.1
127.0.0.3`;
expect(getIpMatchListStatus('127.0.0.1', list))
.toEqual(IP_MATCH_LIST_STATUS.EXACT);
});
test('should return CIDR on find the cidr match', () => {
const list = `127.0.0.2
2001:db8:11a3:9d7:0:0:0:0
192.168.0.1/8
127.0.0.0/24
127.0.0.3`;
expect(getIpMatchListStatus('127.0.0.1', list))
.toEqual(IP_MATCH_LIST_STATUS.CIDR);
});
test('should return NOT_FOUND if the ip is not in the list', () => {
const list = `127.0.0.1
2001:db8:11a3:9d7:0:0:0:0
192.168.0.1/8
127.0.0.2
127.0.0.3`;
expect(getIpMatchListStatus('127.0.0.4', list))
.toEqual(IP_MATCH_LIST_STATUS.NOT_FOUND);
});
test('should return the first EXACT or CIDR match in the list', () => {
const list1 = `2001:db8:11a3:9d7:0:0:0:0
127.0.0.1
127.0.0.8/24
127.0.0.3`;
expect(getIpMatchListStatus('127.0.0.1', list1))
.toEqual(IP_MATCH_LIST_STATUS.EXACT);
const list2 = `2001:db8:11a3:9d7:ffff:ffff:ffff:ffff
2001:0db8:11a3:09d7:0000:0000:0000:0000/64
127.0.0.0/24
127.0.0.1
127.0.0.8/24
127.0.0.3`;
expect(getIpMatchListStatus('127.0.0.1', list2))
.toEqual(IP_MATCH_LIST_STATUS.CIDR);
});
});
describe('IPv6', () => {
test('should return EXACT on find the exact ip match', () => {
const list = `127.0.0.0
2001:db8:11a3:9d7:0:0:0:0
2001:db8:11a3:9d7:ffff:ffff:ffff:ffff
127.0.0.1`;
expect(getIpMatchListStatus('2001:db8:11a3:9d7:0:0:0:0', list))
.toEqual(IP_MATCH_LIST_STATUS.EXACT);
});
test('should return EXACT on find the exact ip match of short and long notation', () => {
const list = `127.0.0.0
192.168.0.1/8
2001:db8::
127.0.0.2`;
expect(getIpMatchListStatus('2001:db8:0:0:0:0:0:0', list))
.toEqual(IP_MATCH_LIST_STATUS.EXACT);
});
test('should return CIDR on find the cidr match', () => {
const list1 = `2001:0db8:11a3:09d7:0000:0000:0000:0000/64
127.0.0.1
127.0.0.2`;
expect(getIpMatchListStatus('2001:db8:11a3:9d7:0:0:0:0', list1))
.toEqual(IP_MATCH_LIST_STATUS.CIDR);
const list2 = `2001:0db8::/16
127.0.0.0
2001:db8:11a3:9d7:0:0:0:0
2001:db8::
2001:db8:11a3:9d7:ffff:ffff:ffff:ffff
127.0.0.1`;
expect(getIpMatchListStatus('2001:db1::', list2))
.toEqual(IP_MATCH_LIST_STATUS.CIDR);
});
test('should return NOT_FOUND if the ip is not in the list', () => {
const list = `2001:db8:11a3:9d7:0:0:0:0
2001:0db8:11a3:09d7:0000:0000:0000:0000/64
127.0.0.1
127.0.0.2`;
expect(getIpMatchListStatus('::', list))
.toEqual(IP_MATCH_LIST_STATUS.NOT_FOUND);
});
test('should return the first EXACT or CIDR match in the list', () => {
const list1 = `2001:db8:11a3:9d7:0:0:0:0
2001:0db8:11a3:09d7:0000:0000:0000:0000/64
127.0.0.3`;
expect(getIpMatchListStatus('2001:db8:11a3:9d7:0:0:0:0', list1))
.toEqual(IP_MATCH_LIST_STATUS.EXACT);
const list2 = `2001:0db8:11a3:09d7:0000:0000:0000:0000/64
2001:db8:11a3:9d7:0:0:0:0
127.0.0.3`;
expect(getIpMatchListStatus('2001:db8:11a3:9d7:0:0:0:0', list2))
.toEqual(IP_MATCH_LIST_STATUS.CIDR);
});
});
describe('Empty list or IP', () => {
test('should return NOT_FOUND on empty ip', () => {
const list = `127.0.0.0
2001:db8:11a3:9d7:0:0:0:0
2001:db8:11a3:9d7:ffff:ffff:ffff:ffff
127.0.0.1`;
expect(getIpMatchListStatus('', list))
.toEqual(IP_MATCH_LIST_STATUS.NOT_FOUND);
});
test('should return NOT_FOUND on empty list', () => {
const list = '';
expect(getIpMatchListStatus('127.0.0.1', list))
.toEqual(IP_MATCH_LIST_STATUS.NOT_FOUND);
});
});
});
</s> add import { sortIp, countClientsStatistics, findAddressType } from '../helpers/helpers';
import { ADDRESS_TYPES } from '../helpers/constants'; </s> remove /**
* The purpose of this method is to quickly check
* if this IP can possibly be in the specified CIDR range.
*
* @param ip {string}
* @param listItem {string}
* @returns {boolean}
*/
const isIpQuickMatchCIDR = (ip, listItem) => {
const ipv6 = ip.indexOf(':') !== -1;
const cidrIpv6 = listItem.indexOf(':') !== -1;
if (ipv6 !== cidrIpv6) {
// CIDR is for a different IP type
return false;
}
if (cidrIpv6) {
// We don't do quick check for IPv6 addresses
return true;
}
const idx = listItem.indexOf('/');
if (idx === -1) {
// Not a CIDR, return false immediately
return false;
}
const cidrIp = listItem.substring(0, idx);
const cidrRange = parseInt(listItem.substring(idx + 1), 10);
if (Number.isNaN(cidrRange)) {
// Not a valid CIDR
return false;
}
const parts = cidrIp.split('.');
if (parts.length !== 4) {
// Invalid IP, return immediately
return false;
}
// Now depending on the range we check if the IP can possibly be in that range
if (cidrRange < 8) {
// Use the slow approach
return true;
}
if (cidrRange < 16) {
// Check the first part
// Example: 0.0.0.0/8 matches 0.*.*.*
return ip.indexOf(`${parts[0]}.`) === 0;
}
if (cidrRange < 24) {
// Check the first two parts
// Example: 0.0.0.0/16 matches 0.0.*.*
return ip.indexOf(`${parts[0]}.${parts[1]}.`) === 0;
}
if (cidrRange <= 32) {
// Check the first two parts
// Example: 0.0.0.0/16 matches 0.0.*.*
return ip.indexOf(`${parts[0]}.${parts[1]}.${parts[2]}.`) === 0;
}
// range for IPv4 CIDR cannot be more than 32
// no need to check further, this CIDR is invalid
return false;
};
</s> add </s> remove /**
* @param ip {string}
* @param list {string}
* @returns {'EXACT' | 'CIDR' | 'NOT_FOND'}
*/
export const getIpMatchListStatus = (ip, list) => {
if (!ip || !list) {
return IP_MATCH_LIST_STATUS.NOT_FOUND;
}
const listArr = list.trim()
.split('\n');
try {
for (let i = 0; i < listArr.length; i += 1) {
const listItem = listArr[i];
if (ip === listItem.trim()) {
return IP_MATCH_LIST_STATUS.EXACT;
}
// Using ipaddr.js is quite slow so we first do a quick check
// to see if it's possible that this IP may be in the specified CIDR range
if (isIpQuickMatchCIDR(ip, listItem)) {
const parsedIp = ipaddr.parse(ip);
const isItemAnIp = ipaddr.isValid(listItem);
const parsedItem = isItemAnIp ? ipaddr.parse(listItem) : ipaddr.parseCIDR(listItem);
if (isItemAnIp && parsedIp.toString() === parsedItem.toString()) {
return IP_MATCH_LIST_STATUS.EXACT;
}
if (!isItemAnIp && isIpMatchCidr(parsedIp, parsedItem)) {
return IP_MATCH_LIST_STATUS.CIDR;
}
}
}
return IP_MATCH_LIST_STATUS.NOT_FOUND;
} catch (e) {
console.error(e);
return IP_MATCH_LIST_STATUS.NOT_FOUND;
}
};
</s> add </s> remove export const addClientInfo = (data, clients, param) => (
data.map((row) => {
const clientIp = row[param];
const info = clients.find((item) => item[clientIp]) || '';
return {
...row,
info: info?.[clientIp] ?? '',
};
})
);
</s> add export const addClientInfo = (data, clients, param) => data.map((row) => {
const clientIp = row[param];
const info = clients.find((item) => item[clientIp]) || '';
return {
...row,
info: info?.[clientIp] ?? '',
};
}); | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/c72cd58f69b71e4981d8b182b2f7d53ea5e30868 | client/src/helpers/constants.js | |
<mask> DETAILED_DATE_FORMAT_OPTIONS,
<mask> DHCP_VALUES_PLACEHOLDERS,
<mask> FILTERED,
<mask> FILTERED_STATUS,
<mask> IP_MATCH_LIST_STATUS,
<mask> SERVICES_ID_NAME_MAP,
<mask> STANDARD_DNS_PORT,
<mask> STANDARD_HTTPS_PORT,
<mask> STANDARD_WEB_PORT,
<mask> } from './constants';
</s> + client: Move the client access check to the server-side
Squashed commit of the following:
commit 1aab0f62e94ce665a1b996552fac41dc4e769b4d
Merge: cdf5eb6e c1f5fdae
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 24 15:36:05 2020 +0300
Merge branch '1920-client-find' into feature/1925
commit cdf5eb6ea67a665d21a3155d8cf89bba9a5a9948
Merge: b6c20b1c 10f67bd3
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 23 20:28:51 2020 +0300
Merge branch 'master' into feature/1925
commit b6c20b1c7359a0e5902405b0551712f936848a80
Merge: 97d388ef 96512433
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 15 10:44:25 2020 +0300
Merge branch 'master' into feature/1925
commit 97d388ef6571d590f21da00f86d889e881ca0c3d
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 15 10:30:50 2020 +0300
Extract buttons
commit ca45fde11fc2b2812ff2b84dbd67aff0b5341be1
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 10 12:46:09 2020 +0300
Handle errors in updateLogs
commit f15e03c2e5a7115db984f70f72b0ddd870ece73d
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 10 12:39:34 2020 +0300
Update mobile block status on click
commit 033b28db3b324f6d529ac1a0ef657886cdbe02bd
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 20:53:42 2020 +0300
Fix mobile block buttons, auto open page on web serve start
commit 2730937b23309167a066b9154728ac53ffe81a49
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 13:58:37 2020 +0300
Disable allow this client button when isNotInAllowedList is true
commit 818cf869d63654c184762ad2701c4429a3e3011e
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 13:06:01 2020 +0300
Update client block state on option click
commit a072b8983757f419645c0207ea78e6e867c440cb
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 20:17:16 2020 +0300
Adapt to api changes
commit 28ab2bd8b3f14f60bc822b5a69fa1801db67d816
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 14:12:20 2020 +0300
Change query log block confirm messages
commit 9b0b6f6f9b1ec168fa71dbedd036152da59006e3
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 12:00:46 2020 +0300
Refactor inner work with disallowed
commit 05f76154b8f489738d032fdaa835edb371ce70c7
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Mon Sep 7 16:11:37 2020 +0300
+ client: Move the client access check to the server-side </s> remove import { getPercent, getIpMatchListStatus, sortIp } from '../../helpers/helpers';
import { BLOCK_ACTIONS, IP_MATCH_LIST_STATUS, STATUS_COLORS } from '../../helpers/constants';
</s> add import { getPercent, sortIp } from '../../helpers/helpers';
import { BLOCK_ACTIONS, STATUS_COLORS } from '../../helpers/constants'; </s> remove import { BLOCK_ACTIONS } from '../helpers/constants';
</s> add | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/c72cd58f69b71e4981d8b182b2f7d53ea5e30868 | client/src/helpers/helpers.js | |
export const addClientInfo = (data, clients, param) => data.map((row) => {
const clientIp = row[param];
const info = clients.find((item) => item[clientIp]) || '';
return {
...row,
info: info?.[clientIp] ?? '',
};
}); | <mask> count: Object.values(item)[0],
<mask> }))
<mask> );
<mask>
<mask> export const addClientInfo = (data, clients, param) => (
<mask> data.map((row) => {
<mask> const clientIp = row[param];
<mask> const info = clients.find((item) => item[clientIp]) || '';
<mask> return {
<mask> ...row,
<mask> info: info?.[clientIp] ?? '',
<mask> };
<mask> })
<mask> );
<mask>
<mask> export const normalizeFilters = (filters) => (
<mask> filters ? filters.map((filter) => {
<mask> const {
<mask> id,
</s> + client: Move the client access check to the server-side
Squashed commit of the following:
commit 1aab0f62e94ce665a1b996552fac41dc4e769b4d
Merge: cdf5eb6e c1f5fdae
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 24 15:36:05 2020 +0300
Merge branch '1920-client-find' into feature/1925
commit cdf5eb6ea67a665d21a3155d8cf89bba9a5a9948
Merge: b6c20b1c 10f67bd3
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 23 20:28:51 2020 +0300
Merge branch 'master' into feature/1925
commit b6c20b1c7359a0e5902405b0551712f936848a80
Merge: 97d388ef 96512433
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 15 10:44:25 2020 +0300
Merge branch 'master' into feature/1925
commit 97d388ef6571d590f21da00f86d889e881ca0c3d
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 15 10:30:50 2020 +0300
Extract buttons
commit ca45fde11fc2b2812ff2b84dbd67aff0b5341be1
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 10 12:46:09 2020 +0300
Handle errors in updateLogs
commit f15e03c2e5a7115db984f70f72b0ddd870ece73d
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 10 12:39:34 2020 +0300
Update mobile block status on click
commit 033b28db3b324f6d529ac1a0ef657886cdbe02bd
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 20:53:42 2020 +0300
Fix mobile block buttons, auto open page on web serve start
commit 2730937b23309167a066b9154728ac53ffe81a49
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 13:58:37 2020 +0300
Disable allow this client button when isNotInAllowedList is true
commit 818cf869d63654c184762ad2701c4429a3e3011e
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 13:06:01 2020 +0300
Update client block state on option click
commit a072b8983757f419645c0207ea78e6e867c440cb
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 20:17:16 2020 +0300
Adapt to api changes
commit 28ab2bd8b3f14f60bc822b5a69fa1801db67d816
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 14:12:20 2020 +0300
Change query log block confirm messages
commit 9b0b6f6f9b1ec168fa71dbedd036152da59006e3
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 12:00:46 2020 +0300
Refactor inner work with disallowed
commit 05f76154b8f489738d032fdaa835edb371ce70c7
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Mon Sep 7 16:11:37 2020 +0300
+ client: Move the client access check to the server-side </s> remove const disallowed_clients = useSelector(
(state) => state.access.disallowed_clients,
shallowEqual,
);
</s> add </s> remove export const toggleClientBlock = (type, ip) => async (dispatch) => {
</s> add export const toggleClientBlock = (ip, disallowed, disallowed_rule) => async (dispatch) => { </s> remove export const getBlockClientInfo = (client, disallowed_clients) => {
const ipMatchListStatus = getIpMatchListStatus(client, disallowed_clients);
</s> add export const getBlockClientInfo = (ip, disallowed, disallowed_rule) => {
const confirmMessage = disallowed
? i18next.t('client_confirm_unblock', { ip: disallowed_rule })
: `${i18next.t('adg_will_drop_dns_queries')} ${i18next.t('client_confirm_block', { ip })}`; </s> remove const disallowed_clients = useSelector(
(state) => state.access.disallowed_clients, shallowEqual,
);
const ipMatchListStatus = getIpMatchListStatus(ip, disallowed_clients);
if (ipMatchListStatus === IP_MATCH_LIST_STATUS.CIDR) {
return null;
}
const isNotFound = ipMatchListStatus === IP_MATCH_LIST_STATUS.NOT_FOUND;
const type = isNotFound ? BLOCK_ACTIONS.BLOCK : BLOCK_ACTIONS.UNBLOCK;
const text = type;
</s> add </s> remove info: { name, whois_info },
</s> add info: {
name, whois_info, disallowed, disallowed_rule,
}, | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/c72cd58f69b71e4981d8b182b2f7d53ea5e30868 | client/src/helpers/helpers.js |
<mask> return false;
<mask> }
<mask> };
<mask>
<mask> /**
<mask> * The purpose of this method is to quickly check
<mask> * if this IP can possibly be in the specified CIDR range.
<mask> *
<mask> * @param ip {string}
<mask> * @param listItem {string}
<mask> * @returns {boolean}
<mask> */
<mask> const isIpQuickMatchCIDR = (ip, listItem) => {
<mask> const ipv6 = ip.indexOf(':') !== -1;
<mask> const cidrIpv6 = listItem.indexOf(':') !== -1;
<mask> if (ipv6 !== cidrIpv6) {
<mask> // CIDR is for a different IP type
<mask> return false;
<mask> }
<mask>
<mask> if (cidrIpv6) {
<mask> // We don't do quick check for IPv6 addresses
<mask> return true;
<mask> }
<mask>
<mask> const idx = listItem.indexOf('/');
<mask> if (idx === -1) {
<mask> // Not a CIDR, return false immediately
<mask> return false;
<mask> }
<mask>
<mask> const cidrIp = listItem.substring(0, idx);
<mask> const cidrRange = parseInt(listItem.substring(idx + 1), 10);
<mask> if (Number.isNaN(cidrRange)) {
<mask> // Not a valid CIDR
<mask> return false;
<mask> }
<mask>
<mask> const parts = cidrIp.split('.');
<mask> if (parts.length !== 4) {
<mask> // Invalid IP, return immediately
<mask> return false;
<mask> }
<mask>
<mask> // Now depending on the range we check if the IP can possibly be in that range
<mask> if (cidrRange < 8) {
<mask> // Use the slow approach
<mask> return true;
<mask> }
<mask>
<mask> if (cidrRange < 16) {
<mask> // Check the first part
<mask> // Example: 0.0.0.0/8 matches 0.*.*.*
<mask> return ip.indexOf(`${parts[0]}.`) === 0;
<mask> }
<mask>
<mask> if (cidrRange < 24) {
<mask> // Check the first two parts
<mask> // Example: 0.0.0.0/16 matches 0.0.*.*
<mask> return ip.indexOf(`${parts[0]}.${parts[1]}.`) === 0;
<mask> }
<mask>
<mask> if (cidrRange <= 32) {
<mask> // Check the first two parts
<mask> // Example: 0.0.0.0/16 matches 0.0.*.*
<mask> return ip.indexOf(`${parts[0]}.${parts[1]}.${parts[2]}.`) === 0;
<mask> }
<mask>
<mask> // range for IPv4 CIDR cannot be more than 32
<mask> // no need to check further, this CIDR is invalid
<mask> return false;
<mask> };
<mask>
<mask> /**
<mask> *
<mask> * @param ipOrCidr
<mask> * @returns {'IP' | 'CIDR' | 'UNKNOWN'}
<mask> *
</s> + client: Move the client access check to the server-side
Squashed commit of the following:
commit 1aab0f62e94ce665a1b996552fac41dc4e769b4d
Merge: cdf5eb6e c1f5fdae
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 24 15:36:05 2020 +0300
Merge branch '1920-client-find' into feature/1925
commit cdf5eb6ea67a665d21a3155d8cf89bba9a5a9948
Merge: b6c20b1c 10f67bd3
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 23 20:28:51 2020 +0300
Merge branch 'master' into feature/1925
commit b6c20b1c7359a0e5902405b0551712f936848a80
Merge: 97d388ef 96512433
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 15 10:44:25 2020 +0300
Merge branch 'master' into feature/1925
commit 97d388ef6571d590f21da00f86d889e881ca0c3d
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 15 10:30:50 2020 +0300
Extract buttons
commit ca45fde11fc2b2812ff2b84dbd67aff0b5341be1
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 10 12:46:09 2020 +0300
Handle errors in updateLogs
commit f15e03c2e5a7115db984f70f72b0ddd870ece73d
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 10 12:39:34 2020 +0300
Update mobile block status on click
commit 033b28db3b324f6d529ac1a0ef657886cdbe02bd
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 20:53:42 2020 +0300
Fix mobile block buttons, auto open page on web serve start
commit 2730937b23309167a066b9154728ac53ffe81a49
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 13:58:37 2020 +0300
Disable allow this client button when isNotInAllowedList is true
commit 818cf869d63654c184762ad2701c4429a3e3011e
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 13:06:01 2020 +0300
Update client block state on option click
commit a072b8983757f419645c0207ea78e6e867c440cb
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 20:17:16 2020 +0300
Adapt to api changes
commit 28ab2bd8b3f14f60bc822b5a69fa1801db67d816
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 14:12:20 2020 +0300
Change query log block confirm messages
commit 9b0b6f6f9b1ec168fa71dbedd036152da59006e3
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 12:00:46 2020 +0300
Refactor inner work with disallowed
commit 05f76154b8f489738d032fdaa835edb371ce70c7
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Mon Sep 7 16:11:37 2020 +0300
+ client: Move the client access check to the server-side </s> remove /**
* @param ip {string}
* @param list {string}
* @returns {'EXACT' | 'CIDR' | 'NOT_FOND'}
*/
export const getIpMatchListStatus = (ip, list) => {
if (!ip || !list) {
return IP_MATCH_LIST_STATUS.NOT_FOUND;
}
const listArr = list.trim()
.split('\n');
try {
for (let i = 0; i < listArr.length; i += 1) {
const listItem = listArr[i];
if (ip === listItem.trim()) {
return IP_MATCH_LIST_STATUS.EXACT;
}
// Using ipaddr.js is quite slow so we first do a quick check
// to see if it's possible that this IP may be in the specified CIDR range
if (isIpQuickMatchCIDR(ip, listItem)) {
const parsedIp = ipaddr.parse(ip);
const isItemAnIp = ipaddr.isValid(listItem);
const parsedItem = isItemAnIp ? ipaddr.parse(listItem) : ipaddr.parseCIDR(listItem);
if (isItemAnIp && parsedIp.toString() === parsedItem.toString()) {
return IP_MATCH_LIST_STATUS.EXACT;
}
if (!isItemAnIp && isIpMatchCidr(parsedIp, parsedItem)) {
return IP_MATCH_LIST_STATUS.CIDR;
}
}
}
return IP_MATCH_LIST_STATUS.NOT_FOUND;
} catch (e) {
console.error(e);
return IP_MATCH_LIST_STATUS.NOT_FOUND;
}
};
</s> add </s> remove export const IP_MATCH_LIST_STATUS = {
NOT_FOUND: 'NOT_FOUND', // not found in the list
EXACT: 'EXACT', // found exact match (including the match of short and long forms)
CIDR: 'CIDR', // the ip is in the specified CIDR range
};
</s> add </s> remove // todo: figure out if we cat get rid of redux-form state duplication
</s> add </s> remove import {
countClientsStatistics, findAddressType, getIpMatchListStatus, sortIp,
} from '../helpers/helpers';
import { ADDRESS_TYPES, IP_MATCH_LIST_STATUS } from '../helpers/constants';
describe('getIpMatchListStatus', () => {
describe('IPv4', () => {
test('should return EXACT on find the exact ip match', () => {
const list = `127.0.0.2
2001:db8:11a3:9d7:0:0:0:0
192.168.0.1/8
127.0.0.1
127.0.0.3`;
expect(getIpMatchListStatus('127.0.0.1', list))
.toEqual(IP_MATCH_LIST_STATUS.EXACT);
});
test('should return CIDR on find the cidr match', () => {
const list = `127.0.0.2
2001:db8:11a3:9d7:0:0:0:0
192.168.0.1/8
127.0.0.0/24
127.0.0.3`;
expect(getIpMatchListStatus('127.0.0.1', list))
.toEqual(IP_MATCH_LIST_STATUS.CIDR);
});
test('should return NOT_FOUND if the ip is not in the list', () => {
const list = `127.0.0.1
2001:db8:11a3:9d7:0:0:0:0
192.168.0.1/8
127.0.0.2
127.0.0.3`;
expect(getIpMatchListStatus('127.0.0.4', list))
.toEqual(IP_MATCH_LIST_STATUS.NOT_FOUND);
});
test('should return the first EXACT or CIDR match in the list', () => {
const list1 = `2001:db8:11a3:9d7:0:0:0:0
127.0.0.1
127.0.0.8/24
127.0.0.3`;
expect(getIpMatchListStatus('127.0.0.1', list1))
.toEqual(IP_MATCH_LIST_STATUS.EXACT);
const list2 = `2001:db8:11a3:9d7:ffff:ffff:ffff:ffff
2001:0db8:11a3:09d7:0000:0000:0000:0000/64
127.0.0.0/24
127.0.0.1
127.0.0.8/24
127.0.0.3`;
expect(getIpMatchListStatus('127.0.0.1', list2))
.toEqual(IP_MATCH_LIST_STATUS.CIDR);
});
});
describe('IPv6', () => {
test('should return EXACT on find the exact ip match', () => {
const list = `127.0.0.0
2001:db8:11a3:9d7:0:0:0:0
2001:db8:11a3:9d7:ffff:ffff:ffff:ffff
127.0.0.1`;
expect(getIpMatchListStatus('2001:db8:11a3:9d7:0:0:0:0', list))
.toEqual(IP_MATCH_LIST_STATUS.EXACT);
});
test('should return EXACT on find the exact ip match of short and long notation', () => {
const list = `127.0.0.0
192.168.0.1/8
2001:db8::
127.0.0.2`;
expect(getIpMatchListStatus('2001:db8:0:0:0:0:0:0', list))
.toEqual(IP_MATCH_LIST_STATUS.EXACT);
});
test('should return CIDR on find the cidr match', () => {
const list1 = `2001:0db8:11a3:09d7:0000:0000:0000:0000/64
127.0.0.1
127.0.0.2`;
expect(getIpMatchListStatus('2001:db8:11a3:9d7:0:0:0:0', list1))
.toEqual(IP_MATCH_LIST_STATUS.CIDR);
const list2 = `2001:0db8::/16
127.0.0.0
2001:db8:11a3:9d7:0:0:0:0
2001:db8::
2001:db8:11a3:9d7:ffff:ffff:ffff:ffff
127.0.0.1`;
expect(getIpMatchListStatus('2001:db1::', list2))
.toEqual(IP_MATCH_LIST_STATUS.CIDR);
});
test('should return NOT_FOUND if the ip is not in the list', () => {
const list = `2001:db8:11a3:9d7:0:0:0:0
2001:0db8:11a3:09d7:0000:0000:0000:0000/64
127.0.0.1
127.0.0.2`;
expect(getIpMatchListStatus('::', list))
.toEqual(IP_MATCH_LIST_STATUS.NOT_FOUND);
});
test('should return the first EXACT or CIDR match in the list', () => {
const list1 = `2001:db8:11a3:9d7:0:0:0:0
2001:0db8:11a3:09d7:0000:0000:0000:0000/64
127.0.0.3`;
expect(getIpMatchListStatus('2001:db8:11a3:9d7:0:0:0:0', list1))
.toEqual(IP_MATCH_LIST_STATUS.EXACT);
const list2 = `2001:0db8:11a3:09d7:0000:0000:0000:0000/64
2001:db8:11a3:9d7:0:0:0:0
127.0.0.3`;
expect(getIpMatchListStatus('2001:db8:11a3:9d7:0:0:0:0', list2))
.toEqual(IP_MATCH_LIST_STATUS.CIDR);
});
});
describe('Empty list or IP', () => {
test('should return NOT_FOUND on empty ip', () => {
const list = `127.0.0.0
2001:db8:11a3:9d7:0:0:0:0
2001:db8:11a3:9d7:ffff:ffff:ffff:ffff
127.0.0.1`;
expect(getIpMatchListStatus('', list))
.toEqual(IP_MATCH_LIST_STATUS.NOT_FOUND);
});
test('should return NOT_FOUND on empty list', () => {
const list = '';
expect(getIpMatchListStatus('127.0.0.1', list))
.toEqual(IP_MATCH_LIST_STATUS.NOT_FOUND);
});
});
});
</s> add import { sortIp, countClientsStatistics, findAddressType } from '../helpers/helpers';
import { ADDRESS_TYPES } from '../helpers/constants'; </s> remove const { ip } = rowInfo.original;
</s> add const { info: { disallowed } } = rowInfo.original; | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"re... | https://github.com/AdguardTeam/AdGuardHome/commit/c72cd58f69b71e4981d8b182b2f7d53ea5e30868 | client/src/helpers/helpers.js | |
<mask> return ADDRESS_TYPES.UNKNOWN;
<mask> }
<mask> };
<mask>
<mask> /**
<mask> * @param ip {string}
<mask> * @param list {string}
<mask> * @returns {'EXACT' | 'CIDR' | 'NOT_FOND'}
<mask> */
<mask> export const getIpMatchListStatus = (ip, list) => {
<mask> if (!ip || !list) {
<mask> return IP_MATCH_LIST_STATUS.NOT_FOUND;
<mask> }
<mask>
<mask> const listArr = list.trim()
<mask> .split('\n');
<mask>
<mask> try {
<mask> for (let i = 0; i < listArr.length; i += 1) {
<mask> const listItem = listArr[i];
<mask>
<mask> if (ip === listItem.trim()) {
<mask> return IP_MATCH_LIST_STATUS.EXACT;
<mask> }
<mask>
<mask> // Using ipaddr.js is quite slow so we first do a quick check
<mask> // to see if it's possible that this IP may be in the specified CIDR range
<mask> if (isIpQuickMatchCIDR(ip, listItem)) {
<mask> const parsedIp = ipaddr.parse(ip);
<mask> const isItemAnIp = ipaddr.isValid(listItem);
<mask> const parsedItem = isItemAnIp ? ipaddr.parse(listItem) : ipaddr.parseCIDR(listItem);
<mask>
<mask> if (isItemAnIp && parsedIp.toString() === parsedItem.toString()) {
<mask> return IP_MATCH_LIST_STATUS.EXACT;
<mask> }
<mask>
<mask> if (!isItemAnIp && isIpMatchCidr(parsedIp, parsedItem)) {
<mask> return IP_MATCH_LIST_STATUS.CIDR;
<mask> }
<mask> }
<mask> }
<mask> return IP_MATCH_LIST_STATUS.NOT_FOUND;
<mask> } catch (e) {
<mask> console.error(e);
<mask> return IP_MATCH_LIST_STATUS.NOT_FOUND;
<mask> }
<mask> };
<mask>
<mask> /**
<mask> * @param ids {string[]}
<mask> * @returns {Object}
<mask> */
<mask> export const separateIpsAndCidrs = (ids) => ids.reduce((acc, curr) => {
</s> + client: Move the client access check to the server-side
Squashed commit of the following:
commit 1aab0f62e94ce665a1b996552fac41dc4e769b4d
Merge: cdf5eb6e c1f5fdae
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 24 15:36:05 2020 +0300
Merge branch '1920-client-find' into feature/1925
commit cdf5eb6ea67a665d21a3155d8cf89bba9a5a9948
Merge: b6c20b1c 10f67bd3
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 23 20:28:51 2020 +0300
Merge branch 'master' into feature/1925
commit b6c20b1c7359a0e5902405b0551712f936848a80
Merge: 97d388ef 96512433
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 15 10:44:25 2020 +0300
Merge branch 'master' into feature/1925
commit 97d388ef6571d590f21da00f86d889e881ca0c3d
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 15 10:30:50 2020 +0300
Extract buttons
commit ca45fde11fc2b2812ff2b84dbd67aff0b5341be1
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 10 12:46:09 2020 +0300
Handle errors in updateLogs
commit f15e03c2e5a7115db984f70f72b0ddd870ece73d
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 10 12:39:34 2020 +0300
Update mobile block status on click
commit 033b28db3b324f6d529ac1a0ef657886cdbe02bd
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 20:53:42 2020 +0300
Fix mobile block buttons, auto open page on web serve start
commit 2730937b23309167a066b9154728ac53ffe81a49
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 13:58:37 2020 +0300
Disable allow this client button when isNotInAllowedList is true
commit 818cf869d63654c184762ad2701c4429a3e3011e
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 13:06:01 2020 +0300
Update client block state on option click
commit a072b8983757f419645c0207ea78e6e867c440cb
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 20:17:16 2020 +0300
Adapt to api changes
commit 28ab2bd8b3f14f60bc822b5a69fa1801db67d816
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 14:12:20 2020 +0300
Change query log block confirm messages
commit 9b0b6f6f9b1ec168fa71dbedd036152da59006e3
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 12:00:46 2020 +0300
Refactor inner work with disallowed
commit 05f76154b8f489738d032fdaa835edb371ce70c7
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Mon Sep 7 16:11:37 2020 +0300
+ client: Move the client access check to the server-side </s> remove /**
* The purpose of this method is to quickly check
* if this IP can possibly be in the specified CIDR range.
*
* @param ip {string}
* @param listItem {string}
* @returns {boolean}
*/
const isIpQuickMatchCIDR = (ip, listItem) => {
const ipv6 = ip.indexOf(':') !== -1;
const cidrIpv6 = listItem.indexOf(':') !== -1;
if (ipv6 !== cidrIpv6) {
// CIDR is for a different IP type
return false;
}
if (cidrIpv6) {
// We don't do quick check for IPv6 addresses
return true;
}
const idx = listItem.indexOf('/');
if (idx === -1) {
// Not a CIDR, return false immediately
return false;
}
const cidrIp = listItem.substring(0, idx);
const cidrRange = parseInt(listItem.substring(idx + 1), 10);
if (Number.isNaN(cidrRange)) {
// Not a valid CIDR
return false;
}
const parts = cidrIp.split('.');
if (parts.length !== 4) {
// Invalid IP, return immediately
return false;
}
// Now depending on the range we check if the IP can possibly be in that range
if (cidrRange < 8) {
// Use the slow approach
return true;
}
if (cidrRange < 16) {
// Check the first part
// Example: 0.0.0.0/8 matches 0.*.*.*
return ip.indexOf(`${parts[0]}.`) === 0;
}
if (cidrRange < 24) {
// Check the first two parts
// Example: 0.0.0.0/16 matches 0.0.*.*
return ip.indexOf(`${parts[0]}.${parts[1]}.`) === 0;
}
if (cidrRange <= 32) {
// Check the first two parts
// Example: 0.0.0.0/16 matches 0.0.*.*
return ip.indexOf(`${parts[0]}.${parts[1]}.${parts[2]}.`) === 0;
}
// range for IPv4 CIDR cannot be more than 32
// no need to check further, this CIDR is invalid
return false;
};
</s> add </s> remove // todo: figure out if we cat get rid of redux-form state duplication
</s> add </s> remove import {
countClientsStatistics, findAddressType, getIpMatchListStatus, sortIp,
} from '../helpers/helpers';
import { ADDRESS_TYPES, IP_MATCH_LIST_STATUS } from '../helpers/constants';
describe('getIpMatchListStatus', () => {
describe('IPv4', () => {
test('should return EXACT on find the exact ip match', () => {
const list = `127.0.0.2
2001:db8:11a3:9d7:0:0:0:0
192.168.0.1/8
127.0.0.1
127.0.0.3`;
expect(getIpMatchListStatus('127.0.0.1', list))
.toEqual(IP_MATCH_LIST_STATUS.EXACT);
});
test('should return CIDR on find the cidr match', () => {
const list = `127.0.0.2
2001:db8:11a3:9d7:0:0:0:0
192.168.0.1/8
127.0.0.0/24
127.0.0.3`;
expect(getIpMatchListStatus('127.0.0.1', list))
.toEqual(IP_MATCH_LIST_STATUS.CIDR);
});
test('should return NOT_FOUND if the ip is not in the list', () => {
const list = `127.0.0.1
2001:db8:11a3:9d7:0:0:0:0
192.168.0.1/8
127.0.0.2
127.0.0.3`;
expect(getIpMatchListStatus('127.0.0.4', list))
.toEqual(IP_MATCH_LIST_STATUS.NOT_FOUND);
});
test('should return the first EXACT or CIDR match in the list', () => {
const list1 = `2001:db8:11a3:9d7:0:0:0:0
127.0.0.1
127.0.0.8/24
127.0.0.3`;
expect(getIpMatchListStatus('127.0.0.1', list1))
.toEqual(IP_MATCH_LIST_STATUS.EXACT);
const list2 = `2001:db8:11a3:9d7:ffff:ffff:ffff:ffff
2001:0db8:11a3:09d7:0000:0000:0000:0000/64
127.0.0.0/24
127.0.0.1
127.0.0.8/24
127.0.0.3`;
expect(getIpMatchListStatus('127.0.0.1', list2))
.toEqual(IP_MATCH_LIST_STATUS.CIDR);
});
});
describe('IPv6', () => {
test('should return EXACT on find the exact ip match', () => {
const list = `127.0.0.0
2001:db8:11a3:9d7:0:0:0:0
2001:db8:11a3:9d7:ffff:ffff:ffff:ffff
127.0.0.1`;
expect(getIpMatchListStatus('2001:db8:11a3:9d7:0:0:0:0', list))
.toEqual(IP_MATCH_LIST_STATUS.EXACT);
});
test('should return EXACT on find the exact ip match of short and long notation', () => {
const list = `127.0.0.0
192.168.0.1/8
2001:db8::
127.0.0.2`;
expect(getIpMatchListStatus('2001:db8:0:0:0:0:0:0', list))
.toEqual(IP_MATCH_LIST_STATUS.EXACT);
});
test('should return CIDR on find the cidr match', () => {
const list1 = `2001:0db8:11a3:09d7:0000:0000:0000:0000/64
127.0.0.1
127.0.0.2`;
expect(getIpMatchListStatus('2001:db8:11a3:9d7:0:0:0:0', list1))
.toEqual(IP_MATCH_LIST_STATUS.CIDR);
const list2 = `2001:0db8::/16
127.0.0.0
2001:db8:11a3:9d7:0:0:0:0
2001:db8::
2001:db8:11a3:9d7:ffff:ffff:ffff:ffff
127.0.0.1`;
expect(getIpMatchListStatus('2001:db1::', list2))
.toEqual(IP_MATCH_LIST_STATUS.CIDR);
});
test('should return NOT_FOUND if the ip is not in the list', () => {
const list = `2001:db8:11a3:9d7:0:0:0:0
2001:0db8:11a3:09d7:0000:0000:0000:0000/64
127.0.0.1
127.0.0.2`;
expect(getIpMatchListStatus('::', list))
.toEqual(IP_MATCH_LIST_STATUS.NOT_FOUND);
});
test('should return the first EXACT or CIDR match in the list', () => {
const list1 = `2001:db8:11a3:9d7:0:0:0:0
2001:0db8:11a3:09d7:0000:0000:0000:0000/64
127.0.0.3`;
expect(getIpMatchListStatus('2001:db8:11a3:9d7:0:0:0:0', list1))
.toEqual(IP_MATCH_LIST_STATUS.EXACT);
const list2 = `2001:0db8:11a3:09d7:0000:0000:0000:0000/64
2001:db8:11a3:9d7:0:0:0:0
127.0.0.3`;
expect(getIpMatchListStatus('2001:db8:11a3:9d7:0:0:0:0', list2))
.toEqual(IP_MATCH_LIST_STATUS.CIDR);
});
});
describe('Empty list or IP', () => {
test('should return NOT_FOUND on empty ip', () => {
const list = `127.0.0.0
2001:db8:11a3:9d7:0:0:0:0
2001:db8:11a3:9d7:ffff:ffff:ffff:ffff
127.0.0.1`;
expect(getIpMatchListStatus('', list))
.toEqual(IP_MATCH_LIST_STATUS.NOT_FOUND);
});
test('should return NOT_FOUND on empty list', () => {
const list = '';
expect(getIpMatchListStatus('127.0.0.1', list))
.toEqual(IP_MATCH_LIST_STATUS.NOT_FOUND);
});
});
});
</s> add import { sortIp, countClientsStatistics, findAddressType } from '../helpers/helpers';
import { ADDRESS_TYPES } from '../helpers/constants'; </s> remove const disallowed_clients = useSelector(
(state) => state.access.disallowed_clients, shallowEqual,
);
const ipMatchListStatus = getIpMatchListStatus(ip, disallowed_clients);
if (ipMatchListStatus === IP_MATCH_LIST_STATUS.CIDR) {
return null;
}
const isNotFound = ipMatchListStatus === IP_MATCH_LIST_STATUS.NOT_FOUND;
const type = isNotFound ? BLOCK_ACTIONS.BLOCK : BLOCK_ACTIONS.UNBLOCK;
const text = type;
</s> add </s> remove export const getBlockClientInfo = (client, disallowed_clients) => {
const ipMatchListStatus = getIpMatchListStatus(client, disallowed_clients);
</s> add export const getBlockClientInfo = (ip, disallowed, disallowed_rule) => {
const confirmMessage = disallowed
? i18next.t('client_confirm_unblock', { ip: disallowed_rule })
: `${i18next.t('adg_will_drop_dns_queries')} ${i18next.t('client_confirm_block', { ip })}`; | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"re... | https://github.com/AdguardTeam/AdGuardHome/commit/c72cd58f69b71e4981d8b182b2f7d53ea5e30868 | client/src/helpers/helpers.js | |
<mask> import { handleActions } from 'redux-actions';
<mask> import * as actions from '../actions';
<mask> import { enrichWithConcatenatedIpAddresses } from '../helpers/helpers';
<mask>
<mask> // todo: figure out if we cat get rid of redux-form state duplication
<mask> const dhcp = handleActions(
<mask> {
<mask> [actions.getDhcpStatusRequest]: (state) => ({
<mask> ...state,
<mask> processing: true,
</s> + client: Move the client access check to the server-side
Squashed commit of the following:
commit 1aab0f62e94ce665a1b996552fac41dc4e769b4d
Merge: cdf5eb6e c1f5fdae
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 24 15:36:05 2020 +0300
Merge branch '1920-client-find' into feature/1925
commit cdf5eb6ea67a665d21a3155d8cf89bba9a5a9948
Merge: b6c20b1c 10f67bd3
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 23 20:28:51 2020 +0300
Merge branch 'master' into feature/1925
commit b6c20b1c7359a0e5902405b0551712f936848a80
Merge: 97d388ef 96512433
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 15 10:44:25 2020 +0300
Merge branch 'master' into feature/1925
commit 97d388ef6571d590f21da00f86d889e881ca0c3d
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 15 10:30:50 2020 +0300
Extract buttons
commit ca45fde11fc2b2812ff2b84dbd67aff0b5341be1
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 10 12:46:09 2020 +0300
Handle errors in updateLogs
commit f15e03c2e5a7115db984f70f72b0ddd870ece73d
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 10 12:39:34 2020 +0300
Update mobile block status on click
commit 033b28db3b324f6d529ac1a0ef657886cdbe02bd
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 20:53:42 2020 +0300
Fix mobile block buttons, auto open page on web serve start
commit 2730937b23309167a066b9154728ac53ffe81a49
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 13:58:37 2020 +0300
Disable allow this client button when isNotInAllowedList is true
commit 818cf869d63654c184762ad2701c4429a3e3011e
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 13:06:01 2020 +0300
Update client block state on option click
commit a072b8983757f419645c0207ea78e6e867c440cb
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 20:17:16 2020 +0300
Adapt to api changes
commit 28ab2bd8b3f14f60bc822b5a69fa1801db67d816
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 14:12:20 2020 +0300
Change query log block confirm messages
commit 9b0b6f6f9b1ec168fa71dbedd036152da59006e3
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 12:00:46 2020 +0300
Refactor inner work with disallowed
commit 05f76154b8f489738d032fdaa835edb371ce70c7
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Mon Sep 7 16:11:37 2020 +0300
+ client: Move the client access check to the server-side </s> remove import { BLOCK_ACTIONS } from '../helpers/constants';
</s> add </s> remove import { getPercent, getIpMatchListStatus, sortIp } from '../../helpers/helpers';
import { BLOCK_ACTIONS, IP_MATCH_LIST_STATUS, STATUS_COLORS } from '../../helpers/constants';
</s> add import { getPercent, sortIp } from '../../helpers/helpers';
import { BLOCK_ACTIONS, STATUS_COLORS } from '../../helpers/constants'; </s> remove import { getIpMatchListStatus } from '../../../../helpers/helpers';
import { BLOCK_ACTIONS, IP_MATCH_LIST_STATUS } from '../../../../helpers/constants';
</s> add import i18next from 'i18next'; | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/c72cd58f69b71e4981d8b182b2f7d53ea5e30868 | client/src/reducers/dhcp.js | |
open: true, | <mask> proxy: {
<mask> [proxyUrl]: `http://${devServerHost}:${port}`,
<mask> },
<mask> };
<mask> };
<mask>
<mask> module.exports = merge(common, {
<mask> devtool: 'eval-source-map',
<mask> module: {
</s> + client: Move the client access check to the server-side
Squashed commit of the following:
commit 1aab0f62e94ce665a1b996552fac41dc4e769b4d
Merge: cdf5eb6e c1f5fdae
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 24 15:36:05 2020 +0300
Merge branch '1920-client-find' into feature/1925
commit cdf5eb6ea67a665d21a3155d8cf89bba9a5a9948
Merge: b6c20b1c 10f67bd3
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 23 20:28:51 2020 +0300
Merge branch 'master' into feature/1925
commit b6c20b1c7359a0e5902405b0551712f936848a80
Merge: 97d388ef 96512433
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 15 10:44:25 2020 +0300
Merge branch 'master' into feature/1925
commit 97d388ef6571d590f21da00f86d889e881ca0c3d
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 15 10:30:50 2020 +0300
Extract buttons
commit ca45fde11fc2b2812ff2b84dbd67aff0b5341be1
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 10 12:46:09 2020 +0300
Handle errors in updateLogs
commit f15e03c2e5a7115db984f70f72b0ddd870ece73d
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Thu Sep 10 12:39:34 2020 +0300
Update mobile block status on click
commit 033b28db3b324f6d529ac1a0ef657886cdbe02bd
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 20:53:42 2020 +0300
Fix mobile block buttons, auto open page on web serve start
commit 2730937b23309167a066b9154728ac53ffe81a49
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 13:58:37 2020 +0300
Disable allow this client button when isNotInAllowedList is true
commit 818cf869d63654c184762ad2701c4429a3e3011e
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Sep 9 13:06:01 2020 +0300
Update client block state on option click
commit a072b8983757f419645c0207ea78e6e867c440cb
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 20:17:16 2020 +0300
Adapt to api changes
commit 28ab2bd8b3f14f60bc822b5a69fa1801db67d816
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 14:12:20 2020 +0300
Change query log block confirm messages
commit 9b0b6f6f9b1ec168fa71dbedd036152da59006e3
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Sep 8 12:00:46 2020 +0300
Refactor inner work with disallowed
commit 05f76154b8f489738d032fdaa835edb371ce70c7
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Mon Sep 7 16:11:37 2020 +0300
+ client: Move the client access check to the server-side </s> remove [blockingClientKey]: () => {
const message = `${type === BLOCK_ACTIONS.BLOCK ? t('adg_will_drop_dns_queries') : ''} ${t(confirmMessage, { ip: client })}`;
if (window.confirm(message)) {
dispatch(toggleClientBlock(type, client));
}
</s> add {
name: blockingClientKey,
onClick: async () => {
if (window.confirm(confirmMessage)) {
await dispatch(toggleClientBlock(client, disallowed, disallowed_rule));
await dispatch(updateLogs());
}
},
disabled: isNotInAllowedList, </s> remove info: { name, whois_info },
</s> add info: {
name, whois_info, disallowed, disallowed_rule,
}, </s> remove const BUTTON_OPTIONS_TO_ACTION_MAP = {
[blockingForClientKey]: () => {
dispatch(toggleBlockingForClient(buttonType, domain, clientNameBlockingFor));
</s> add const BUTTON_OPTIONS = [
{
name: blockingForClientKey,
onClick: () => {
dispatch(toggleBlockingForClient(buttonType, domain, clientNameBlockingFor));
}, </s> remove };
</s> add ]; </s> remove const onBlockingClientClick = () => {
const message = `${blockType === BLOCK_ACTIONS.BLOCK ? t('adg_will_drop_dns_queries') : ''} ${t(confirmMessage, { ip: client })}`;
if (window.confirm(message)) {
dispatch(toggleClientBlock(blockType, client));
</s> add const onBlockingClientClick = async () => {
if (window.confirm(confirmMessage)) {
await dispatch(toggleClientBlock(client, disallowed, disallowed_rule));
await dispatch(updateLogs());
setModalOpened(false); | [
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/c72cd58f69b71e4981d8b182b2f7d53ea5e30868 | client/webpack.dev.js |
"bufio" | <mask>
<mask> import (
<mask> "bytes"
<mask> "compress/gzip"
<mask> "encoding/json"
<mask> "fmt"
<mask> "io"
</s> * querylog: skip decoding errors
We read line from file and pass it to a JSON decoder.
JSON decoder is now a local object. </s> remove r.jd = nil
</s> add </s> remove log.Error("QueryLog: Failed to decode: %s", err)
r.jd = nil
return nil
</s> add log.Debug("QueryLog: Failed to decode: %s", err)
continue </s> remove err = r.jd.Decode(&entry)
</s> add err = jd.Decode(&entry) | [
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/c74ae0d0e7ca03a592663025dc644397c1e31d57 | querylog/querylog_file.go |
"strings" | <mask> "fmt"
<mask> "io"
<mask> "os"
<mask> "time"
<mask>
<mask> "github.com/AdguardTeam/golibs/log"
<mask> "github.com/go-test/deep"
<mask> )
<mask>
</s> * querylog: skip decoding errors
We read line from file and pass it to a JSON decoder.
JSON decoder is now a local object. </s> remove r.jd = nil
</s> add </s> remove log.Error("QueryLog: Failed to decode: %s", err)
r.jd = nil
return nil
</s> add log.Debug("QueryLog: Failed to decode: %s", err)
continue </s> remove err = r.jd.Decode(&entry)
</s> add err = jd.Decode(&entry) | [
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/c74ae0d0e7ca03a592663025dc644397c1e31d57 | querylog/querylog_file.go |
reader *bufio.Reader // reads file line by line | <mask> type Reader struct {
<mask> ql *queryLog
<mask>
<mask> f *os.File
<mask> jd *json.Decoder
<mask> now time.Time
<mask> validFrom int64 // UNIX time (ns)
<mask> olderThan int64 // UNIX time (ns)
<mask>
<mask> files []string
</s> * querylog: skip decoding errors
We read line from file and pass it to a JSON decoder.
JSON decoder is now a local object. </s> remove var err error
</s> add </s> remove // open decoder if needed
if r.jd == nil {
r.jd = json.NewDecoder(r.f)
}
// check if there's data
if !r.jd.More() {
r.jd = nil
</s> add // open decoder
b, err := r.reader.ReadBytes('\n')
if err != nil { </s> remove r.jd = nil
</s> add </s> remove err = r.jd.Decode(&entry)
</s> add err = jd.Decode(&entry) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/c74ae0d0e7ca03a592663025dc644397c1e31d57 | querylog/querylog_file.go |
<mask> r.olderThan = r.now.UnixNano()
<mask> }
<mask> r.filePrepared = false
<mask> r.searching = false
<mask> r.jd = nil
<mask> }
<mask>
<mask> // BeginReadPrev - start reading the previous data chunk
<mask> func (r *Reader) BeginReadPrev(olderThan time.Time, count uint64) {
<mask> r.olderThan = olderThan.UnixNano()
</s> * querylog: skip decoding errors
We read line from file and pass it to a JSON decoder.
JSON decoder is now a local object. </s> remove r.jd = nil
</s> add </s> remove // open decoder if needed
if r.jd == nil {
r.jd = json.NewDecoder(r.f)
}
// check if there's data
if !r.jd.More() {
r.jd = nil
</s> add // open decoder
b, err := r.reader.ReadBytes('\n')
if err != nil { </s> remove var err error
</s> add </s> remove _, err = r.f.Seek(int64(r.fpos), io.SeekStart)
if err != nil {
log.Error("QueryLog: file.Seek: %s: %s", r.files[r.ifile], err)
return false
}
</s> add </s> remove err = r.jd.Decode(&entry)
</s> add err = jd.Decode(&entry) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/c74ae0d0e7ca03a592663025dc644397c1e31d57 | querylog/querylog_file.go | |
<mask> r.fseeker.pos = r.fpos
<mask>
<mask> r.filePrepared = true
<mask> r.searching = false
<mask> r.jd = nil
<mask> }
<mask>
<mask> // Perform binary seek
<mask> // Return 0: success; 1: seek reqiured; -1: error
<mask> func (fs *fileSeeker) seekBinary(cur uint64) int32 {
</s> * querylog: skip decoding errors
We read line from file and pass it to a JSON decoder.
JSON decoder is now a local object. </s> remove r.jd = nil
</s> add </s> remove r.jd = nil
</s> add </s> remove // open decoder if needed
if r.jd == nil {
r.jd = json.NewDecoder(r.f)
}
// check if there's data
if !r.jd.More() {
r.jd = nil
</s> add // open decoder
b, err := r.reader.ReadBytes('\n')
if err != nil { </s> remove _, err = r.f.Seek(int64(r.fpos), io.SeekStart)
if err != nil {
log.Error("QueryLog: file.Seek: %s: %s", r.files[r.ifile], err)
return false
}
</s> add | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/c74ae0d0e7ca03a592663025dc644397c1e31d57 | querylog/querylog_file.go | |
r.reader = bufio.NewReader(r.f)
b, err := r.reader.ReadBytes('\n') | <mask> }
<mask>
<mask> // Seek to a new line
<mask> func (r *Reader) seekToNewLine() bool {
<mask> b := make([]byte, maxEntrySize*2)
<mask>
<mask> _, err := r.f.Read(b)
<mask> if err != nil {
<mask> log.Error("QueryLog: file.Read: %s: %s", r.files[r.ifile], err)
<mask> return false
<mask> }
<mask>
</s> * querylog: skip decoding errors
We read line from file and pass it to a JSON decoder.
JSON decoder is now a local object. </s> remove _, err = r.f.Seek(int64(r.fpos), io.SeekStart)
if err != nil {
log.Error("QueryLog: file.Seek: %s: %s", r.files[r.ifile], err)
return false
}
</s> add </s> remove off := bytes.IndexByte(b, '\n') + 1
if off == 0 {
log.Error("QueryLog: Can't find a new line: %s", r.files[r.ifile])
return false
}
</s> add off := len(b) </s> remove var err error
</s> add </s> remove err = r.jd.Decode(&entry)
</s> add err = jd.Decode(&entry) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/c74ae0d0e7ca03a592663025dc644397c1e31d57 | querylog/querylog_file.go |
r.reader = nil | <mask> b, err := r.reader.ReadBytes('\n')
<mask> if err != nil {
<mask> log.Error("QueryLog: file.Read: %s: %s", r.files[r.ifile], err)
<mask> return false
<mask> }
<mask>
<mask> off := len(b)
</s> * querylog: skip decoding errors
We read line from file and pass it to a JSON decoder.
JSON decoder is now a local object. </s> remove off := bytes.IndexByte(b, '\n') + 1
if off == 0 {
log.Error("QueryLog: Can't find a new line: %s", r.files[r.ifile])
return false
}
</s> add off := len(b) </s> remove b := make([]byte, maxEntrySize*2)
_, err := r.f.Read(b)
</s> add r.reader = bufio.NewReader(r.f)
b, err := r.reader.ReadBytes('\n') </s> remove _, err = r.f.Seek(int64(r.fpos), io.SeekStart)
if err != nil {
log.Error("QueryLog: file.Seek: %s: %s", r.files[r.ifile], err)
return false
}
</s> add </s> remove // open decoder if needed
if r.jd == nil {
r.jd = json.NewDecoder(r.f)
}
// check if there's data
if !r.jd.More() {
r.jd = nil
</s> add // open decoder
b, err := r.reader.ReadBytes('\n')
if err != nil { | [
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/c74ae0d0e7ca03a592663025dc644397c1e31d57 | querylog/querylog_file.go |
off := len(b) | <mask> log.Error("QueryLog: file.Read: %s: %s", r.files[r.ifile], err)
<mask> return false
<mask> }
<mask>
<mask> off := bytes.IndexByte(b, '\n') + 1
<mask> if off == 0 {
<mask> log.Error("QueryLog: Can't find a new line: %s", r.files[r.ifile])
<mask> return false
<mask> }
<mask>
<mask> r.fpos += uint64(off)
<mask> log.Debug("QueryLog: seek: %x (+%d)", r.fpos, off)
<mask> _, err = r.f.Seek(int64(r.fpos), io.SeekStart)
<mask> if err != nil {
<mask> log.Error("QueryLog: file.Seek: %s: %s", r.files[r.ifile], err)
</s> * querylog: skip decoding errors
We read line from file and pass it to a JSON decoder.
JSON decoder is now a local object. </s> remove _, err = r.f.Seek(int64(r.fpos), io.SeekStart)
if err != nil {
log.Error("QueryLog: file.Seek: %s: %s", r.files[r.ifile], err)
return false
}
</s> add </s> remove b := make([]byte, maxEntrySize*2)
_, err := r.f.Read(b)
</s> add r.reader = bufio.NewReader(r.f)
b, err := r.reader.ReadBytes('\n') </s> remove r.jd = nil
</s> add </s> remove log.Error("QueryLog: Failed to decode: %s", err)
r.jd = nil
return nil
</s> add log.Debug("QueryLog: Failed to decode: %s", err)
continue | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/c74ae0d0e7ca03a592663025dc644397c1e31d57 | querylog/querylog_file.go |
<mask> }
<mask>
<mask> r.fpos += uint64(off)
<mask> log.Debug("QueryLog: seek: %x (+%d)", r.fpos, off)
<mask> _, err = r.f.Seek(int64(r.fpos), io.SeekStart)
<mask> if err != nil {
<mask> log.Error("QueryLog: file.Seek: %s: %s", r.files[r.ifile], err)
<mask> return false
<mask> }
<mask> return true
<mask> }
<mask>
<mask> // Open a file
<mask> func (r *Reader) openFile() bool {
</s> * querylog: skip decoding errors
We read line from file and pass it to a JSON decoder.
JSON decoder is now a local object. </s> remove off := bytes.IndexByte(b, '\n') + 1
if off == 0 {
log.Error("QueryLog: Can't find a new line: %s", r.files[r.ifile])
return false
}
</s> add off := len(b) </s> remove b := make([]byte, maxEntrySize*2)
_, err := r.f.Read(b)
</s> add r.reader = bufio.NewReader(r.f)
b, err := r.reader.ReadBytes('\n') </s> remove var err error
</s> add </s> remove // open decoder if needed
if r.jd == nil {
r.jd = json.NewDecoder(r.f)
}
// check if there's data
if !r.jd.More() {
r.jd = nil
</s> add // open decoder
b, err := r.reader.ReadBytes('\n')
if err != nil { | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/c74ae0d0e7ca03a592663025dc644397c1e31d57 | querylog/querylog_file.go | |
<mask> }
<mask>
<mask> // Next - return the next entry or nil if reading is finished
<mask> func (r *Reader) Next() *logEntry { // nolint
<mask> var err error
<mask> for {
<mask> // open file if needed
<mask> if r.f == nil {
<mask> if r.ifile == len(r.files) {
<mask> return nil
</s> * querylog: skip decoding errors
We read line from file and pass it to a JSON decoder.
JSON decoder is now a local object. </s> remove // open decoder if needed
if r.jd == nil {
r.jd = json.NewDecoder(r.f)
}
// check if there's data
if !r.jd.More() {
r.jd = nil
</s> add // open decoder
b, err := r.reader.ReadBytes('\n')
if err != nil { </s> remove _, err = r.f.Seek(int64(r.fpos), io.SeekStart)
if err != nil {
log.Error("QueryLog: file.Seek: %s: %s", r.files[r.ifile], err)
return false
}
</s> add </s> remove r.jd = nil
</s> add </s> remove err = r.jd.Decode(&entry)
</s> add err = jd.Decode(&entry) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/c74ae0d0e7ca03a592663025dc644397c1e31d57 | querylog/querylog_file.go | |
// open decoder
b, err := r.reader.ReadBytes('\n')
if err != nil { | <mask> }
<mask> r.filePrepared = true
<mask> }
<mask>
<mask> // open decoder if needed
<mask> if r.jd == nil {
<mask> r.jd = json.NewDecoder(r.f)
<mask> }
<mask>
<mask> // check if there's data
<mask> if !r.jd.More() {
<mask> r.jd = nil
<mask> return nil
<mask> }
<mask>
<mask> // read data
<mask> var entry logEntry
</s> * querylog: skip decoding errors
We read line from file and pass it to a JSON decoder.
JSON decoder is now a local object. </s> remove err = r.jd.Decode(&entry)
</s> add err = jd.Decode(&entry) </s> remove log.Error("QueryLog: Failed to decode: %s", err)
r.jd = nil
return nil
</s> add log.Debug("QueryLog: Failed to decode: %s", err)
continue </s> remove var err error
</s> add </s> remove r.jd = nil
</s> add | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/c74ae0d0e7ca03a592663025dc644397c1e31d57 | querylog/querylog_file.go |
strReader := strings.NewReader(string(b))
jd := json.NewDecoder(strReader) | <mask> b, err := r.reader.ReadBytes('\n')
<mask> if err != nil {
<mask> return nil
<mask> }
<mask>
<mask> // read data
<mask> var entry logEntry
<mask> err = jd.Decode(&entry)
<mask> if err != nil {
</s> * querylog: skip decoding errors
We read line from file and pass it to a JSON decoder.
JSON decoder is now a local object. </s> remove err = r.jd.Decode(&entry)
</s> add err = jd.Decode(&entry) </s> remove // open decoder if needed
if r.jd == nil {
r.jd = json.NewDecoder(r.f)
}
// check if there's data
if !r.jd.More() {
r.jd = nil
</s> add // open decoder
b, err := r.reader.ReadBytes('\n')
if err != nil { </s> remove log.Error("QueryLog: Failed to decode: %s", err)
r.jd = nil
return nil
</s> add log.Debug("QueryLog: Failed to decode: %s", err)
continue </s> remove var err error
</s> add | [
"keep",
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/c74ae0d0e7ca03a592663025dc644397c1e31d57 | querylog/querylog_file.go |
err = jd.Decode(&entry) | <mask> }
<mask>
<mask> // read data
<mask> var entry logEntry
<mask> err = r.jd.Decode(&entry)
<mask> if err != nil {
<mask> log.Error("QueryLog: Failed to decode: %s", err)
<mask> r.jd = nil
<mask> return nil
<mask> }
</s> * querylog: skip decoding errors
We read line from file and pass it to a JSON decoder.
JSON decoder is now a local object. </s> remove log.Error("QueryLog: Failed to decode: %s", err)
r.jd = nil
return nil
</s> add log.Debug("QueryLog: Failed to decode: %s", err)
continue </s> remove // open decoder if needed
if r.jd == nil {
r.jd = json.NewDecoder(r.f)
}
// check if there's data
if !r.jd.More() {
r.jd = nil
</s> add // open decoder
b, err := r.reader.ReadBytes('\n')
if err != nil { </s> remove b := make([]byte, maxEntrySize*2)
_, err := r.f.Read(b)
</s> add r.reader = bufio.NewReader(r.f)
b, err := r.reader.ReadBytes('\n') </s> remove var err error
</s> add | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/c74ae0d0e7ca03a592663025dc644397c1e31d57 | querylog/querylog_file.go |
log.Debug("QueryLog: Failed to decode: %s", err)
continue | <mask> // read data
<mask> var entry logEntry
<mask> err = r.jd.Decode(&entry)
<mask> if err != nil {
<mask> log.Error("QueryLog: Failed to decode: %s", err)
<mask> r.jd = nil
<mask> return nil
<mask> }
<mask>
<mask> t := entry.Time.UnixNano()
<mask> if r.searching {
<mask> r.jd = nil
</s> * querylog: skip decoding errors
We read line from file and pass it to a JSON decoder.
JSON decoder is now a local object. </s> remove err = r.jd.Decode(&entry)
</s> add err = jd.Decode(&entry) </s> remove // open decoder if needed
if r.jd == nil {
r.jd = json.NewDecoder(r.f)
}
// check if there's data
if !r.jd.More() {
r.jd = nil
</s> add // open decoder
b, err := r.reader.ReadBytes('\n')
if err != nil { </s> remove r.jd = nil
</s> add | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/c74ae0d0e7ca03a592663025dc644397c1e31d57 | querylog/querylog_file.go |
<mask> }
<mask>
<mask> t := entry.Time.UnixNano()
<mask> if r.searching {
<mask> r.jd = nil
<mask>
<mask> rr := r.fseeker.seekBinary(uint64(t))
<mask> r.fpos = r.fseeker.pos
<mask> if rr < 0 {
<mask> log.Error("QueryLog: File seek error: can't find the target entry: %s", r.files[r.ifile])
</s> * querylog: skip decoding errors
We read line from file and pass it to a JSON decoder.
JSON decoder is now a local object. </s> remove r.jd = nil
</s> add </s> remove log.Error("QueryLog: Failed to decode: %s", err)
r.jd = nil
return nil
</s> add log.Debug("QueryLog: Failed to decode: %s", err)
continue </s> remove off := bytes.IndexByte(b, '\n') + 1
if off == 0 {
log.Error("QueryLog: Can't find a new line: %s", r.files[r.ifile])
return false
}
</s> add off := len(b) </s> remove // open decoder if needed
if r.jd == nil {
r.jd = json.NewDecoder(r.f)
}
// check if there's data
if !r.jd.More() {
r.jd = nil
</s> add // open decoder
b, err := r.reader.ReadBytes('\n')
if err != nil { | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/c74ae0d0e7ca03a592663025dc644397c1e31d57 | querylog/querylog_file.go | |
r.reader = nil | <mask> t := entry.Time.UnixNano()
<mask> if r.searching {
<mask>
<mask> rr := r.fseeker.seekBinary(uint64(t))
<mask> r.fpos = r.fseeker.pos
<mask> if rr < 0 {
<mask> log.Error("QueryLog: File seek error: can't find the target entry: %s", r.files[r.ifile])
</s> * querylog: skip decoding errors
We read line from file and pass it to a JSON decoder.
JSON decoder is now a local object. </s> remove r.jd = nil
</s> add </s> remove r.jd = nil
</s> add </s> remove log.Error("QueryLog: Failed to decode: %s", err)
r.jd = nil
return nil
</s> add log.Debug("QueryLog: Failed to decode: %s", err)
continue </s> remove off := bytes.IndexByte(b, '\n') + 1
if off == 0 {
log.Error("QueryLog: Can't find a new line: %s", r.files[r.ifile])
return false
}
</s> add off := len(b) </s> remove var err error
</s> add | [
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/c74ae0d0e7ca03a592663025dc644397c1e31d57 | querylog/querylog_file.go |
{"service", "s", "Service control action: status, install, uninstall, start, stop, restart, reload (configuration)", func(value string) { | <mask> panic("Got port that is not a number")
<mask> }
<mask> o.bindPort = v
<mask> }, nil},
<mask> {"service", "s", "Service control action: status, install, uninstall, start, stop, restart", func(value string) {
<mask> o.serviceControlAction = value
<mask> }, nil},
<mask> {"logfile", "l", "Path to log file. If empty: write to stdout; if 'syslog': write to system log", func(value string) {
<mask> o.logFile = value
<mask> }, nil},
</s> + service: support "-s reload" command </s> remove import "golang.org/x/sys/windows"
</s> add import (
"fmt"
"syscall"
"golang.org/x/sys/windows"
) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/c77907694d48c785b4b958616c04c42449faf302 | home/home.go |
"fmt" | <mask> package home
<mask>
<mask> import (
<mask> "io/ioutil"
<mask> "os"
<mask> "runtime"
<mask> "strconv"
<mask> "strings"
</s> + service: support "-s reload" command </s> remove import "golang.org/x/sys/windows"
</s> add import (
"fmt"
"syscall"
"golang.org/x/sys/windows"
) | [
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/c77907694d48c785b4b958616c04c42449faf302 | home/service.go |
"strconv" | <mask> "os"
<mask> "runtime"
<mask> "strings"
<mask> "syscall"
<mask>
<mask> "github.com/AdguardTeam/AdGuardHome/util"
</s> + service: support "-s reload" command </s> remove import "golang.org/x/sys/windows"
</s> add import (
"fmt"
"syscall"
"golang.org/x/sys/windows"
) | [
"keep",
"add",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/c77907694d48c785b4b958616c04c42449faf302 | home/service.go |
if action == "reload" {
sendSigReload()
return
}
| <mask> // that it is being run as a service/daemon.
<mask> func handleServiceControlAction(action string) {
<mask> log.Printf("Service control action: %s", action)
<mask>
<mask> pwd, err := os.Getwd()
<mask> if err != nil {
<mask> log.Fatal("Unable to find the path to the current directory")
<mask> }
<mask> svcConfig := &service.Config{
</s> + service: support "-s reload" command </s> remove {"service", "s", "Service control action: status, install, uninstall, start, stop, restart", func(value string) {
</s> add {"service", "s", "Service control action: status, install, uninstall, start, stop, restart, reload (configuration)", func(value string) { </s> remove import "golang.org/x/sys/windows"
</s> add import (
"fmt"
"syscall"
"golang.org/x/sys/windows"
) | [
"keep",
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/c77907694d48c785b4b958616c04c42449faf302 | home/service.go |
// SendProcessSignal - send signal to a process
func SendProcessSignal(pid int, sig syscall.Signal) error {
return syscall.Kill(pid, sig)
} | <mask> // Check if the current user has root (administrator) rights
<mask> func HaveAdminRights() (bool, error) {
<mask> return os.Getuid() == 0, nil
<mask> }
</s> + service: support "-s reload" command </s> remove import "golang.org/x/sys/windows"
</s> add import (
"fmt"
"syscall"
"golang.org/x/sys/windows"
) </s> remove {"service", "s", "Service control action: status, install, uninstall, start, stop, restart", func(value string) {
</s> add {"service", "s", "Service control action: status, install, uninstall, start, stop, restart, reload (configuration)", func(value string) { | [
"keep",
"keep",
"keep",
"add"
] | https://github.com/AdguardTeam/AdGuardHome/commit/c77907694d48c785b4b958616c04c42449faf302 | util/os_unix.go |
import (
"fmt"
"syscall"
"golang.org/x/sys/windows"
) | <mask> package util
<mask>
<mask> import "golang.org/x/sys/windows"
<mask>
<mask> // Set user-specified limit of how many fd's we can use
<mask> func SetRlimit(val uint) {
<mask> }
<mask>
</s> + service: support "-s reload" command </s> remove {"service", "s", "Service control action: status, install, uninstall, start, stop, restart", func(value string) {
</s> add {"service", "s", "Service control action: status, install, uninstall, start, stop, restart, reload (configuration)", func(value string) { | [
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/c77907694d48c785b4b958616c04c42449faf302 | util/os_windows.go |
func SendProcessSignal(pid int, sig syscall.Signal) error {
return fmt.Errorf("not supported on Windows")
} | <mask> return false, nil
<mask> }
<mask> return true, nil
<mask> }
</s> + service: support "-s reload" command </s> remove import "golang.org/x/sys/windows"
</s> add import (
"fmt"
"syscall"
"golang.org/x/sys/windows"
) </s> remove {"service", "s", "Service control action: status, install, uninstall, start, stop, restart", func(value string) {
</s> add {"service", "s", "Service control action: status, install, uninstall, start, stop, restart, reload (configuration)", func(value string) { | [
"keep",
"keep",
"keep",
"add"
] | https://github.com/AdguardTeam/AdGuardHome/commit/c77907694d48c785b4b958616c04c42449faf302 | util/os_windows.go |
"rewrite_applied": "Rewrite rule is applied",
"rewrite_hosts_applied": "Rewritten by the hosts file rule", | <mask> "rewrite_add": "Add DNS rewrite",
<mask> "rewrite_not_found": "No DNS rewrites found",
<mask> "rewrite_confirm_delete": "Are you sure you want to delete DNS rewrite for \"{{key}}\"?",
<mask> "rewrite_desc": "Allows to easily configure custom DNS response for a specific domain name.",
<mask> "rewrite_applied": "Applied Rewrite rule",
<mask> "dns_rewrites": "DNS rewrites",
<mask> "form_domain": "Enter domain name or wildcard",
<mask> "form_answer": "Enter IP address or domain name",
<mask> "form_error_domain_format": "Invalid domain format",
<mask> "form_error_answer_format": "Invalid answer format",
</s> + client: handle rewrite auto </s> remove } else if (checkRewrite(reason)) {
</s> add } else if (checkRewrite(reason) || checkRewriteHosts(reason)) { | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/c7f8f20aada3e339b82434fab3d1b02c52bdd4e1 | client/src/__locales/en.json |
checkRewriteHosts, | <mask>
<mask> import {
<mask> checkFiltered,
<mask> checkRewrite,
<mask> checkBlackList,
<mask> checkNotFilteredNotFound,
<mask> checkWhiteList,
<mask> checkSafeSearch,
</s> + client: handle rewrite auto </s> remove } else if (checkRewrite(reason)) {
</s> add } else if (checkRewrite(reason) || checkRewriteHosts(reason)) { </s> remove } else if (checkRewrite(reason)) {
</s> add } else if (checkRewrite(reason) || checkRewriteHosts(reason)) { | [
"keep",
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/c7f8f20aada3e339b82434fab3d1b02c52bdd4e1 | client/src/components/Filters/Check/Info.js |
if (checkRewriteHosts(reason)) {
return t('rewrite_hosts_applied');
}
| <mask> return t('rewrite_applied');
<mask> }
<mask>
<mask> if (checkBlackList(reason)) {
<mask> return filterName;
<mask> }
<mask>
</s> + client: handle rewrite auto </s> remove } else if (checkRewrite(reason)) {
</s> add } else if (checkRewrite(reason) || checkRewriteHosts(reason)) { </s> remove } else if (checkRewrite(reason)) {
</s> add } else if (checkRewrite(reason) || checkRewriteHosts(reason)) { | [
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/c7f8f20aada3e339b82434fab3d1b02c52bdd4e1 | client/src/components/Filters/Check/Info.js |
} else if (checkRewrite(reason) || checkRewriteHosts(reason)) { | <mask>
<mask> const getColor = (reason) => {
<mask> if (checkFiltered(reason)) {
<mask> return 'red';
<mask> } else if (checkRewrite(reason)) {
<mask> return 'blue';
<mask> } else if (checkWhiteList(reason)) {
<mask> return 'green';
<mask> }
<mask>
</s> + client: handle rewrite auto </s> remove } else if (checkRewrite(reason)) {
</s> add } else if (checkRewrite(reason) || checkRewriteHosts(reason)) { | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/c7f8f20aada3e339b82434fab3d1b02c52bdd4e1 | client/src/components/Filters/Check/Info.js |
checkRewriteHosts, | <mask> isToday,
<mask> checkFiltered,
<mask> checkRewrite,
<mask> checkWhiteList,
<mask> checkBlackList,
<mask> checkBlockedService,
<mask> } from '../../helpers/helpers';
</s> + client: handle rewrite auto </s> remove } else if (checkRewrite(reason)) {
</s> add } else if (checkRewrite(reason) || checkRewriteHosts(reason)) { </s> remove } else if (checkRewrite(reason)) {
</s> add } else if (checkRewrite(reason) || checkRewriteHosts(reason)) { | [
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/c7f8f20aada3e339b82434fab3d1b02c52bdd4e1 | client/src/components/Logs/index.js |
const isRewriteAuto = checkRewriteHosts(reason); | <mask> const isBlackList = checkBlackList(reason);
<mask> const isRewrite = checkRewrite(reason);
<mask> const isWhiteList = checkWhiteList(reason);
<mask> const isBlockedService = checkBlockedService(reason);
<mask> const isBlockedCnameIp = originalAnswer;
<mask>
</s> + client: handle rewrite auto </s> remove } else if (checkRewrite(reason)) {
</s> add } else if (checkRewrite(reason) || checkRewriteHosts(reason)) { </s> remove } else if (checkRewrite(reason)) {
</s> add } else if (checkRewrite(reason) || checkRewriteHosts(reason)) { | [
"keep",
"add",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/c7f8f20aada3e339b82434fab3d1b02c52bdd4e1 | client/src/components/Logs/index.js |
{isRewriteAuto && (
<span className="logs__text">
<strong>
<Trans>rewrite_hosts_applied</Trans>
</strong>
</span>
)} | <mask> <strong>
<mask> <Trans>rewrite_applied</Trans>
<mask> </strong>
<mask> )}
<mask> </div>
<mask> <div className="logs__list-wrap">
<mask> {this.renderResponseList(responses, status)}
<mask> {isWhiteList && this.renderTooltip(isWhiteList, rule, filterName)}
<mask> </div>
</s> + client: handle rewrite auto </s> remove } else if (checkRewrite(reason)) {
</s> add } else if (checkRewrite(reason) || checkRewriteHosts(reason)) { | [
"keep",
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/c7f8f20aada3e339b82434fab3d1b02c52bdd4e1 | client/src/components/Logs/index.js |
const isAutoRewrite = checkRewriteHosts(reason);
if (isAutoRewrite) {
return (
<div className="logs__row logs__row--overflow logs__row--column">
{formatClientCell(row, t)}
</div>
);
} | <mask> const isFiltered = checkFiltered(reason);
<mask> const isRewrite = checkRewrite(reason);
<mask>
<mask> return (
<mask> <Fragment>
<mask> <div className="logs__row logs__row--overflow logs__row--column">
<mask> {formatClientCell(row, t)}
<mask> </div>
</s> + client: handle rewrite auto </s> remove } else if (checkRewrite(reason)) {
</s> add } else if (checkRewrite(reason) || checkRewriteHosts(reason)) { | [
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/c7f8f20aada3e339b82434fab3d1b02c52bdd4e1 | client/src/components/Logs/index.js |
} else if (checkRewrite(reason) || checkRewriteHosts(reason)) { | <mask> } else if (checkWhiteList(reason)) {
<mask> return {
<mask> className: 'green',
<mask> };
<mask> } else if (checkRewrite(reason)) {
<mask> return {
<mask> className: 'blue',
<mask> };
<mask> }
<mask>
</s> + client: handle rewrite auto </s> remove } else if (checkRewrite(reason)) {
</s> add } else if (checkRewrite(reason) || checkRewriteHosts(reason)) { | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/c7f8f20aada3e339b82434fab3d1b02c52bdd4e1 | client/src/components/Logs/index.js |
REWRITE_HOSTS: 'RewriteEtcHosts', | <mask> FILTERED_BLOCKED_SERVICE: 'FilteredBlockedService',
<mask> REWRITE: 'Rewrite',
<mask> FILTERED_SAFE_SEARCH: 'FilteredSafeSearch',
<mask> FILTERED_SAFE_BROWSING: 'FilteredSafeBrowsing',
<mask> FILTERED_PARENTAL: 'FilteredParental',
<mask> };
</s> + client: handle rewrite auto </s> remove } else if (checkRewrite(reason)) {
</s> add } else if (checkRewrite(reason) || checkRewriteHosts(reason)) { | [
"keep",
"add",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/c7f8f20aada3e339b82434fab3d1b02c52bdd4e1 | client/src/helpers/constants.js |
export const checkRewriteHosts = reason => reason === FILTERED_STATUS.REWRITE_HOSTS; | <mask> : input.onBlur());
<mask>
<mask> export const checkFiltered = reason => reason.indexOf(FILTERED) === 0;
<mask> export const checkRewrite = reason => reason === FILTERED_STATUS.REWRITE;
<mask> export const checkBlackList = reason => reason === FILTERED_STATUS.FILTERED_BLACK_LIST;
<mask> export const checkWhiteList = reason => reason === FILTERED_STATUS.NOT_FILTERED_WHITE_LIST;
<mask> export const checkNotFilteredNotFound = reason => reason === FILTERED_STATUS.NOT_FILTERED_NOT_FOUND;
<mask> export const checkSafeSearch = reason => reason === FILTERED_STATUS.FILTERED_SAFE_SEARCH;
</s> + client: handle rewrite auto </s> remove } else if (checkRewrite(reason)) {
</s> add } else if (checkRewrite(reason) || checkRewriteHosts(reason)) { </s> remove } else if (checkRewrite(reason)) {
</s> add } else if (checkRewrite(reason) || checkRewriteHosts(reason)) { | [
"keep",
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/c7f8f20aada3e339b82434fab3d1b02c52bdd4e1 | client/src/helpers/helpers.js |
var err error
| <mask> }
<mask>
<mask> // ResetLeases - reset leases
<mask> func (s *v4Server) ResetLeases(leases []*Lease) {
<mask> if !s.conf.Enabled {
<mask> return
<mask> }
<mask>
</s> Pull request: dhcpd: normalize hostnames of invalid static leases
Updates #3027.
Squashed commit of the following:
commit 171ebaecb4b96ebeb2d0fa350460c65f244e94ae
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Thu Apr 29 14:45:04 2021 +0300
all: imp docs
commit 48b13ed5b435042a0622a66b60407116ae5aa288
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Thu Apr 29 14:34:28 2021 +0300
dhcpd: normalize hostnames of invalid static leases </s> remove // normalizeHostname normalizes a hostname sent by the client.
</s> add // normalizeHostname normalizes a hostname sent by the client. If err is not
// nil, norm is an empty string. </s> remove log.Error("dhcpv4: cannot normalize hostname for %s: %s", mac, err)
// Go on and assign a hostname made from the IP.
}
if hostname != "" {
if cliHostname != hostname {
log.Debug(
"dhcpv4: normalized hostname %q into %q",
cliHostname,
hostname,
)
}
if lease.Hostname != hostname {
// Either a new lease or an old lease with a new
// hostname, so validate.
err = s.validateHostname(hostname)
if err != nil {
log.Error("dhcpv4: validating %s: %s", mac, err)
// Go on and assign a hostname made from
// the IP below.
hostname = ""
}
}
}
if hostname == "" {
hostname = aghnet.GenerateHostname(reqIP)
</s> add log.Info("dhcpv4: warning: client hostname %q is invalid: %s", cliHostname, err) </s> remove // TODO(a.garipov): Better error handling.
</s> add log.Info("dhcpv4: warning: previous hostname %q is invalid: %s", l.Hostname, err)
}
err = s.addLease(l)
if err != nil {
// TODO(a.garipov): Wrap and bubble up the error. </s> remove lease.Hostname = hostname
</s> add </s> remove
var hostname string
hostname, err = normalizeHostname(cliHostname)
</s> add lease.Hostname, err = s.validHostnameForClient(cliHostname, reqIP) | [
"keep",
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/c8092fe34d62f00ee6c224c0eddbdb5a58ec3bcc | internal/dhcpd/v4.go |
l.Hostname, err = s.validHostnameForClient(l.Hostname, l.IP) | <mask> s.leaseHosts = aghstrings.NewSet()
<mask> s.leases = nil
<mask>
<mask> for _, l := range leases {
<mask> err := s.addLease(l)
<mask> if err != nil {
<mask> // TODO(a.garipov): Better error handling.
<mask> log.Error(
<mask> "dhcpv4: reset: re-adding a lease for %s (%s): %s",
<mask> l.IP,
</s> Pull request: dhcpd: normalize hostnames of invalid static leases
Updates #3027.
Squashed commit of the following:
commit 171ebaecb4b96ebeb2d0fa350460c65f244e94ae
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Thu Apr 29 14:45:04 2021 +0300
all: imp docs
commit 48b13ed5b435042a0622a66b60407116ae5aa288
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Thu Apr 29 14:34:28 2021 +0300
dhcpd: normalize hostnames of invalid static leases </s> remove // TODO(a.garipov): Better error handling.
</s> add log.Info("dhcpv4: warning: previous hostname %q is invalid: %s", l.Hostname, err)
}
err = s.addLease(l)
if err != nil {
// TODO(a.garipov): Wrap and bubble up the error. </s> remove
var hostname string
hostname, err = normalizeHostname(cliHostname)
</s> add lease.Hostname, err = s.validHostnameForClient(cliHostname, reqIP) </s> remove log.Error("dhcpv4: cannot normalize hostname for %s: %s", mac, err)
// Go on and assign a hostname made from the IP.
}
if hostname != "" {
if cliHostname != hostname {
log.Debug(
"dhcpv4: normalized hostname %q into %q",
cliHostname,
hostname,
)
}
if lease.Hostname != hostname {
// Either a new lease or an old lease with a new
// hostname, so validate.
err = s.validateHostname(hostname)
if err != nil {
log.Error("dhcpv4: validating %s: %s", mac, err)
// Go on and assign a hostname made from
// the IP below.
hostname = ""
}
}
}
if hostname == "" {
hostname = aghnet.GenerateHostname(reqIP)
</s> add log.Info("dhcpv4: warning: client hostname %q is invalid: %s", cliHostname, err) </s> remove lease.Hostname = hostname
</s> add | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/c8092fe34d62f00ee6c224c0eddbdb5a58ec3bcc | internal/dhcpd/v4.go |
log.Info("dhcpv4: warning: previous hostname %q is invalid: %s", l.Hostname, err)
}
err = s.addLease(l)
if err != nil {
// TODO(a.garipov): Wrap and bubble up the error. | <mask>
<mask> for _, l := range leases {
<mask> err := s.addLease(l)
<mask> if err != nil {
<mask> // TODO(a.garipov): Better error handling.
<mask> log.Error(
<mask> "dhcpv4: reset: re-adding a lease for %s (%s): %s",
<mask> l.IP,
<mask> l.HWAddr,
<mask> err,
</s> Pull request: dhcpd: normalize hostnames of invalid static leases
Updates #3027.
Squashed commit of the following:
commit 171ebaecb4b96ebeb2d0fa350460c65f244e94ae
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Thu Apr 29 14:45:04 2021 +0300
all: imp docs
commit 48b13ed5b435042a0622a66b60407116ae5aa288
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Thu Apr 29 14:34:28 2021 +0300
dhcpd: normalize hostnames of invalid static leases </s> remove err := s.addLease(l)
</s> add l.Hostname, err = s.validHostnameForClient(l.Hostname, l.IP) </s> remove
var hostname string
hostname, err = normalizeHostname(cliHostname)
</s> add lease.Hostname, err = s.validHostnameForClient(cliHostname, reqIP) </s> remove log.Error("dhcpv4: cannot normalize hostname for %s: %s", mac, err)
// Go on and assign a hostname made from the IP.
}
if hostname != "" {
if cliHostname != hostname {
log.Debug(
"dhcpv4: normalized hostname %q into %q",
cliHostname,
hostname,
)
}
if lease.Hostname != hostname {
// Either a new lease or an old lease with a new
// hostname, so validate.
err = s.validateHostname(hostname)
if err != nil {
log.Error("dhcpv4: validating %s: %s", mac, err)
// Go on and assign a hostname made from
// the IP below.
hostname = ""
}
}
}
if hostname == "" {
hostname = aghnet.GenerateHostname(reqIP)
</s> add log.Info("dhcpv4: warning: client hostname %q is invalid: %s", cliHostname, err) </s> remove // normalizeHostname normalizes a hostname sent by the client.
</s> add // normalizeHostname normalizes a hostname sent by the client. If err is not
// nil, norm is an empty string. | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/c8092fe34d62f00ee6c224c0eddbdb5a58ec3bcc | internal/dhcpd/v4.go |
// normalizeHostname normalizes a hostname sent by the client. If err is not
// nil, norm is an empty string. | <mask> copy(b[i:], []byte(o.name))
<mask> return b
<mask> }
<mask>
<mask> // normalizeHostname normalizes a hostname sent by the client.
<mask> func normalizeHostname(name string) (norm string, err error) {
<mask> if name == "" {
<mask> return "", nil
<mask> }
<mask>
</s> Pull request: dhcpd: normalize hostnames of invalid static leases
Updates #3027.
Squashed commit of the following:
commit 171ebaecb4b96ebeb2d0fa350460c65f244e94ae
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Thu Apr 29 14:45:04 2021 +0300
all: imp docs
commit 48b13ed5b435042a0622a66b60407116ae5aa288
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Thu Apr 29 14:34:28 2021 +0300
dhcpd: normalize hostnames of invalid static leases </s> remove log.Error("dhcpv4: cannot normalize hostname for %s: %s", mac, err)
// Go on and assign a hostname made from the IP.
}
if hostname != "" {
if cliHostname != hostname {
log.Debug(
"dhcpv4: normalized hostname %q into %q",
cliHostname,
hostname,
)
}
if lease.Hostname != hostname {
// Either a new lease or an old lease with a new
// hostname, so validate.
err = s.validateHostname(hostname)
if err != nil {
log.Error("dhcpv4: validating %s: %s", mac, err)
// Go on and assign a hostname made from
// the IP below.
hostname = ""
}
}
}
if hostname == "" {
hostname = aghnet.GenerateHostname(reqIP)
</s> add log.Info("dhcpv4: warning: client hostname %q is invalid: %s", cliHostname, err) </s> remove
var hostname string
hostname, err = normalizeHostname(cliHostname)
</s> add lease.Hostname, err = s.validHostnameForClient(cliHostname, reqIP) </s> remove // TODO(a.garipov): Better error handling.
</s> add log.Info("dhcpv4: warning: previous hostname %q is invalid: %s", l.Hostname, err)
}
err = s.addLease(l)
if err != nil {
// TODO(a.garipov): Wrap and bubble up the error. </s> remove lease.Hostname = hostname
</s> add | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/c8092fe34d62f00ee6c224c0eddbdb5a58ec3bcc | internal/dhcpd/v4.go |
lease.Hostname, err = s.validHostnameForClient(cliHostname, reqIP) | <mask> }
<mask>
<mask> if !lease.IsStatic() {
<mask> cliHostname := req.HostName()
<mask>
<mask> var hostname string
<mask> hostname, err = normalizeHostname(cliHostname)
<mask> if err != nil {
<mask> log.Error("dhcpv4: cannot normalize hostname for %s: %s", mac, err)
<mask>
<mask> // Go on and assign a hostname made from the IP.
<mask> }
</s> Pull request: dhcpd: normalize hostnames of invalid static leases
Updates #3027.
Squashed commit of the following:
commit 171ebaecb4b96ebeb2d0fa350460c65f244e94ae
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Thu Apr 29 14:45:04 2021 +0300
all: imp docs
commit 48b13ed5b435042a0622a66b60407116ae5aa288
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Thu Apr 29 14:34:28 2021 +0300
dhcpd: normalize hostnames of invalid static leases </s> remove log.Error("dhcpv4: cannot normalize hostname for %s: %s", mac, err)
// Go on and assign a hostname made from the IP.
}
if hostname != "" {
if cliHostname != hostname {
log.Debug(
"dhcpv4: normalized hostname %q into %q",
cliHostname,
hostname,
)
}
if lease.Hostname != hostname {
// Either a new lease or an old lease with a new
// hostname, so validate.
err = s.validateHostname(hostname)
if err != nil {
log.Error("dhcpv4: validating %s: %s", mac, err)
// Go on and assign a hostname made from
// the IP below.
hostname = ""
}
}
}
if hostname == "" {
hostname = aghnet.GenerateHostname(reqIP)
</s> add log.Info("dhcpv4: warning: client hostname %q is invalid: %s", cliHostname, err) </s> remove // TODO(a.garipov): Better error handling.
</s> add log.Info("dhcpv4: warning: previous hostname %q is invalid: %s", l.Hostname, err)
}
err = s.addLease(l)
if err != nil {
// TODO(a.garipov): Wrap and bubble up the error. </s> remove // normalizeHostname normalizes a hostname sent by the client.
</s> add // normalizeHostname normalizes a hostname sent by the client. If err is not
// nil, norm is an empty string. </s> remove lease.Hostname = hostname
</s> add </s> remove err := s.addLease(l)
</s> add l.Hostname, err = s.validHostnameForClient(l.Hostname, l.IP) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/c8092fe34d62f00ee6c224c0eddbdb5a58ec3bcc | internal/dhcpd/v4.go |
log.Info("dhcpv4: warning: client hostname %q is invalid: %s", cliHostname, err) | <mask>
<mask> var hostname string
<mask> hostname, err = normalizeHostname(cliHostname)
<mask> if err != nil {
<mask> log.Error("dhcpv4: cannot normalize hostname for %s: %s", mac, err)
<mask>
<mask> // Go on and assign a hostname made from the IP.
<mask> }
<mask>
<mask> if hostname != "" {
<mask> if cliHostname != hostname {
<mask> log.Debug(
<mask> "dhcpv4: normalized hostname %q into %q",
<mask> cliHostname,
<mask> hostname,
<mask> )
<mask> }
<mask>
<mask> if lease.Hostname != hostname {
<mask> // Either a new lease or an old lease with a new
<mask> // hostname, so validate.
<mask> err = s.validateHostname(hostname)
<mask> if err != nil {
<mask> log.Error("dhcpv4: validating %s: %s", mac, err)
<mask>
<mask> // Go on and assign a hostname made from
<mask> // the IP below.
<mask> hostname = ""
<mask> }
<mask> }
<mask> }
<mask>
<mask> if hostname == "" {
<mask> hostname = aghnet.GenerateHostname(reqIP)
<mask> }
<mask>
<mask> lease.Hostname = hostname
<mask> s.commitLease(lease)
<mask> } else if len(lease.Hostname) != 0 {
</s> Pull request: dhcpd: normalize hostnames of invalid static leases
Updates #3027.
Squashed commit of the following:
commit 171ebaecb4b96ebeb2d0fa350460c65f244e94ae
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Thu Apr 29 14:45:04 2021 +0300
all: imp docs
commit 48b13ed5b435042a0622a66b60407116ae5aa288
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Thu Apr 29 14:34:28 2021 +0300
dhcpd: normalize hostnames of invalid static leases </s> remove
var hostname string
hostname, err = normalizeHostname(cliHostname)
</s> add lease.Hostname, err = s.validHostnameForClient(cliHostname, reqIP) </s> remove lease.Hostname = hostname
</s> add </s> remove // TODO(a.garipov): Better error handling.
</s> add log.Info("dhcpv4: warning: previous hostname %q is invalid: %s", l.Hostname, err)
}
err = s.addLease(l)
if err != nil {
// TODO(a.garipov): Wrap and bubble up the error. </s> remove // normalizeHostname normalizes a hostname sent by the client.
</s> add // normalizeHostname normalizes a hostname sent by the client. If err is not
// nil, norm is an empty string. </s> remove err := s.addLease(l)
</s> add l.Hostname, err = s.validHostnameForClient(l.Hostname, l.IP) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"re... | https://github.com/AdguardTeam/AdGuardHome/commit/c8092fe34d62f00ee6c224c0eddbdb5a58ec3bcc | internal/dhcpd/v4.go |
<mask> if hostname == "" {
<mask> hostname = aghnet.GenerateHostname(reqIP)
<mask> }
<mask>
<mask> lease.Hostname = hostname
<mask> s.commitLease(lease)
<mask> } else if len(lease.Hostname) != 0 {
<mask> o := &optFQDN{
<mask> name: lease.Hostname,
<mask> }
</s> Pull request: dhcpd: normalize hostnames of invalid static leases
Updates #3027.
Squashed commit of the following:
commit 171ebaecb4b96ebeb2d0fa350460c65f244e94ae
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Thu Apr 29 14:45:04 2021 +0300
all: imp docs
commit 48b13ed5b435042a0622a66b60407116ae5aa288
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Thu Apr 29 14:34:28 2021 +0300
dhcpd: normalize hostnames of invalid static leases </s> remove log.Error("dhcpv4: cannot normalize hostname for %s: %s", mac, err)
// Go on and assign a hostname made from the IP.
}
if hostname != "" {
if cliHostname != hostname {
log.Debug(
"dhcpv4: normalized hostname %q into %q",
cliHostname,
hostname,
)
}
if lease.Hostname != hostname {
// Either a new lease or an old lease with a new
// hostname, so validate.
err = s.validateHostname(hostname)
if err != nil {
log.Error("dhcpv4: validating %s: %s", mac, err)
// Go on and assign a hostname made from
// the IP below.
hostname = ""
}
}
}
if hostname == "" {
hostname = aghnet.GenerateHostname(reqIP)
</s> add log.Info("dhcpv4: warning: client hostname %q is invalid: %s", cliHostname, err) </s> remove
var hostname string
hostname, err = normalizeHostname(cliHostname)
</s> add lease.Hostname, err = s.validHostnameForClient(cliHostname, reqIP) </s> remove // TODO(a.garipov): Better error handling.
</s> add log.Info("dhcpv4: warning: previous hostname %q is invalid: %s", l.Hostname, err)
}
err = s.addLease(l)
if err != nil {
// TODO(a.garipov): Wrap and bubble up the error. </s> remove // normalizeHostname normalizes a hostname sent by the client.
</s> add // normalizeHostname normalizes a hostname sent by the client. If err is not
// nil, norm is an empty string. | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/c8092fe34d62f00ee6c224c0eddbdb5a58ec3bcc | internal/dhcpd/v4.go | |
CacheSize uint32 `yaml:"cache_size"` // DNS cache size (in bytes)
CacheMinTTL uint32 `yaml:"cache_ttl_min"` // override TTL value (minimum) received from upstream server
CacheMaxTTL uint32 `yaml:"cache_ttl_max"` // override TTL value (maximum) received from upstream server | <mask> // IP (or domain name) which is used to respond to DNS requests blocked by parental control or safe-browsing
<mask> ParentalBlockHost string `yaml:"parental_block_host"`
<mask> SafeBrowsingBlockHost string `yaml:"safebrowsing_block_host"`
<mask>
<mask> CacheSize uint `yaml:"cache_size"` // DNS cache size (in bytes)
<mask> UpstreamDNS []string `yaml:"upstream_dns"`
<mask> }
<mask>
<mask> // TLSConfig is the TLS configuration for HTTPS, DNS-over-HTTPS, and DNS-over-TLS
<mask> type TLSConfig struct {
</s> Merge: + DNS: new settings cache_ttl_min, cache_ttl_max
Close #1214
Squashed commit of the following:
commit e445125556c9f9441c3d6936cb923db0a7e58260
Merge: c88b25ca 63923fa8
Author: Simon Zolin <s.zolin@adguard.com>
Date: Fri Mar 20 19:12:21 2020 +0300
Merge remote-tracking branch 'origin/master' into 1214-cache-min-ttl
commit c88b25ca4b641918f32811212c2cf3b63a5bf654
Author: Simon Zolin <s.zolin@adguard.com>
Date: Fri Mar 20 19:02:17 2020 +0300
minor
commit ec3dc21bb211941c71adcec38796eeadb978b2b7
Author: Simon Zolin <s.zolin@adguard.com>
Date: Thu Mar 19 12:18:08 2020 +0300
+ DNS: new settings cache_ttl_min, cache_ttl_max </s> remove github.com/sparrc/go-ping v0.0.0-20181106165434-ef3ab45e41b0
</s> add github.com/sparrc/go-ping v0.0.0-20190613174326-4e5b6552494c </s> remove github.com/sparrc/go-ping v0.0.0-20181106165434-ef3ab45e41b0 h1:mu7brOsdaH5Dqf93vdch+mr/0To8Sgc+yInt/jE/RJM=
github.com/sparrc/go-ping v0.0.0-20181106165434-ef3ab45e41b0/go.mod h1:eMyUVp6f/5jnzM+3zahzl7q6UXLbgSc3MKg/+ow9QW0=
</s> add github.com/sparrc/go-ping v0.0.0-20190613174326-4e5b6552494c h1:gqEdF4VwBu3lTKGHS9rXE9x1/pEaSwCXRLOZRF6qtlw=
github.com/sparrc/go-ping v0.0.0-20190613174326-4e5b6552494c/go.mod h1:eMyUVp6f/5jnzM+3zahzl7q6UXLbgSc3MKg/+ow9QW0= </s> remove github.com/AdguardTeam/dnsproxy v0.23.7 h1:RINLso8/CH4Ugfydk+rQLuKVTy4zwZRQKVRymqGDVkQ=
github.com/AdguardTeam/dnsproxy v0.23.7/go.mod h1:2qy8rpdfBzKgMPxkHmPdaNK4XZJ322v4KtVGI8s8Bn0=
</s> add github.com/AdguardTeam/dnsproxy v0.24.0 h1:GuweAeh9CLCeaNQiXGeuRHi7vWzHXhzZzC7kxRO6YA4=
github.com/AdguardTeam/dnsproxy v0.24.0/go.mod h1:TPJqGt5Ys0mSeBnSMlD1VOdSLdjYykoawe+M2qPQc10= </s> remove github.com/AdguardTeam/dnsproxy v0.23.7
</s> add github.com/AdguardTeam/dnsproxy v0.24.0 | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/c8285c41d723e90a7f0f0b7d874731bd534e4202 | dnsforward/dnsforward.go |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.