- client: Fix client Access settings normalization
Close #1820 Squashed commit of the following: commit 5aadec2e6e126588313ff006d6f95223ba19a526 Merge: a4db6b4295f41285Author: ArtemBaskal <a.baskal@adguard.com> Date: Wed Jul 15 11:15:31 2020 +0300 Merge branch 'master' into fix/1820 commit a4db6b42ab9cbf43d96c783a72a99e0a2c594108 Author: ArtemBaskal <a.baskal@adguard.com> Date: Tue Jul 14 19:08:09 2020 +0300 Remove textarea comma splitting commit bb34797aac6602b405941dbd90fe6a81b663bb92 Author: ArtemBaskal <a.baskal@adguard.com> Date: Tue Jul 14 18:21:18 2020 +0300 Fix client Access settings normalization commit ac4fb536514f54c5722077d78dbbd981c4e906a8 Merge: 0c758ddcb9fca8d0Author: ArtemBaskal <a.baskal@adguard.com> Date: Tue Jul 14 18:14:38 2020 +0300 Merge branch 'master' into fix/1820 commit 0c758ddcd738136b92e6f947a8068ecc59f7ec25 Merge: 15650db3f5a1f311Author: ArtemBaskal <a.baskal@adguard.com> Date: Fri Jul 3 11:22:00 2020 +0300 Merge branch 'master' into fix/1820 commit 15650db35323009001fd427a74a312705b54ac86 Author: ArtemBaskal <a.baskal@adguard.com> Date: Mon Jun 29 12:01:51 2020 +0300 '- client: Don't normalise disallowed domains'
This commit is contained in:
@@ -2,9 +2,9 @@ import { createAction } from 'redux-actions';
|
||||
import i18next from 'i18next';
|
||||
|
||||
import apiClient from '../api/Api';
|
||||
import { normalizeTextarea } from '../helpers/helpers';
|
||||
import { addErrorToast, addSuccessToast } from './toasts';
|
||||
import { BLOCK_ACTIONS } from '../helpers/constants';
|
||||
import { splitByNewLine } from '../helpers/helpers';
|
||||
|
||||
export const getAccessListRequest = createAction('GET_ACCESS_LIST_REQUEST');
|
||||
export const getAccessListFailure = createAction('GET_ACCESS_LIST_FAILURE');
|
||||
@@ -31,9 +31,9 @@ export const setAccessList = (config) => async (dispatch) => {
|
||||
const { allowed_clients, disallowed_clients, blocked_hosts } = config;
|
||||
|
||||
const values = {
|
||||
allowed_clients: normalizeTextarea(allowed_clients),
|
||||
disallowed_clients: normalizeTextarea(disallowed_clients),
|
||||
blocked_hosts: normalizeTextarea(blocked_hosts),
|
||||
allowed_clients: splitByNewLine(allowed_clients),
|
||||
disallowed_clients: splitByNewLine(disallowed_clients),
|
||||
blocked_hosts: splitByNewLine(blocked_hosts),
|
||||
};
|
||||
|
||||
await apiClient.setAccessList(values);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { createAction } from 'redux-actions';
|
||||
|
||||
import apiClient from '../api/Api';
|
||||
import { normalizeTextarea } from '../helpers/helpers';
|
||||
import { splitByNewLine } from '../helpers/helpers';
|
||||
import { addErrorToast, addSuccessToast } from './toasts';
|
||||
|
||||
export const getDnsConfigRequest = createAction('GET_DNS_CONFIG_REQUEST');
|
||||
@@ -30,11 +30,11 @@ export const setDnsConfig = (config) => async (dispatch) => {
|
||||
|
||||
let hasDnsSettings = false;
|
||||
if (Object.prototype.hasOwnProperty.call(data, 'bootstrap_dns')) {
|
||||
data.bootstrap_dns = normalizeTextarea(config.bootstrap_dns);
|
||||
data.bootstrap_dns = splitByNewLine(config.bootstrap_dns);
|
||||
hasDnsSettings = true;
|
||||
}
|
||||
if (Object.prototype.hasOwnProperty.call(data, 'upstream_dns')) {
|
||||
data.upstream_dns = normalizeTextarea(config.upstream_dns);
|
||||
data.upstream_dns = splitByNewLine(config.upstream_dns);
|
||||
hasDnsSettings = true;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ import { createAction } from 'redux-actions';
|
||||
import i18next from 'i18next';
|
||||
import axios from 'axios';
|
||||
|
||||
import { isVersionGreater, normalizeTextarea, sortClients } from '../helpers/helpers';
|
||||
import { isVersionGreater, splitByNewLine, sortClients } from '../helpers/helpers';
|
||||
import { CHECK_TIMEOUT, SETTINGS_NAMES } from '../helpers/constants';
|
||||
import { getTlsStatus } from './encryption';
|
||||
import apiClient from '../api/Api';
|
||||
@@ -279,8 +279,8 @@ export const testUpstream = (config) => async (dispatch) => {
|
||||
dispatch(testUpstreamRequest());
|
||||
try {
|
||||
const values = { ...config };
|
||||
values.bootstrap_dns = normalizeTextarea(values.bootstrap_dns);
|
||||
values.upstream_dns = normalizeTextarea(values.upstream_dns);
|
||||
values.bootstrap_dns = splitByNewLine(values.bootstrap_dns);
|
||||
values.upstream_dns = splitByNewLine(values.upstream_dns);
|
||||
|
||||
const upstreamResponse = await apiClient.testUpstream(values);
|
||||
const testMessages = Object.keys(upstreamResponse)
|
||||
|
||||
Reference in New Issue
Block a user