diff --git a/client/src/__locales/en.json b/client/src/__locales/en.json index b70cdd37..550ad44d 100644 --- a/client/src/__locales/en.json +++ b/client/src/__locales/en.json @@ -79,7 +79,7 @@ "no_settings": "No settings", "general_settings": "General settings", "upstream_dns": "Upstream DNS servers", - "upstream_dns_hint": "If you keep this field empty, AdGuard Home will use Cloudflare DNS<\/a> as an upstream. Use tls:\/\/ prefix for DNS over TLS servers.", + "upstream_dns_hint": "If you keep this field empty, AdGuard Home will use Cloudflare DNS<\/a> as an upstream.", "test_upstream_btn": "Test upstreams", "apply_btn": "Apply", "disabled_filtering_toast": "Disabled filtering", @@ -248,6 +248,6 @@ "reset_settings": "Reset settings", "update_announcement": "AdGuard Home {{version}} is now available! <0>Click here0> 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" + "bootstrap_dns": "Bootstrap DNS servers", + "bootstrap_dns_desc": "Bootstrap DNS servers are used to resolve the IP address of the DOH/DOT resolvers you specify as upstreams." } diff --git a/client/src/actions/index.js b/client/src/actions/index.js index 0bb99940..9711a0dc 100644 --- a/client/src/actions/index.js +++ b/client/src/actions/index.js @@ -456,8 +456,12 @@ export const setUpstream = config => async (dispatch) => { dispatch(setUpstreamRequest()); try { const values = { ...config }; - values.bootstrap_dns = (values.bootstrap_dns && normalizeTextarea(values.bootstrap_dns)) || ''; - values.upstream_dns = (values.upstream_dns && normalizeTextarea(values.upstream_dns)) || ''; + 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')); @@ -472,12 +476,19 @@ export const testUpstreamRequest = createAction('TEST_UPSTREAM_REQUEST'); export const testUpstreamFailure = createAction('TEST_UPSTREAM_FAILURE'); export const testUpstreamSuccess = createAction('TEST_UPSTREAM_SUCCESS'); -export const testUpstream = values => async (dispatch) => { +export const testUpstream = config => async (dispatch) => { dispatch(testUpstreamRequest()); try { - const servers = normalizeTextarea(values); - const upstreamResponse = await apiClient.testUpstream(servers); + const values = { ...config }; + values.bootstrap_dns = ( + values.bootstrap_dns && normalizeTextarea(values.bootstrap_dns) + ) || []; + values.upstream_dns = ( + values.upstream_dns && normalizeTextarea(values.upstream_dns) + ) || []; + console.log(values); + const upstreamResponse = await apiClient.testUpstream(values); const testMessages = Object.keys(upstreamResponse).map((key) => { const message = upstreamResponse[key]; if (message !== 'OK') { diff --git a/client/src/components/Settings/Upstream/Form.js b/client/src/components/Settings/Upstream/Form.js index 7a38b31a..245e7d27 100644 --- a/client/src/components/Settings/Upstream/Form.js +++ b/client/src/components/Settings/Upstream/Form.js @@ -14,6 +14,8 @@ let Form = (props) => { handleSubmit, testUpstream, upstreamDns, + bootstrapDns, + allServers, submitting, invalid, processingSetUpstream, @@ -30,7 +32,9 @@ let Form = (props) => { - {t('upstream_dns')} + + upstream_dns + { - {t('bootstrap_dns')} + + bootstrap_dns + + + bootstrap_dns_desc + @@ -70,7 +79,11 @@ let Form = (props) => { testUpstream(upstreamDns)} + onClick={() => testUpstream({ + upstream_dns: upstreamDns, + bootstrap_dns: bootstrapDns, + all_servers: allServers, + })} disabled={!upstreamDns || processingTestUpstream} > test_upstream_btn @@ -100,6 +113,8 @@ Form.propTypes = { invalid: PropTypes.bool, initialValues: PropTypes.object, upstreamDns: PropTypes.string, + bootstrapDns: PropTypes.string, + allServers: PropTypes.bool, processingTestUpstream: PropTypes.bool, processingSetUpstream: PropTypes.bool, t: PropTypes.func, @@ -109,8 +124,12 @@ const selector = formValueSelector('upstreamForm'); Form = connect((state) => { const upstreamDns = selector(state, 'upstream_dns'); + const bootstrapDns = selector(state, 'bootstrap_dns'); + const allServers = selector(state, 'all_servers'); return { upstreamDns, + bootstrapDns, + allServers, }; })(Form); diff --git a/client/src/components/Settings/index.js b/client/src/components/Settings/index.js index 6f0be6b1..e6c39cf7 100644 --- a/client/src/components/Settings/index.js +++ b/client/src/components/Settings/index.js @@ -75,7 +75,7 @@ class Settings extends Component {