diff --git a/client/src/__locales/en.json b/client/src/__locales/en.json index 45c33828..b70cdd37 100644 --- a/client/src/__locales/en.json +++ b/client/src/__locales/en.json @@ -246,5 +246,8 @@ "form_error_equal": "Shouldn't be equal", "form_error_password": "Password mismatched", "reset_settings": "Reset settings", - "update_announcement": "AdGuard Home {{version}} is now available! <0>Click here for more info." + "update_announcement": "AdGuard Home {{version}} is now available! <0>Click here for more info.", + "upstream_parallel": "Use parallel queries to speed up resolving by simultaneously querying all upstream servers", + "bootstrap_dns": "Bootstrap DNS", + "bootstrap_dns_desc": "Bootstrap DNS for DNS-over-HTTPS and DNS-over-TLS servers" } diff --git a/client/src/actions/index.js b/client/src/actions/index.js index 1bb99064..0bb99940 100644 --- a/client/src/actions/index.js +++ b/client/src/actions/index.js @@ -3,7 +3,7 @@ import round from 'lodash/round'; import { t } from 'i18next'; import { showLoading, hideLoading } from 'react-redux-loading-bar'; -import { normalizeHistory, normalizeFilteringStatus, normalizeLogs } from '../helpers/helpers'; +import { normalizeHistory, normalizeFilteringStatus, normalizeLogs, normalizeTextarea } from '../helpers/helpers'; import { SETTINGS_NAMES } from '../helpers/constants'; import Api from '../api/Api'; @@ -452,10 +452,14 @@ export const setUpstreamRequest = createAction('SET_UPSTREAM_REQUEST'); export const setUpstreamFailure = createAction('SET_UPSTREAM_FAILURE'); export const setUpstreamSuccess = createAction('SET_UPSTREAM_SUCCESS'); -export const setUpstream = url => async (dispatch) => { +export const setUpstream = config => async (dispatch) => { dispatch(setUpstreamRequest()); try { - await apiClient.setUpstream(url); + const values = { ...config }; + values.bootstrap_dns = (values.bootstrap_dns && normalizeTextarea(values.bootstrap_dns)) || ''; + values.upstream_dns = (values.upstream_dns && normalizeTextarea(values.upstream_dns)) || ''; + + await apiClient.setUpstream(values); dispatch(addSuccessToast('updated_upstream_dns_toast')); dispatch(setUpstreamSuccess()); } catch (error) { @@ -468,9 +472,10 @@ export const testUpstreamRequest = createAction('TEST_UPSTREAM_REQUEST'); export const testUpstreamFailure = createAction('TEST_UPSTREAM_FAILURE'); export const testUpstreamSuccess = createAction('TEST_UPSTREAM_SUCCESS'); -export const testUpstream = servers => async (dispatch) => { +export const testUpstream = values => async (dispatch) => { dispatch(testUpstreamRequest()); try { + const servers = normalizeTextarea(values); const upstreamResponse = await apiClient.testUpstream(servers); const testMessages = Object.keys(upstreamResponse).map((key) => { diff --git a/client/src/api/Api.js b/client/src/api/Api.js index d20a334a..17df1221 100644 --- a/client/src/api/Api.js +++ b/client/src/api/Api.js @@ -34,7 +34,7 @@ export default class Api { GLOBAL_QUERY_LOG = { path: 'querylog', method: 'GET' }; GLOBAL_QUERY_LOG_ENABLE = { path: 'querylog_enable', method: 'POST' }; GLOBAL_QUERY_LOG_DISABLE = { path: 'querylog_disable', method: 'POST' }; - GLOBAL_SET_UPSTREAM_DNS = { path: 'set_upstream_dns', method: 'POST' }; + GLOBAL_SET_UPSTREAM_DNS = { path: 'set_upstreams_config', method: 'POST' }; GLOBAL_TEST_UPSTREAM_DNS = { path: 'test_upstream_dns', method: 'POST' }; GLOBAL_VERSION = { path: 'version.json', method: 'GET' }; GLOBAL_ENABLE_PROTECTION = { path: 'enable_protection', method: 'POST' }; @@ -110,7 +110,7 @@ export default class Api { const { path, method } = this.GLOBAL_SET_UPSTREAM_DNS; const config = { data: url, - header: { 'Content-Type': 'text/plain' }, + headers: { 'Content-Type': 'application/json' }, }; return this.makeRequest(path, method, config); } @@ -119,7 +119,7 @@ export default class Api { const { path, method } = this.GLOBAL_TEST_UPSTREAM_DNS; const config = { data: servers, - header: { 'Content-Type': 'text/plain' }, + headers: { 'Content-Type': 'application/json' }, }; return this.makeRequest(path, method, config); } diff --git a/client/src/components/Settings/Upstream.js b/client/src/components/Settings/Upstream.js deleted file mode 100644 index fe24c4d7..00000000 --- a/client/src/components/Settings/Upstream.js +++ /dev/null @@ -1,97 +0,0 @@ -import React, { Component } from 'react'; -import PropTypes from 'prop-types'; -import classnames from 'classnames'; -import { Trans, withNamespaces } from 'react-i18next'; -import Card from '../ui/Card'; - -class Upstream extends Component { - handleChange = (e) => { - const { value } = e.currentTarget; - this.props.handleUpstreamChange(value); - }; - - handleSubmit = (e) => { - e.preventDefault(); - this.props.handleUpstreamSubmit(); - }; - - handleTest = () => { - this.props.handleUpstreamTest(); - } - - render() { - const testButtonClass = classnames({ - 'btn btn-primary btn-standard mr-2': true, - 'btn btn-primary btn-standard mr-2 btn-loading': this.props.processingTestUpstream, - }); - const { t } = this.props; - - return ( - -
-
-
-